void Wizard::SetGenerator(GeneratorPtr gen) { // Find the right type and jump to the start page for (int i=0 ; i<plugins_.count() ; ++i) { if (plugins_[i]->type() == gen->type()) { TypeChanged(i); // TODO: Put this back in when the setStartId is removed from the ctor // next(); break; } } // Set the name finish_page_->ui_->name->setText(gen->name()); finish_page_->ui_->dynamic->setChecked(gen->is_dynamic()); // Tell the plugin to load plugins_[type_index_]->SetGenerator(gen); }
void Wizard::AddPlugin(WizardPlugin* plugin) { const int index = plugins_.count(); plugins_ << plugin; plugin->Init(this, finish_id_); // Create the radio button QRadioButton* radio_button = new QRadioButton(plugin->name(), type_page_); QLabel* description = new QLabel(plugin->description(), type_page_); type_page_->layout()->addWidget(radio_button); type_page_->layout()->addWidget(description); type_mapper_->setMapping(radio_button, index); connect(radio_button, SIGNAL(clicked()), type_mapper_, SLOT(map())); if (index == 0) { radio_button->setChecked(true); TypeChanged(0); } }
void SampleCfg::QueryResponse (QObject *p, const QString &, int State, QObject*caller) // notify transaction completerequestrt needs the name record addedivityoints listamples text);;dtod text,enddate text); { if(p != this) return; IT_IT("SampleCfg::QueryResponse"); switch (State) { case tList: { // fill the name list box List->clear(); int n = GetConfigureDb()->GetNumberResults(); for(int i = 0; i < n; i++,GetConfigureDb()->FetchNext()) { (void) new QListViewItem(List,GetConfigureDb ()->GetString("NAME"),UndoEscapeSQLText(GetConfigureDb()->GetString("COMMENT"))); }; List->setCurrentItem (List->firstChild()); List->setFocus(); SelChanged(0); // force the top item to fetch // }; break; // we have chained a transaction case tUnitList: { GetConfigureDb ()->FillComboBox (Unit, "NAME"); Unit->insertItem (tr(NONE_STR)); SetComboItem(Unit,tr(NONE_STR)); ButtonState (true); }; break; case tItem: { // // fill the fields // Comment->setText (UndoEscapeSQLText(GetConfigureDb()->GetString ("COMMENT"))); Units->setEditText (GetConfigureDb ()->GetString ("UNITS")); Enabled->setChecked (GetConfigureDb ()->GetBool ("ENABLED")); Fileable->setChecked (GetConfigureDb ()->GetBool ("FILEABLE")); LogMode->setChecked (GetConfigureDb ()->GetBool("LOGMODE")); Retrigger->setChecked (GetConfigureDb ()->GetBool("RETRIGGER")); AlarmThreshold->setValue(GetConfigureDb ()->GetInt("ALARMTHRESHOLD")); //Comment->setFocus (); List->setFocus(); ButtonState (true); // // save the input index and type until we have sorted out the Unit -> Unit Class -> type list -> input indices // tmp_ip_index = GetConfigureDb ()->GetString ("IPINDEX"); tmp_type = GetConfigureDb ()->GetString ("QTYPE"); // // IT_COMMENT2("Handling tItem new type , index %s %s", (const char *) tmp_ip_index, (const char *)tmp_type); // Now query the driver DLL for what the input type options are and what input indices are available if(Unit->currentText() != GetConfigureDb ()->GetString ("UNIT")) { // this is an expensive operation - so avoid where possible SetComboItem (Unit, GetConfigureDb ()->GetString ("UNIT")); UnitChanged (0); } else { // unit type has not changed // has the input type changed SetComboItem(Type,tmp_type); // set to the target type TypeChanged(0); // get the list of permitted input indices // }; }; break; case tUnitType: { unit_type = tr(NONE_STR); if(GetConfigureDb ()->GetNumberResults() > 0) { unit_type = GetConfigureDb()->GetString("UNITTYPE"); // store it pCfgDriver = FindDriver(unit_type); // get the driver interface object // // set the permitted types // Type->clear(); // if(pCfgDriver) { // what types ar epermitted pCfgDriver->SetTypeList(Type, Unit->currentText()); } else { // there is no driver - set all to none Type->insertItem(tr(NONE_STR)); tmp_ip_index = tr(NONE_STR); tmp_type = tr(NONE_STR); InputIndex->clear(); InputIndex->insertItem(tr(NONE_STR)); }; // SetComboItem(Type,tmp_type); // set to the target type TypeChanged(0); // handle the change of type - this set the permitted indices // }; }; break; case tConfigLoad: { #ifdef DEPRECATED_IEC104_CONFIG if(Name->text() == GetConfigureDb()->GetString("IKEY")) // may be several queued up #else if(Name->text() == GetConfigureDb()->GetString("NAME")) // may be several queued up #endif { emit LoadConfig (Name->text()); // ask it to load - we pass in the obejct name // it a given that the current configuration record is the property record // pass even if nothing as the dialog shoudl provide defaults when no data is found }; }; break; case tTagList: { // got the current tag list - look up what it should be int n = GetConfigureDb()->GetNumberResults(); QStringList list; if(pCfgDriver) { pCfgDriver->GetTagList(Type->currentText(),list,Unit->currentText(),Name->text()); QStringList currentList; // current list of tags // if(n) { for(int j = 0; j < n; j++,GetConfigureDb()->FetchNext()) { currentList << GetConfigureDb()->GetString("TAG"); }; pCfgDriver->CheckTags(Name->text(), currentList, list); } else { //we are creating a new sample point pCfgDriver->CreateSamplePoint(Name->text(), list, " "); } }; ButtonState (true); }; break; case tIpIndex: { // // Edit the list - remove those in use int n = GetConfigureDb ()->GetNumberResults(); InputIndex->clear(); if(n > 0) { for(int i= 0; i < n; i++,GetConfigureDb()->FetchNext()) { int id = CurrentTypeList.findIndex(GetConfigureDb()->GetString("IPINDEX")); if(id != -1) { CurrentTypeList.remove(CurrentTypeList.at(id)); // delete it }; }; }; // for(unsigned i = 0; i < CurrentTypeList.count(); i++) { InputIndex->insertItem(CurrentTypeList[i]); }; // InputIndex->insertItem(tmp_ip_index); SetComboItem(InputIndex,tmp_ip_index); // }; break; case tNew: ButtonState (true); default: break; }; //cerr << "Exit QueryResponse " << endl; };