Preferences::Preferences(QWidget *w) : Q3TabDialog(w, "Preferences", FALSE, Qt::WDestructiveClose) { helpFile = "preferences.html"; setCaption(tr("Edit Prefs")); loadSettings(); createGeneralPage(); createColorPage(); createFontPage(); createMTPage(); // main tool bar createCTPage(); // chart tool bar createETPage(); // extra tool bar setApplyButton(tr("&Apply")); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(slotSave())); setCancelButton(tr("&Ok")); //connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(exitDialog())); setOkButton(QString::null); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(slotHelp())); resize(sz); }
CSV::CSV () { pluginName = "CSV"; delim = ','; helpFile = "csv.html"; cancelFlag = FALSE; reloadTimer = new QTimer(this); connect(reloadTimer, SIGNAL(timeout()), SLOT(parse())); config.getData(Config::QuotePluginStorage, ruleDir); ruleDir.append("/CSV"); QDir dir; if (! dir.exists(ruleDir)) { if (! dir.mkdir(ruleDir, TRUE)) qDebug("CSVDialog::could not create storage directory %s", ruleDir.latin1()); } createMainPage(); setOkButton(); setCancelButton(); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(help())); loadSettings(); updateRules(); resize(640, 480); }
StocksDialog::StocksDialog (QString p, DbPlugin *d, DBIndex *i) : Q3TabDialog (0, "StocksDialog", TRUE) { helpFile = p; db = d; index = i; reloadFlag = FALSE; currentDate = QDateTime::currentDateTime(); setCaption(tr("Qtstalker: Edit Stock")); QString s; d->getSymbol(s); QFileInfo fi(s); symbol = fi.fileName(); createDetailsPage(); createDataPage(); createFundamentalsPage(); createSplitPage(); setOkButton(tr("&OK")); setCancelButton(tr("&Cancel")); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(saveChart())); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(help())); RcFile rcfile; QSize sz; rcfile.loadSize(RcFile::EditStockWindowSize, sz); resize(sz); }
ZLQtOptionsDialog::ZLQtOptionsDialog(const ZLResource &resource, shared_ptr<ZLRunnable> applyAction, bool showApplyButton) : QTabDialog(0, 0, true), ZLDesktopOptionsDialog(resource, applyAction) { setCaption(::qtString(ZLOptionsDialog::caption())); setOkButton(::qtButtonName(ZLDialogManager::OK_BUTTON)); setHelpButton(::qtButtonName(ZLDialogManager::CANCEL_BUTTON)); connect(this, SIGNAL(helpButtonPressed()), this, SLOT(reject())); if (showApplyButton) { setApplyButton(::qtButtonName(ZLDialogManager::APPLY_BUTTON)); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(apply())); } }
SpreadDialog::SpreadDialog (QString &nam, QString &fs, QString &ss) : QTabDialog (0, "SpreadDialog", TRUE) { helpFile = "spread.html"; setCaption(tr("Spread Dialog")); QWidget *w = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(0); QGridLayout *grid = new QGridLayout(vbox, 1, 2); grid->setSpacing(5); grid->setColStretch(1, 1); QLabel *label = new QLabel(tr("Name"), w); grid->addWidget(label, 0, 0); name = new QLineEdit(nam, w); grid->addWidget(name, 0, 1); label = new QLabel(tr("First Symbol"), w); grid->addWidget(label, 1, 0); Config config; QString path; config.getData(Config::DataPath, path); firstSymbol = new SymbolButton(w, path, fs); grid->addWidget(firstSymbol, 1, 1); label = new QLabel(tr("Second Symbol"), w); grid->addWidget(label, 2, 0); secondSymbol = new SymbolButton(w, path, ss); grid->addWidget(secondSymbol, 2, 1); vbox->insertStretch(-1, 1); addTab(w, tr("Settings")); setOkButton(); setCancelButton(); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(help())); resize(400, 300); }
/** * Constructs the dialog. */ SettingsDialog::SettingsDialog(int tabIndex, QWidget* parent, const char* name, bool modal, WFlags fl) : QTabDialog(parent, name, modal, fl) { setCaption(tr("Settings")); setApplyButton(tr("Apply")); setCancelButton(tr("Cancel")); setOkButton(tr("OK")); setHelpButton(tr("Help")); this->addTab(createGeneralTab(), tr("General")); this->addTab(createPathTab(), tr("Paths")); this->addTab(createDownloadTab(), tr("Download")); setup(); if (tabIndex >= 0 && tabIndex < tabBar()->count()) { tabBar()->setCurrentTab(tabIndex); } resize(sizeHint());//resize(400, 400); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(applySettings())); }
FuturesDialog::FuturesDialog (QString p, DbPlugin *d, DBIndex *i) : Q3TabDialog (0, "FuturesDialog", TRUE) { helpFile = p; db = d; index = i; reloadFlag = FALSE; currentDate = QDateTime::currentDateTime(); setCaption(tr("Qtstalker: Edit Futures")); QString s; d->getSymbol(s); QFileInfo fi(s); symbol = fi.fileName(); createDetailsPage(); createDataPage(); setOkButton(tr("&OK")); setCancelButton(tr("&Cancel")); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(saveChart())); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(help())); }
SettingsDialog::SettingsDialog(StateSpecVector * st, ColorSpecVector * co, bool nodefault, bool unchanged, QString title) : QTabDialog(0, title, TRUE), states(st), colors(co), first_visible_page(0), several(unchanged), did_apply(FALSE) { setCaption((title.isEmpty()) ? TR("Diagram Drawing Settings dialog") : title); QString s_diagram = TR("diagram"); QGrid * grid = 0; QString tabname; unsigned i; unsigned n; if (states != 0) { n = states->size(); cbstates = new QVector<ComboStates>(n); for (i = 0; i != n; i += 1) { StateSpec & st = states->at(i); QString s = st.name; int index = s.find('#'); QString tbn; if (index != -1) { tbn = s.left(index); s = s.mid(index + 1); } else tbn = s_diagram; if ((grid == 0) || (tabname != tbn)) { if (grid != 0) { addTab(grid, tabname); grid->setName(tabname); if (tabname == previous_active_tab) first_visible_page = grid; } grid = new QGrid(5, this); grid->setMargin(2); grid->setSpacing(2); tabname = tbn; } new QLabel("", grid); new QLabel(s + " : ", grid); QHBox * hb = new QHBox(grid); switch (st.who) { case StateSpec::is3states: cbstates->insert(i, new ComboStates(hb, *((Uml3States *) st.state), nodefault, unchanged)); break; case StateSpec::isClassDrawingMode: cbstates->insert(i, new ComboStates(hb, *((ClassDrawingMode *) st.state), nodefault, unchanged)); break; case StateSpec::isDrawingLanguage: cbstates->insert(i, new ComboStates(hb, *((DrawingLanguage *) st.state), nodefault, unchanged)); break; case StateSpec::isShowContextMode: cbstates->insert(i, new ComboStates(hb, *((ShowContextMode *) st.state), nodefault, unchanged)); break; default: cbstates->insert(i, new ComboStates(hb, *((char *) st.state), nodefault, unchanged)); } new QLabel("", hb); new QLabel("", grid); new QLabel("", grid); } addTab(grid, tabname); grid->setName(tabname); if (tabname == previous_active_tab) first_visible_page = grid; } if (colors != 0) { QString lbl = TR("color"); QString s_default = TR("default "); n = colors->size(); cbcolors = new QVector<ComboColor>(n); grid = new QGrid(5, this); grid->setMargin(2); grid->setSpacing(2); for (i = 0; i != n; i += 1) { if (i == 11) { lbl = TR("color [1]"); addTab(grid, lbl); grid->setName(lbl); if (previous_active_tab == lbl) first_visible_page = grid; lbl = TR("color [2]"); grid = new QGrid(5, this); grid->setMargin(2); grid->setSpacing(2); } new QLabel("", grid); QString s = colors->at(i).name; s += " : "; new QLabel(s, grid); cbcolors->insert(i, new ComboColor(grid, *(colors->at(i).color), nodefault, unchanged)); new QLabel("", grid); new QLabel("", grid); } addTab(grid, lbl); grid->setName(lbl); if (previous_active_tab == lbl) first_visible_page = grid; } // use help rather than apply because when the OK button is clicked, // the applyButtonPressed() signal is emitted setOkButton(TR("OK")); setHelpButton(TR("Apply")); setCancelButton(TR("Cancel")); connect(this, SIGNAL(helpButtonPressed()), this, SLOT(apply())); }
IndexDialog::IndexDialog (QString &nam, QString &l) : QTabDialog (0, "IndexDialog", TRUE) { helpFile = "indexes.html"; QWidget *w = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(5); QGridLayout *grid = new QGridLayout(vbox); grid->setColStretch(1, 1); grid->setSpacing(5); QLabel *label = new QLabel(tr("Name"), w); grid->addWidget(label, 0, 0); name = new QLineEdit(nam, w); grid->addWidget(name, 0, 1); QHBoxLayout *hbox = new QHBoxLayout(vbox); hbox->setSpacing(2); list = new QListView(w); list->addColumn(tr("Symbol"), 200); list->addColumn(tr("Weight"), -1); QObject::connect(list, SIGNAL(selectionChanged()), this, SLOT(buttonStatus())); hbox->addWidget(list); toolbar = new Toolbar(w, Toolbar::Vertical); hbox->addWidget(toolbar); QString s = "add"; QString s2 = tr("Add Item"); toolbar->addButton(s, insert, s2); QObject::connect(toolbar->getButton(s), SIGNAL(clicked()), this, SLOT(addItem())); s = "edit"; s2 = tr("Edit"); toolbar->addButton(s, edit, s2); QObject::connect(toolbar->getButton(s), SIGNAL(clicked()), this, SLOT(editItem())); s = "delete"; s2 = tr("Delete"); toolbar->addButton(s, deleteitem, s2); QObject::connect(toolbar->getButton(s), SIGNAL(clicked()), this, SLOT(deleteItem())); vbox->insertStretch(-1, 1); addTab(w, tr("Details")); setOkButton(tr("&OK")); setCancelButton(tr("&Cancel")); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(accept())); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(help())); setList(l); resize(325, 250); }
Scanner::Scanner (QString n, DBIndex *i) : QTabDialog (0, 0, FALSE) { chartIndex = i; scannerName = n; QString s = "Qtstalker Scanner"; s.append(": "); s.append(scannerName); setCaption (s); QWidget *w = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(5); QHGroupBox *gbox = new QHGroupBox(tr("Symbol Selection"), w); vbox->addWidget(gbox); allSymbols = new QCheckBox(tr("All symbols"), gbox); connect(allSymbols, SIGNAL(toggled(bool)), this, SLOT(allSymbolsToggled(bool))); fileButton = new QPushButton(tr("0 Symbols"), gbox); connect(fileButton, SIGNAL(clicked()), this, SLOT(getSymbols())); basePath = new QComboBox(gbox); basePath->insertItem(tr("Chart"), -1); basePath->insertItem(tr("Group"), -1); QGridLayout *grid = new QGridLayout(vbox, 1, 2); grid->setColStretch(1, 1); QLabel *label = new QLabel(tr("Bar Length"), w); grid->addWidget(label, 0, 0); BarData bd(scannerName); period = new QComboBox(w); bd.getBarLengthList(barLengthList); period->insertStringList(barLengthList, -1); period->setCurrentText("Daily"); grid->addWidget(period, 0, 1); label = new QLabel(tr("Bars"), w); grid->addWidget(label, 1, 0); bars = new QSpinBox(1, 99999999, 1, w); bars->setValue(100); grid->addWidget(bars, 1, 1); list = new FormulaEdit(w, FormulaEdit::Logic); vbox->addWidget(list); setDefaultButton(tr("&Scan")); connect(this, SIGNAL(defaultButtonPressed()), this, SLOT(scan())); setApplyButton(tr("&Apply")); connect(this, SIGNAL(applyButtonPressed()), this, SLOT(saveRule())); setCancelButton(tr("&Cancel")); connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(exitDialog())); setOkButton(QString::null); setHelpButton(); QObject::connect(this, SIGNAL(helpButtonPressed()), this, SLOT(slotHelp())); addTab(w, tr("Parms")); loadRule(); }
void KNoteBook::setHelpButton() { setHelpButton(klocale->translate("&Help")); }
Expert::Expert( QWidget *parent ) : QTabDialog( parent ) { m_dependencies = new QDict< QList<IInput> >(257); m_dependencies->setAutoDelete(TRUE); m_inputWidgets = new QDict< IInput >; m_switches = new QDict< QObject >; m_changed = FALSE; setHelpButton(); QListIterator<ConfigOption> options = Config::instance()->iterator(); QVBoxLayout *pageLayout = 0; QFrame *page = 0; ConfigOption *option = 0; for (options.toFirst();(option=options.current());++options) { switch(option->kind()) { case ConfigOption::O_Info: { if (pageLayout) pageLayout->addStretch(1); QScrollView *view = new QScrollView(this); view->setVScrollBarMode(QScrollView::Auto); view->setHScrollBarMode(QScrollView::AlwaysOff); view->setResizePolicy(QScrollView::AutoOneFit); page = new QFrame( view->viewport(), option->name() ); pageLayout = new QVBoxLayout(page); pageLayout->setMargin(10); view->addChild(page); addTab(view,option->name()); QWhatsThis::add(page, option->docs().simplifyWhiteSpace() ); QToolTip::add(page, option->docs() ); } break; case ConfigOption::O_String: { ASSERT(page!=0); InputString::StringMode sm=InputString::StringFree; switch(((ConfigString *)option)->widgetType()) { case ConfigString::String: sm=InputString::StringFree; break; case ConfigString::File: sm=InputString::StringFile; break; case ConfigString::Dir: sm=InputString::StringDir; break; } InputString *inputString = new InputString( option->name(), // name page, // widget *((ConfigString *)option)->valueRef(), // variable sm // type ); pageLayout->addWidget(inputString); QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() ); QToolTip::add(inputString,option->docs()); connect(inputString,SIGNAL(changed()),SLOT(changed())); m_inputWidgets->insert(option->name(),inputString); addDependency(m_switches,option->dependsOn(),option->name()); } break; case ConfigOption::O_Enum: { ASSERT(page!=0); InputString *inputString = new InputString( option->name(), // name page, // widget *((ConfigEnum *)option)->valueRef(), // variable InputString::StringFixed // type ); pageLayout->addWidget(inputString); QStrListIterator sli=((ConfigEnum *)option)->iterator(); for (sli.toFirst();sli.current();++sli) { inputString->addValue(sli.current()); } inputString->init(); QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() ); QToolTip::add(inputString, option->docs()); connect(inputString,SIGNAL(changed()),SLOT(changed())); m_inputWidgets->insert(option->name(),inputString); addDependency(m_switches,option->dependsOn(),option->name()); } break; case ConfigOption::O_List: { ASSERT(page!=0); InputStrList::ListMode lm=InputStrList::ListString; switch(((ConfigList *)option)->widgetType()) { case ConfigList::String: lm=InputStrList::ListString; break; case ConfigList::File: lm=InputStrList::ListFile; break; case ConfigList::Dir: lm=InputStrList::ListDir; break; case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break; } InputStrList *inputStrList = new InputStrList( option->name(), // name page, // widget *((ConfigList *)option)->valueRef(), // variable lm // type ); pageLayout->addWidget(inputStrList); QWhatsThis::add(inputStrList, option->docs().simplifyWhiteSpace() ); QToolTip::add(inputStrList, option->docs()); connect(inputStrList,SIGNAL(changed()),SLOT(changed())); m_inputWidgets->insert(option->name(),inputStrList); addDependency(m_switches,option->dependsOn(),option->name()); } break; break; case ConfigOption::O_Bool: { ASSERT(page!=0); InputBool *inputBool = new InputBool( option->name(), // name page, // widget *((ConfigBool *)option)->valueRef() // variable ); pageLayout->addWidget(inputBool); QWhatsThis::add(inputBool, option->docs().simplifyWhiteSpace() ); QToolTip::add(inputBool, option->docs() ); connect(inputBool,SIGNAL(changed()),SLOT(changed())); m_inputWidgets->insert(option->name(),inputBool); addDependency(m_switches,option->dependsOn(),option->name()); } break; case ConfigOption::O_Int: { ASSERT(page!=0); InputInt *inputInt = new InputInt( option->name(), // name page, // widget *((ConfigInt *)option)->valueRef(), // variable ((ConfigInt *)option)->minVal(), // min value ((ConfigInt *)option)->maxVal() // max value ); pageLayout->addWidget(inputInt); QWhatsThis::add(inputInt, option->docs().simplifyWhiteSpace() ); QToolTip::add(inputInt, option->docs() ); connect(inputInt,SIGNAL(changed()),SLOT(changed())); m_inputWidgets->insert(option->name(),inputInt); addDependency(m_switches,option->dependsOn(),option->name()); } break; case ConfigOption::O_Obsolete: break; } } if (pageLayout) pageLayout->addStretch(1); QDictIterator<QObject> di(*m_switches); QObject *obj = 0; for (di.toFirst();(obj=di.current());++di) { connect(obj,SIGNAL(toggle(const char *,bool)),SLOT(toggle(const char *,bool))); // UGLY HACK: assumes each item depends on a boolean without checking! emit toggle(di.currentKey(),((InputBool *)obj)->getState()); } connect(this,SIGNAL(helpButtonPressed()),this,SLOT(handleHelp())); }
SettingsDialog::SettingsDialog(StateSpecVector * st, ColorSpecVector * co, bool nodefault, bool unchanged, QString title) : TabDialog(0, title.toLatin1().constData(), TRUE), states(st), colors(co), first_visible_page(0), several(unchanged), did_apply(FALSE) { setWindowTitle((title.isEmpty()) ? QObject::tr("Diagram Drawing Settings dialog") : title); QString s_diagram = QObject::tr("diagram"); QWidget * grid = 0; QString tabname; unsigned i; unsigned n; if (states != 0) { n = states->size(); cbstates = new QHash<int,ComboStates*>; for (i = 0; i != n; i += 1) { StateSpec & st = states->at(i); QString s = st.name; int index = s.indexOf('#'); QString tbn; if (index != -1) { tbn = s.left(index); s = s.mid(index + 1); } else tbn = s_diagram; if ((grid == 0) || (tabname != tbn)) { if (grid != 0) { addTab(grid, tabname); grid->setObjectName(tabname); if (tabname == previous_active_tab) first_visible_page = grid; } grid = WidgetWithLayout::gridBox(5, this); grid->layout()->setMargin(0); grid->layout()->setSpacing(0); tabname = tbn; } QGridLayout *gridLayout = (QGridLayout *)grid->layout(); int currentRow = gridLayout->rowCount(); //gridLayout->addWidget(new QLabel("", grid), currentRow, 0); gridLayout->addWidget(new QLabel(s + " : ", grid), currentRow, 1); QWidget * hb = WidgetWithLayout::hBox( grid); QHBoxLayout* hLayout; hLayout = (QHBoxLayout*)hb->layout(); hLayout->setMargin(0); gridLayout->addWidget(hb, currentRow, 2); ComboStates* widget; switch (st.who) { case StateSpec::is3states: cbstates->insert(i, widget = new ComboStates(hb, *((Uml3States *) st.state), nodefault, unchanged)); break; case StateSpec::isClassDrawingMode: cbstates->insert(i, widget = new ComboStates(hb, *((ClassDrawingMode *) st.state), nodefault, unchanged)); break; case StateSpec::isDrawingLanguage: cbstates->insert(i, widget = new ComboStates(hb, *((DrawingLanguage *) st.state), nodefault, unchanged)); break; case StateSpec::isShowContextMode: cbstates->insert(i, widget = new ComboStates(hb, *((ShowContextMode *) st.state), nodefault, unchanged)); break; default: cbstates->insert(i, widget = new ComboStates(hb, *((char *) st.state), nodefault, unchanged)); } hLayout->addWidget(widget); hLayout->addWidget(new QLabel("", hb)); gridLayout->addWidget(new QLabel("", grid),currentRow, 3); gridLayout->addWidget(new QLabel("", grid),currentRow, 4); } addTab(grid, tabname); grid->setObjectName(tabname); if (tabname == previous_active_tab) first_visible_page = grid; } if (colors != 0) { QString lbl = QObject::tr("color"); QString s_default = QObject::tr("default "); n = colors->size(); cbcolors = new QHash<int, ComboColor*>; GridBox *gridBox = new GridBox( 5, this); gridBox->setMargin(2); gridBox->setSpacing(2); for (i = 0; i != n; i += 1) { if (i == 11) { lbl = QObject::tr("color [1]"); addTab(gridBox, lbl); gridBox->setObjectName(lbl); if (previous_active_tab == lbl) first_visible_page = gridBox; lbl = QObject::tr("color [2]"); gridBox = new GridBox(5, this); gridBox->setMargin(2); gridBox->setSpacing(2); } gridBox->addWidget(new QLabel("", grid)); QString s = colors->at(i).name; s += " : "; gridBox->addWidget(new QLabel(s, grid)); ComboColor *ccolor = new ComboColor(grid, *(colors->at(i).color),nodefault, unchanged); gridBox->addWidget(ccolor); cbcolors->insert(i, ccolor); gridBox->addWidget(new QLabel("", grid)); gridBox->addWidget(new QLabel("", grid)); } addTab(gridBox, lbl); gridBox->setObjectName(lbl); if (previous_active_tab == lbl) first_visible_page = gridBox; } setHelpButton(tr("Apply")); // use help rather than apply because when the OK button is clicked, // the applyButtonPressed() signal is emitted setOkButton(tr("OK")); setCancelButton(tr("Cancel")); connect(this, SIGNAL(helpButtonPressed()), this, SLOT(apply())); polish(); }