void LanguagePage::onKeyPress(Qt::Key k) { if (k == Qt::Key_Enter) { onRestart(); } else if (k == Qt::Key_Escape && !_langChenged) { emit ok(); } }
void GeneralWidget::refreshControls() { style::margins marginSub(0, 0, 0, st::settingsSubSkip); style::margins marginLarge(0, 0, 0, st::settingsLargeSkip); style::margins marginSmall(0, 0, 0, st::settingsSmallSkip); style::margins slidedPadding(0, marginSmall.bottom() / 2, 0, marginSmall.bottom() - (marginSmall.bottom() / 2)); #ifndef TDESKTOP_DISABLE_AUTOUPDATE addChildRow(_updateAutomatically, marginSub, lang(lng_settings_update_automatically), SLOT(onUpdateAutomatically()), cAutoUpdate()); style::margins marginLink(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip); addChildRow(_updateRow, marginLink, slidedPadding); connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart())); if (!cAutoUpdate()) { _updateRow->hideFast(); } #endif // !TDESKTOP_DISABLE_AUTOUPDATE if (cPlatform() == dbipWindows || cSupportTray()) { addChildRow(_enableTrayIcon, marginSmall, lang(lng_settings_workmode_tray), SLOT(onEnableTrayIcon()), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray)); if (cPlatform() == dbipWindows) { addChildRow(_enableTaskbarIcon, marginLarge, lang(lng_settings_workmode_window), SLOT(onEnableTaskbarIcon()), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray)); #ifndef OS_WIN_STORE addChildRow(_autoStart, marginSmall, lang(lng_settings_auto_start), SLOT(onAutoStart()), cAutoStart()); addChildRow(_startMinimized, marginLarge, slidedPadding, lang(lng_settings_start_min), SLOT(onStartMinimized()), (cStartMinimized() && !Global::LocalPasscode())); subscribe(Global::RefLocalPasscodeChanged(), [this] { _startMinimized->entity()->setChecked(cStartMinimized() && !Global::LocalPasscode()); }); if (!cAutoStart()) { _startMinimized->hideFast(); } addChildRow(_addInSendTo, marginSmall, lang(lng_settings_add_sendto), SLOT(onAddInSendTo()), cSendToMenu()); #endif // OS_WIN_STORE } } }
void GeneralWidget::notifyFileQueryUpdated(const FileDialog::QueryUpdate &update) { if (_chooseLangFileQueryId != update.queryId) { return; } _chooseLangFileQueryId = 0; if (update.filePaths.isEmpty()) { return; } _testLanguage = QFileInfo(update.filePaths.front()).absoluteFilePath(); LangLoaderPlain loader(_testLanguage, langLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok)); if (loader.errors().isEmpty()) { LangLoaderResult result = loader.found(); auto text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)), save = result.value(lng_box_ok, langOriginal(lng_box_ok)), cancel = result.value(lng_cancel, langOriginal(lng_cancel)); Ui::show(Box<ConfirmBox>(text, save, cancel, base::lambda_guarded(this, [this] { cSetLangFile(_testLanguage); cSetLang(languageTest); Local::writeSettings(); onRestart(); }))); } else { Ui::show(Box<InformBox>("Custom lang failed :(\n\nError: " + loader.errors())); } }
void TimingSwitchDialog::setupSignal() { connect(ui->setClient,SIGNAL(clicked()),this,SLOT(onSetClient())); connect(ui->shutdown,SIGNAL(clicked()),this,SLOT(onShutdown())); connect(ui->restart,SIGNAL(clicked()),this,SLOT(onRestart())); connect(ui->timingOk,SIGNAL(clicked()),this,SLOT(onTimingShutdown())); connect(ui->timingCancel,SIGNAL(clicked()),this,SLOT(onCancelTiming())); }
LifeControlsWidget::LifeControlsWidget(SimOptions *opts, SimController *ctrlr, LifeScrollWidget &scroll) : displayWidget(scroll) { options = opts; controller = ctrlr; delay = 100; play = false; QLabel *gridLabel = new QLabel("Grid Size:"); QLabel *delayLabel = new QLabel("Delay:"); genLabel = new QLabel("Generation:\t 1"); refreshGenLabel(); QSpinBox *gridSizeSpin = new QSpinBox(); gridSizeSpin->setMinimum(1); gridSizeSpin->setMaximum(1000); gridSizeSpin->setValue(opts->getBlockSize()); QSpinBox *delaySpin = new QSpinBox(); delaySpin->setMinimum(10); delaySpin->setMaximum(10000); delaySpin->setValue(delay); QPushButton *quitBtn = new QPushButton("Quit"); QPushButton *restartBtn = new QPushButton("Restart"); playBtn = new QPushButton("Play"); QPushButton *stepBtn = new QPushButton("Step"); QBoxLayout *box = new QBoxLayout(QBoxLayout::TopToBottom, this); box->addWidget(gridLabel); box->addWidget(gridSizeSpin); box->addWidget(delayLabel); box->addWidget(delaySpin); box->addWidget(genLabel); box->addWidget(quitBtn); box->addWidget(restartBtn); box->addWidget(playBtn); box->addWidget(stepBtn); box->addStretch(1); box->addSpacing(12); setLayout(box); connect(quitBtn, SIGNAL(clicked()), this, SLOT(onQuit())); connect(restartBtn, SIGNAL(clicked()), this, SLOT(onRestart())); connect(playBtn, SIGNAL(clicked()), this, SLOT(onPlay())); connect(stepBtn, SIGNAL(clicked()), this, SLOT(onStep())); connect(gridSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(onSizeChange(int))); connect(delaySpin, SIGNAL(valueChanged(int)), this, SLOT(onDelayChange(int))); }
LanguagePage::LanguagePage(QWidget *parent) : Dialog(parent), _fa(Tr("Persian")), _en(Tr("English")), _restart(Tr("Ok")), _langChenged(false) { _main.setContentsMargins(24, 24, 24, 8); setLayout(&_main); _main.addWidget(&_fa); _main.addWidget(&_en); _main.addWidget(&_restart); _group.addButton(&_fa, 0); _group.addButton(&_en, 1); checkLanguage(); QObject::connect(&_group, SIGNAL(buttonClicked(int)), this, SLOT(onLangchange(int))); QObject::connect(&_restart, SIGNAL(clicked()), this, SLOT(onRestart())); QObject::connect(this, SIGNAL(keyPressd(Qt::Key)), this, SLOT(onKeyPress(Qt::Key))); }
NetworkClientWidget::NetworkClientWidget(RawTcpListener *nlistener, QWidget *parent) : QWidget(parent), ui(new Ui::NetworkClientWidget) { listener = nlistener; ui->setupUi(this); ui->startStopPushButton->setIcon(QIcon(":/Images/icons/media-playback-start.png")); ui->startStopPushButton->setText(START_STRING); connect(ui->startStopPushButton, SIGNAL(clicked()), SLOT(onStartStop())); connect(ui->restartPushButton, SIGNAL(clicked()), SLOT(onRestart())); if (listener != NULL) { connect(this, SIGNAL(start()), listener, SLOT(startListening())); connect(this, SIGNAL(stop()), listener, SLOT(stopListening())); connect(this, SIGNAL(restart()), listener, SLOT(restart())); connect(listener, SIGNAL(connectionclosed()), this, SLOT(reset())); } }
void SystemMenu::rebuildMenu(bool dockHiding) { if (menu()) { menu()->clear(); } QMenu *menu = new QMenu(this); about = new QAction("About this computer", this); menu->addAction(about); connect(about, SIGNAL(triggered()), this, SLOT(onAbout())); /* TODO: Removed for now until I found clear way for managing software on different distros QAction *software = new QAction("Software management ...", this); menu->addAction(software); */ menu->addSeparator(); QAction *pref = new QAction("System preferences ...", this); menu->addAction(pref); connect(pref, SIGNAL(triggered()), this, SLOT(onPreferences())); menu->addSeparator(); if (dockHiding) { adock_on = new QAction("Turn Hiding Off", this); } else { int s = app->dock->dockState; if (s == Dockbar::Normal || s == Dockbar::Showing || s == Dockbar::AboutToShow) { adock_on = new QAction("Turn Hiding On", this); } else if (s == Dockbar::Hidden || s == Dockbar::Hiding) { adock_on = new QAction("Turn Hiding Off", this); } } //QAction *adock_magn = new QAction("Turn Magnification On", this); adock_pref = new QAction("Dock Preferences ...", this); QMenu *dock_menu = menu->addMenu("Dock"); dock_menu->addAction(adock_on); connect(adock_on, SIGNAL(triggered()), this, SLOT(onShowHideDock())); connect(adock_pref, SIGNAL(triggered()), this, SLOT(onDockPref())); //dock_menu->addAction(adock_magn); dock_menu->addSeparator(); dock_menu->addAction(adock_pref); menu->addSeparator(); /* TODO: Removed for now until I implement the features QAction *force_quit = new QAction("Force Quit ...", this); menu->addAction(force_quit); menu->addSeparator(); */ sleep = new QAction("Sleep", this); menu->addAction(sleep); connect(sleep, SIGNAL(triggered()), this, SLOT(onSleep())); restart = new QAction("Restart ...", this); menu->addAction(restart); connect(restart, SIGNAL(triggered()), this, SLOT(onRestart())); shutdown = new QAction("Shutdown ...", this); menu->addAction(shutdown); connect(shutdown, SIGNAL(triggered()), this, SLOT(onShutdown())); menu->addSeparator(); logout = new QAction("Logout ...", this); menu->addAction(logout); connect(logout, SIGNAL(triggered()), this, SLOT(onLogout())); setMenu(menu); connect(this, SIGNAL(clicked()), this, SLOT(showMenu())); }
/*! * Создаёт кнопки */ void DaemonUi::createButtons() { m_hideButton = new QPushButton(QIcon(":/images/dialog-ok.png"), "", this); connect(m_hideButton, SIGNAL(clicked(bool)), SLOT(hide())); m_quitButton = new QPushButton(QIcon(LS(":/images/quit.png")), "", this); connect(m_quitButton, SIGNAL(clicked(bool)), this, SLOT(onQuit())); m_actions[StartAction].append(m_toolBar->addAction(QIcon(":/images/start-big.png"), tr("Start"), this, SLOT(onStart()))); m_actions[StopAction].append(m_toolBar->addAction(QIcon(":/images/stop-big.png"), tr("Stop"), this, SLOT(onStop()))); m_actions[RestartAction].append(m_toolBar->addAction(QIcon(":/images/restart-big.png"), tr("Restart"), this, SLOT(onRestart()))); m_toolBar->addSeparator(); m_actions[SettingsAction].append(m_toolBar->addAction(QIcon(":/images/gear-big.png"), tr("Settings..."), this, SLOT(onSettings()))); }
/*! * Создаёт объекты QAction */ void DaemonUi::createActions() { m_actions[StartAction].append(m_menu->addAction(QIcon(":/images/start.png"), tr("Start"), this, SLOT(onStart()))); m_actions[StopAction].append(m_menu->addAction(QIcon(":/images/stop.png"), tr("Stop"), this, SLOT(onStop()))); m_actions[RestartAction].append(m_menu->addAction(QIcon(":/images/restart.png"), tr("Restart"), this, SLOT(onRestart()))); m_actions[SettingsAction].append(m_menu->addAction(QIcon(":/images/gear.png"), tr("Settings..."), this, SLOT(onSettings()))); m_menu->addSeparator(); m_menu->addAction(QIcon(LS(":/images/quit.png")), tr("Quit"), this, SLOT(onQuit())); }