void PrimaNotaWindow::showEvent(QShowEvent *event) { qDebug() << "PrimaNotaWindow::showEvent()"; loadSplittersState(); loadWindowGeometry(); loadTableViewSettings(); updateViewNote(); event->accept(); }
GaduUnregisterAccountWindow::GaduUnregisterAccountWindow(Account account, QWidget *parent) : QWidget(parent, Qt::Window), MyAccount(account) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Unregister account")); createGui(); dataChanged(); loadWindowGeometry(this, "General", "GaduUnregisterAccountGeometry", 0, 50, 500, 350); }
/** * @ingroup account_management * @{ */ RemindPassword::RemindPassword(QDialog *parent) : QWidget(parent, Qt::Window), emailedit(0) { kdebugf(); setWindowTitle(tr("Remind password")); setAttribute(Qt::WA_DeleteOnClose); // create main QLabel widgets (icon and app info) QWidget *left = new QWidget(); QLabel *l_icon = new QLabel; l_icon->setPixmap(IconsManager::instance()->loadPixmap("RemindPasswordWindowIcon")); QWidget *blank = new QWidget; blank->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding)); QVBoxLayout *left_layout = new QVBoxLayout(left); left_layout->addWidget(l_icon); left_layout->addWidget(blank); QWidget *center = new QWidget; QLabel *l_info = new QLabel(); l_info->setText(tr("This dialog box allows you to ask server to remind your current password.")); l_info->setWordWrap(true); l_info->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); // end create main QLabel widgets (icon and app info) //our QVGroupBox QGroupBox *vgb_email = new QGroupBox(tr("Email")); QVBoxLayout *email_layout = new QVBoxLayout(vgb_email); //end our QGroupBox // create needed fields emailedit = new QLineEdit(); email_layout->addWidget(new QLabel(tr("Email (as during registration):"))); email_layout->addWidget(emailedit); // end create needed fields // buttons QWidget *bottom = new QWidget; QWidget *blank2 = new QWidget; blank2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum)); QPushButton *pb_ok = new QPushButton(IconsManager::instance()->loadIcon("RemindPasswordButton"), tr("OK"), bottom, "ok"); connect(pb_ok, SIGNAL(clicked()), this, SLOT(start())); QPushButton *pb_close = new QPushButton(IconsManager::instance()->loadIcon("CloseWindow"), tr("&Close"), bottom, "close"); connect(pb_close, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *bottom_layout = new QHBoxLayout(bottom); bottom_layout->addWidget(blank2); bottom_layout->addWidget(pb_ok); bottom_layout->addWidget(pb_close); // end buttons QVBoxLayout *center_layout = new QVBoxLayout(center); center_layout->addWidget(l_info); center_layout->addWidget(vgb_email); center_layout->addWidget(bottom); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(left); layout->addWidget(center); loadWindowGeometry(this, "General", "RemindPasswordDialogGeometry", 0, 50, 355, 200); GaduProtocol *gadu = dynamic_cast<GaduProtocol *>(AccountManager::instance()->defaultAccount()->protocol()); connect(gadu, SIGNAL(reminded(bool)), this, SLOT(reminded(bool))); kdebugf2(); }
/** @ingroup account_management * @{ */ ChangePassword::ChangePassword(QDialog *parent) : QWidget(parent, Qt::Window), emailedit(0), newpwd(0), newpwd2(0) { kdebugf(); setWindowTitle(tr("Change password / email")); setAttribute(Qt::WA_DeleteOnClose); // create main QLabel widgets (icon and app info) QWidget *left = new QWidget(); QLabel *l_icon = new QLabel; l_icon->setPixmap(IconsManager::instance()->loadPixmap("ChangePasswordWindowIcon")); QWidget *blank = new QWidget; blank->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding)); QVBoxLayout *left_layout = new QVBoxLayout(left); left_layout->addWidget(l_icon); left_layout->addWidget(blank); QWidget *center = new QWidget; QLabel *l_info = new QLabel(); l_info->setText(tr("This dialog box allows you to change your current password or e-mail.")); l_info->setWordWrap(true); l_info->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); // end create main QLabel widgets (icon and app info) //our QGroupBox QGroupBox *vgb_email = new QGroupBox(tr("Email")); QVBoxLayout *email_layout = new QVBoxLayout(vgb_email); // TODO: 0.6.6 QGroupBox *vgb_password = new QGroupBox(tr("Password")); QVBoxLayout *password_layout = new QVBoxLayout(vgb_password); //end our QGroupBox // create needed fields emailedit = new QLineEdit(); email_layout->addWidget(new QLabel(tr("New email:"))); email_layout->addWidget(emailedit); newpwd = new QLineEdit(); newpwd->setEchoMode(QLineEdit::Password); password_layout->addWidget(new QLabel(tr("New password:"******"Retype new password:"******"ChangePasswordEmailButton"), tr("OK"), bottom); connect(pb_ok, SIGNAL(clicked()), this, SLOT(start())); QPushButton *pb_close = new QPushButton(IconsManager::instance()->loadIcon("CloseWindow"), tr("&Close"), bottom); connect(pb_close, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *bottom_layout = new QHBoxLayout(bottom); bottom_layout->addWidget(blank2); bottom_layout->addWidget(pb_ok); bottom_layout->addWidget(pb_close); // end buttons QVBoxLayout *center_layout = new QVBoxLayout(center); center_layout->addWidget(l_info); center_layout->addWidget(vgb_email); center_layout->addWidget(vgb_password); center_layout->setStretchFactor(vgb_password, 1); center_layout->addWidget(bottom); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(left); layout->addWidget(center); loadWindowGeometry(this, "General", "ChangePasswordDialogGeometry", 0, 50, 355, 350); connect(AccountManager::instance()->defaultAccount()->protocol(), SIGNAL(passwordChanged(bool)), this, SLOT(passwordChanged(bool))); kdebugf2(); }
SyntaxEditorWindow::SyntaxEditorWindow(SyntaxList *syntaxList, const QString &syntaxName, const QString &category, const QString &syntaxHint, QWidget* parent) : QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName) { setWindowTitle(tr("Kadu syntax editor")); setAttribute(Qt::WA_DeleteOnClose); QFrame *syntax = new QFrame(); QGridLayout *syntax_layout = new QGridLayout(syntax); syntax_layout->setColumnStretch(0, 2); syntax_layout->setColumnStretch(1, 1); syntax_layout->setSpacing(5); editor = new QTextEdit(syntax); editor->setAcceptRichText(true); editor->setPlainText(syntaxList->readSyntax(syntaxName)); if (!syntaxHint.isEmpty()) editor->setToolTip(syntaxHint); syntax_layout->addWidget(editor, 0, 0, 2, 1); previewPanel = new Preview(syntax); previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor")); syntax_layout->addWidget(previewPanel, 0, 1); QPushButton *preview = new QPushButton(tr("Preview"), syntax); connect(preview, SIGNAL(clicked()), this, SLOT(refreshPreview())); syntax_layout->addWidget(preview, 1, 1); QWidget *buttons = new QWidget(); QHBoxLayout *buttons_layout = new QHBoxLayout; buttons->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); buttons_layout->setSpacing(5); #ifndef Q_OS_MAC (new QWidget(buttons))->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); #endif QPushButton *saveSyntax = new QPushButton(IconsManager::instance()->loadIcon("OkWindowButton"), tr("Save"), 0); QPushButton *saveAsSyntax = new QPushButton(IconsManager::instance()->loadIcon("OkWindowButton"), tr("Save as..."), 0); QPushButton *cancel = new QPushButton(IconsManager::instance()->loadIcon("CloseWindowButton"), tr("Cancel"), 0); buttons_layout->addWidget(saveSyntax); buttons_layout->addWidget(saveAsSyntax); buttons_layout->addWidget(cancel); buttons->setLayout(buttons_layout); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(syntax); layout->addWidget(buttons); if (syntaxList->isGlobal(syntaxName)) saveSyntax->setDisabled(true); else connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save())); connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs())); connect(cancel, SIGNAL(clicked()), this, SLOT(close())); loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480); }
SyntaxEditorWindow::SyntaxEditorWindow(const QSharedPointer<SyntaxList> &syntaxList, const QString &syntaxName, const QString &category, const QString &syntaxHint, QWidget *parent) : QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName) { setWindowRole("kadu-syntax-editor"); setWindowTitle(tr("Kadu syntax editor")); setAttribute(Qt::WA_DeleteOnClose); QVBoxLayout *layout = new QVBoxLayout(this); QSplitter *splitter = new QSplitter(this); layout->addWidget(splitter); splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); splitter->setChildrenCollapsible(false); QWidget *splitterleft = new QWidget(splitter); QVBoxLayout *splitterleftlayout = new QVBoxLayout(splitterleft); splitterleftlayout->setMargin(0); splitterleftlayout->setSpacing(5); editor = new QTextEdit(this); splitterleftlayout->addWidget(editor); editor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); editor->setAcceptRichText(true); editor->setPlainText(syntaxList->readSyntax(syntaxName)); QFont font = this->font(); font.setFamily("monospace"); if(font.pixelSize() == -1) font.setPointSizeF(font.pointSizeF() - 0.5); else font.setPixelSize(font.pixelSize() - 2); editor->setFont(font); editor->setMinimumSize(EDITOR_MINIMUM_SIZE); if (!syntaxHint.isEmpty()) { QLabel *editorhint = new QLabel(this); splitterleftlayout->addWidget(editorhint); editorhint->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); editorhint->setWordWrap(true); editorhint->setText(syntaxHint); } QWidget *splitterright = new QWidget(splitter); QVBoxLayout *splitterrightlayout = new QVBoxLayout(splitterright); splitterrightlayout->setMargin(0); splitterrightlayout->setSpacing(5); previewPanel = new Preview(this); splitterrightlayout->addWidget(previewPanel); previewPanel->setMinimumHeight(0); previewPanel->setMaximumHeight(QWIDGETSIZE_MAX); previewPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor")); previewPanel->setMinimumSize(PREVIEW_MINIMUM_SIZE); QPushButton *previewbutton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_BrowserReload), tr("Refresh Preview"), this); splitterrightlayout->addWidget(previewbutton); connect(previewbutton, SIGNAL(clicked()), this, SLOT(refreshPreview())); QDialogButtonBox *buttonslayout = new QDialogButtonBox(Qt::Horizontal, this); layout->addWidget(buttonslayout); QPushButton *saveSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("Save"), this); QPushButton *saveAsSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Save as..."), this); QPushButton *cancel = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this); buttonslayout->addButton(saveSyntax, QDialogButtonBox::YesRole); buttonslayout->addButton(saveAsSyntax, QDialogButtonBox::ActionRole); buttonslayout->addButton(cancel, QDialogButtonBox::RejectRole); splitter->setSizes( QList<int>() << splitter->sizeHint().width() << 1 ); if (syntaxList->isGlobal(syntaxName)) saveSyntax->setDisabled(true); else connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save())); connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs())); connect(cancel, SIGNAL(clicked()), this, SLOT(close())); loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480); }
FMCConsole::FMCConsole(QWidget* parent, Qt::WFlags fl, const QString& style) : #if !VASFMC_GAUGE QMainWindow(parent, fl), #endif //m_is_minimized(true), m_main_config(0), m_fmc_control(0), m_splash(0), m_info_dlg(0), m_gps_handler(0), m_fcu_handler(0), m_cdu_left_handler(0), m_cdu_right_handler(0), m_navdisplay_left_handler(0), m_pfd_left_handler(0), m_navdisplay_right_handler(0), m_pfd_right_handler(0), m_logline_count(0), m_quit_action(0), m_fsaccess_msfs_action(0), m_fsaccess_xplane_action(0), m_fsaccess_fgfs_action(0), m_style_a_action(0), m_style_b_action(0), m_style_g_action(0) { Logger::log(QString("FMCConsole: current_dir=%1").arg(QDir::currentPath())); #if !VASFMC_GAUGE setupUi(this); #else Q_UNUSED(parent); Q_UNUSED(fl); #endif // setup main config Logger::log("Setup main config"); m_main_config = new Config(CFG_MAIN_FILENAME); MYASSERT(m_main_config != 0); setupDefaultConfig(); QDir vasfmc_dir(m_main_config->getValue(CFG_VASFMC_DIR)); MYASSERT(vasfmc_dir.exists()); vasfmc_dir.mkdir("cfg"); vasfmc_dir.mkdir(m_main_config->getValue(CFG_FLIGHTPLAN_SUBDIR)); vasfmc_dir.mkdir(m_main_config->getValue(CFG_AIRCRAFT_DATA_SUBDIR)); vasfmc_dir.mkdir(m_main_config->getValue(CFG_CHECKLIST_SUBDIR)); m_main_config->loadfromFile(); loadWindowGeometry(); if (!m_main_config->contains(CFG_STARTUP_COUNTER)) m_main_config->setValue(CFG_STARTUP_COUNTER, 1); else m_main_config->setValue(CFG_STARTUP_COUNTER, m_main_config->getIntValue(CFG_STARTUP_COUNTER)+1); m_main_config->saveToFile(); Logger::log("Setup main config: fin"); if (!style.isEmpty()) { if (style == "G") slotStyleG(); if (style == "B") slotStyleB(); else slotStyleA(); } // setup console setWindowTitle(QString("vasFMC ")+VERSION+" - (c) "+COPYRIGHT); setStatusBar(0); show(); MYASSERT(connect(Logger::getLogger(), SIGNAL(signalLogging(const QString&)), this, SLOT(slotLogging(const QString&)))); if (m_main_config->getIntValue(CFG_CONSOLE_WINDOW_STATUS) == 0) showMinimized(); MYASSERT(connect(pfd_left_btn, SIGNAL(clicked()), this, SLOT(slotPFDLeftButton()))); MYASSERT(connect(nd_left_btn, SIGNAL(clicked()), this, SLOT(slotNDLeftButton()))); MYASSERT(connect(cdu_left_btn, SIGNAL(clicked()), this, SLOT(slotCDULeftButton()))); MYASSERT(connect(cdu_right_btn, SIGNAL(clicked()), this, SLOT(slotCDURightButton()))); MYASSERT(connect(upper_ecam_btn, SIGNAL(clicked()), this, SLOT(slotUpperECAMButton()))); MYASSERT(connect(fcu_btn, SIGNAL(clicked()), this, SLOT(slotFCUButton()))); MYASSERT(connect(gps_btn, SIGNAL(clicked()), this, SLOT(slotGPSButton()))); //TODO gps_btn->setEnabled(false); //TODOMYASSERT(connect(lower_ecam_btn, SIGNAL(clicked()), this, SLOT(slotLowerECAMButton()))); MYASSERT(connect(pfd_right_btn, SIGNAL(clicked()), this, SLOT(slotPFDRightButton()))); MYASSERT(connect(nd_right_btn, SIGNAL(clicked()), this, SLOT(slotNDRightButton()))); // setup config widget config_tab->clear(); if (m_main_config->getIntValue(CFG_ENABLE_CONFIG_ACCESS) == 0) { config_tab->setEnabled(false); config_tab->hide(); overall_tab->removeTab(1); } registerConfigWidget("Main", m_main_config); // setup FMC control m_fmc_control = new FMCControl(this, m_main_config, CFG_CONTROL_FILENAME); MYASSERT(m_fmc_control != 0); MYASSERT(connect(m_fmc_control, SIGNAL(signalSetGLFontSize(uint)), this, SLOT(slotSetGLFontSize(uint)))); MYASSERT(connect(m_fmc_control, SIGNAL(signalStyleA()), this, SLOT(slotStyleA()))); MYASSERT(connect(m_fmc_control, SIGNAL(signalStyleB()), this, SLOT(slotStyleB()))); MYASSERT(connect(m_fmc_control, SIGNAL(signalStyleG()), this, SLOT(slotStyleG()))); MYASSERT(connect(m_fmc_control, SIGNAL(signalFcuLeftOnlyModeChanged()), this, SLOT(slotFcuLeftOnlyModeChanged()))); MYASSERT(connect(m_fmc_control, SIGNAL(signalRestartFMC()), this, SLOT(slotTriggerRestartFMC()))); MYASSERT(connect(m_fmc_control, SIGNAL(signalRestartCDU()), this, SLOT(slotTriggerRestartCDU()))); // setup FMC sounds m_fmc_sounds_handler = new FMCSoundsHandler(m_main_config, m_fmc_control); MYASSERT(m_fmc_sounds_handler != 0); // setup left FMC CDU m_cdu_left_handler = new FMCCDUHandler(this, m_main_config, CFG_CDU_LEFT_FILENAME, m_fmc_control, true); MYASSERT(m_cdu_left_handler != 0); // setup right FMC CDU m_cdu_right_handler = new FMCCDUHandler(this, m_main_config, CFG_CDU_RIGHT_FILENAME, m_fmc_control, false); MYASSERT(m_cdu_right_handler != 0); // create menus createMenus(); // connect profiling stuff #if DO_PROFILING MYASSERT(connect(m_pfd_left_handler->fmcPFD(), SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); MYASSERT(connect(m_navdisplay_left_handler->fmcNavdisplay(), SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); MYASSERT(connect(m_upper_ecam_handler->fmcECAM(), SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); MYASSERT(connect(m_cdu_left_handler->fmcCduBase(), SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); MYASSERT(connect(m_fcu_handler->fmcFcuBase(), SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); MYASSERT(connect(m_fmc_control->fmcProcessor(), SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); MYASSERT(connect(m_fmc_control, SIGNAL(signalTimeUsed(const QString&, uint)), this, SLOT(slotTimeUsed(const QString&, uint)))); #endif }
ModulesDialog::ModulesDialog(QWidget *parent) : QWidget(parent, Qt::Window), lv_modules(0), l_moduleinfo(0) { kdebugf(); setWindowTitle(tr("Manage Modules")); setAttribute(Qt::WA_DeleteOnClose); // create main QLabel widgets (icon and app info) QWidget *left = new QWidget(this); QVBoxLayout *leftLayout = new QVBoxLayout(left); leftLayout->setMargin(10); leftLayout->setSpacing(10); QLabel *l_icon = new QLabel(left); leftLayout->addWidget(l_icon); leftLayout->addStretch(); QWidget *center = new QWidget(this); QVBoxLayout *centerLayout = new QVBoxLayout(center); centerLayout->setMargin(10); centerLayout->setSpacing(10); QLabel *l_info = new QLabel(center); l_icon->setPixmap(IconsManager::instance()->loadPixmap("ManageModulesWindowIcon")); l_info->setText(tr("This dialog box allows you to manage installed modules. Modules are responsible " "for numerous vital features like playing sounds or message encryption.\n" "You can load (or unload) them by double-clicking on their names.")); l_info->setWordWrap(true); #ifndef Q_OS_MAC l_info->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); #endif // end create main QLabel widgets (icon and app info) // our QListView lv_modules = new QTreeWidget(center); QStringList headers; headers << tr("Module name") << tr("Version") << tr("Module type") << tr("State"); lv_modules->setHeaderLabels(headers); lv_modules->setSortingEnabled(true); lv_modules->setAllColumnsShowFocus(true); lv_modules->setIndentation(false); lv_modules->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); // end our QListView //our QVGroupBox QGroupBox *vgb_info = new QGroupBox(center); QVBoxLayout *infoLayout = new QVBoxLayout(vgb_info); vgb_info->setTitle(tr("Info")); //end our QGroupBox l_moduleinfo = new QLabel(vgb_info); l_moduleinfo->setText(tr("<b>Module:</b><br/><b>Depends on:</b><br/><b>Conflicts with:</b><br/><b>Provides:</b><br/><b>Author:</b><br/><b>Version:</b><br/><b>Description:</b>")); #ifndef Q_OS_MAC l_moduleinfo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); #endif l_moduleinfo->setWordWrap(true); infoLayout->addWidget(l_moduleinfo); // buttons QWidget *bottom = new QWidget(center); QHBoxLayout *bottomLayout = new QHBoxLayout(bottom); bottomLayout->setSpacing(5); hideBaseModules = new QCheckBox(tr("Hide base modules"), bottom); hideBaseModules->setChecked(config_file.readBoolEntry("General", "HideBaseModules")); connect(hideBaseModules, SIGNAL(clicked()), this, SLOT(refreshList())); QPushButton *pb_close = new QPushButton(IconsManager::instance()->loadIcon("CloseWindow"), tr("&Close"), bottom); bottomLayout->addWidget(hideBaseModules); bottomLayout->addStretch(); bottomLayout->addWidget(pb_close); #ifdef Q_OS_MAC bottom->setMaximumHeight(pb_close->height() + 5); #endif // end buttons centerLayout->addWidget(l_info); centerLayout->addWidget(lv_modules); centerLayout->addWidget(vgb_info); centerLayout->addWidget(bottom); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(left); layout->addWidget(center); connect(pb_close, SIGNAL(clicked()), this, SLOT(close())); connect(lv_modules, SIGNAL(itemSelectionChanged()), this, SLOT(itemsChanging())); connect(lv_modules, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(moduleAction(QTreeWidgetItem *))); loadWindowGeometry(this, "General", "ModulesDialogGeometry", 0, 50, 600, 620); refreshList(); lv_modules->sortByColumn(0, Qt::AscendingOrder); kdebugf2(); }