void MyFrame::OnDerivedDialogToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) { // Make an instance of our derived dialog, passing it "this" window // (the main frame) as the parent of the dialog. This allows the dialog // to be destructed automatically when the parent is destroyed. PreferencesDialog preferencesDialog(this); // Show the instance of the dialog, modally. preferencesDialog.ShowModal(); }
/** * @param displayedDictionaries Number of dictionaries to display * */ void ActionZone::initGui(int displayedDictionaries) { inputControlsLayout_ = new QHBoxLayout(); resultsLayout_ = new QHBoxLayout(); topLayout_ = new QVBoxLayout(this); topLayout_->addLayout(inputControlsLayout_, 0); topLayout_->addLayout(resultsLayout_, 2); searchedTerm_ = new QLineEdit(this); connect(searchedTerm_, SIGNAL(returnPressed()), this, SLOT(sendTranslation())); inputControlsLayout_->addWidget(searchedTerm_); searchTermFocusOnEscapeAction_ = new QAction(searchedTerm_); searchTermFocusOnEscapeAction_->setShortcut(Qt::Key_Escape); searchedTerm_->addAction(searchTermFocusOnEscapeAction_); connect(searchTermFocusOnEscapeAction_, SIGNAL(triggered()), searchedTerm_, SLOT(setFocus())); connect(searchTermFocusOnEscapeAction_, SIGNAL(triggered()), searchedTerm_, SLOT(selectAll())); searchButton_ = new QPushButton("Translate!", this); connect(searchButton_, SIGNAL(clicked()), this, SLOT(sendTranslation())); inputControlsLayout_->addWidget(searchButton_); preferencesButton_ = new QToolButton(this); preferencesButton_->setIcon(QIcon(QPixmap(preferencesIcon))); connect(preferencesButton_, SIGNAL(clicked()), this, SLOT(preferencesDialog())); inputControlsLayout_->addWidget(preferencesButton_); for (int i=0; i<displayedDictionaries; i++) { TranslationResultsViewer * viewer = new TranslationResultsViewer(this); resultViewers_.append(viewer); } TranslationResultsViewerList::iterator e = resultViewers_.end(); for (TranslationResultsViewerList::iterator i = resultViewers_.begin(); i != e; ++i) { connect(this, SIGNAL(newTranslation(const QString &)), *i, SLOT(translate(const QString &))); resultsLayout_->addWidget(*i, 1); } }
void CMainWindow::OnPreferences() { CPreferencesDialog preferencesDialog( this ); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// CPreferencePageContainer* communicationsPageContainer( preferencesDialog.AddPage( "Communications" ) ); communicationsPageContainer->AddPage( new CPreferencePageAdapter() ); communicationsPageContainer->AddPage( new CPreferencePageProto() ); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// CPreferencePageContainer* ecuPageContainer( preferencesDialog.AddPage( "ECU" ) ); CPreferencePageContainer* diagnosticPageContainer( ecuPageContainer->AddPage( "Diagnostic" ) ); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// diagnosticPageContainer->AddPage( new CPreferencePageSession() ); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// ecuPageContainer->AddPage( new CPreferencePageFlowMeter() ); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// preferencesDialog.AddPage( new CPreferencePageStartUp() ); preferencesDialog.exec(); }