00001 /* 00002 * Qtstalker stock charter 00003 * 00004 * Copyright (C) 2001-2007 Stefan S. Stratigakos 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00019 * USA. 00020 */ 00021 00022 #include "Indicator.h" 00023 #include <qobject.h> 00024 #include <qfileinfo.h> 00025 00026 Indicator::Indicator () 00027 { 00028 lines.setAutoDelete(TRUE); 00029 enable = TRUE; 00030 tabRow = 0; 00031 logScale = FALSE; 00032 dateFlag = TRUE; 00033 } 00034 00035 Indicator::~Indicator () 00036 { 00037 } 00038 00039 int Indicator::getLines () 00040 { 00041 return (int) lines.count(); 00042 } 00043 00044 PlotLine * Indicator::getLine (int i) 00045 { 00046 return lines.at(i); 00047 } 00048 00049 void Indicator::addLine (PlotLine *l) 00050 { 00051 lines.append(l); 00052 } 00053 00054 void Indicator::prependLine (PlotLine *l) 00055 { 00056 lines.prepend(l); 00057 } 00058 00059 void Indicator::setTabRow (int d) 00060 { 00061 tabRow = d; 00062 } 00063 00064 int Indicator::getTabRow () 00065 { 00066 return tabRow; 00067 } 00068 00069 void Indicator::clearLines () 00070 { 00071 lines.clear(); 00072 } 00073 00074 void Indicator::setEnable (bool status) 00075 { 00076 enable = status; 00077 } 00078 00079 bool Indicator::getEnable () 00080 { 00081 return enable; 00082 } 00083 00084 void Indicator::setName (QString &d) 00085 { 00086 name = d; 00087 } 00088 00089 void Indicator::getName (QString &d) 00090 { 00091 d = name; 00092 } 00093 00094 void Indicator::setType (QString &d) 00095 { 00096 type = d; 00097 } 00098 00099 void Indicator::getType (QString &d) 00100 { 00101 d = type; 00102 } 00103 00104 void Indicator::setFile (QString &d) 00105 { 00106 file = d; 00107 } 00108 00109 void Indicator::getFile (QString &d) 00110 { 00111 d = file; 00112 } 00113 00114 void Indicator::copy (Indicator *d) 00115 { 00116 int loop; 00117 for (loop = 0; loop < d->getLines(); loop++) 00118 { 00119 PlotLine *tpl = d->getLine(loop); 00120 PlotLine *pl = new PlotLine; 00121 pl->copy(tpl); 00122 addLine(pl); 00123 } 00124 00125 setDateFlag(d->getDateFlag()); 00126 setLogScale(d->getLogScale()); 00127 setTabRow(d->getTabRow()); 00128 setEnable(d->getEnable()); 00129 // d->getName(name); 00130 // d->getFile(file); 00131 // d->getType(type); 00132 } 00133 00134 void Indicator::setDateFlag (bool d) 00135 { 00136 dateFlag = d; 00137 } 00138 00139 bool Indicator::getDateFlag () 00140 { 00141 return dateFlag; 00142 } 00143 00144 void Indicator::setLogScale (bool d) 00145 { 00146 logScale = d; 00147 } 00148 00149 bool Indicator::getLogScale () 00150 { 00151 return logScale; 00152 } 00153 00154 void Indicator::setIndicator (Setting &set, QString &f) 00155 { 00156 QString s = "enable"; 00157 QString s2; 00158 set.getData(s, s2); 00159 if (s2.length()) 00160 setEnable((bool) s2.toInt()); 00161 00162 QFileInfo fi(f); 00163 s = fi.fileName(); 00164 setName(s); 00165 00166 setFile(f); 00167 00168 s = "plugin"; 00169 set.getData(s, s2); 00170 setType(s2); 00171 00172 s = "tabRow"; 00173 set.getData(s, s2); 00174 if (s2.length()) 00175 setTabRow(s2.toInt()); 00176 00177 s = "dateFlag"; 00178 setDateFlag((bool) set.getInt(s)); 00179 00180 s = "logScale"; 00181 setLogScale((bool) set.getInt(s)); 00182 } 00183