/* //////////////////////////////////////////////////////////////////////////// * Default constructor */ TTMpeg2MainWnd::TTMpeg2MainWnd() :QMainWindow() { setupUi(this); // some default values currentStreamOrder = -1; isProjectOpen = false; sliderUpdateFrame = false; enableControls(false); // Conect signals from main menu connect(actionFileOpen, SIGNAL(triggered()), videoFileInfo, SLOT(onFileOpen())); connect(actionAnalyze, SIGNAL(triggered()), SLOT(onAnalyze())); connect(actionSettings, SIGNAL(triggered()), SLOT(onSettings())); connect(actionExit, SIGNAL(triggered()), SLOT(onExit())); connect(actionWriteHeaderList, SIGNAL(triggered()), SLOT(onWriteHeaderList())); // Connect signals from video file info widget connect(videoFileInfo, SIGNAL(fileOpened(QString)), SLOT(onLoadVideoFile(QString))); // Connect signals from the step control widget connect(stepControl, SIGNAL(gotoNextFrame(int, int)), SLOT(onGotoNextFrame(int, int))); connect(stepControl, SIGNAL(gotoPrevFrame(int, int)), SLOT(onGotoPrevFrame(int, int))); // Scroller connect(scroller, SIGNAL(valueChanged(int)), SLOT(onSliderValueChanged(int))); }
void MainWindow::createMenu() { menuBar()->addAction("Go to Passage", this, SLOT(onSelectVerse())); menuBar()->addAction("Select Translation", this, SLOT(selectTranslation())); menuBar()->addAction("Search", this, SLOT(onSearch())); menuBar()->addAction("Settings", this, SLOT(onSettings())); }
WindowMain::WindowMain(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::WindowMain) { /** Initialize the UI */ m_ui->setupUi(this); /** Set the window title */ setWindowTitle(PACKAGE_STRING); /** Connect the actions */ connect(m_ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout())); connect(m_ui->actionSettings, SIGNAL(triggered()), this, SLOT(onSettings())); connect(m_ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(this, SIGNAL(next()), this, SLOT(onNext())); connect(this, SIGNAL(done()), this, SLOT(onEnd())); /** Initialize the settings */ m_settings = new Settings(this); /** Create and setup the drop area */ m_dropArea = new DropArea(); connect(m_dropArea, SIGNAL(dropped(QList<QUrl>)), this, SLOT(onStart(QList<QUrl>))); setCentralWidget(m_dropArea); /** Initialize the status bar */ m_ui->statusBar->setStyleSheet("QStatusBar::item {border: none;}"); m_ui->statusBar->showMessage(tr("Ready")); /** Create the progress bar */ m_progress = new QProgressBar(); /** Create the allocine engine */ m_allocine = new AllocineEngine(); connect(m_allocine, SIGNAL(found(QList<AllocineResult*>)), this, SLOT(onFound(QList<AllocineResult*>))); connect(m_allocine, SIGNAL(fetched(AllocineResult*)), this, SLOT(onFetched(AllocineResult*))); connect(m_allocine, SIGNAL(error(QString)), this, SLOT(onError(QString))); /** Initialize the processing flag */ m_processing = false; }
//----------------------------------------------- LoginDialog::LoginDialog():QDialog(0,Qt::MSWindowsFixedSizeDialogHint) { name="Вход в систему"; setWindowTitle(name); label_login=new QLabel("Логин:",this); label_password=new QLabel("Пароль:",this); edit_login=new QLineEdit(this); edit_password=new QLineEdit(this); edit_password->setEchoMode(QLineEdit::Password); button_ok=new QPushButton("ОК",this); button_settings=new QPushButton("Настройки",this); button_cancel=new QPushButton("Отмена",this); layout_login=new QHBoxLayout; layout_login->addWidget(label_login); layout_login->addWidget(edit_login); layout_password=new QHBoxLayout; layout_password->addWidget(label_password); layout_password->addWidget(edit_password); layout_button=new QHBoxLayout; layout_button->addWidget(button_ok); layout_button->addWidget(button_cancel); layout_button->addWidget(button_settings); layout_main=new QVBoxLayout; layout_main->addLayout(layout_login); layout_main->addLayout(layout_password); layout_main->addLayout(layout_button); setLayout(layout_main); connect(button_ok,SIGNAL(clicked()),this,SLOT(onOk())); connect(button_cancel,SIGNAL(clicked()),this,SLOT(onCancel())); connect(button_settings,SIGNAL(clicked()),this,SLOT(onSettings())); }
void MainDialog::setupButtons() { QRect rc = QFontMetrics(*Global::nativeBold).boundingRect(rc, Qt::TextWordWrap|Qt::AlignCenter,tr("Start")); QObject::connect(startButton_ = new QPushButton(tr("Start"), this), SIGNAL(clicked()), this, SLOT(onStart())); startButton_->setToolTip(tr("Login to LMAX or connection start\n(account settings can be configured in settings))")); startButton_->setFont(*Global::buttons); startButton_->setAutoDefault(false); startButton_->setFixedSize(rc.width()*2, rc.height()*2); startButton_->move(10,10); startButton_->show(); QObject::connect(stopButton_ = new QPushButton(tr("Stop"), this), SIGNAL(clicked()), this, SLOT(onStop())); stopButton_->setToolTip(tr("Logout from LMAX or connection stop")); stopButton_->setFont(*Global::buttons); stopButton_->setFixedSize(rc.width()*2, rc.height()*2); stopButton_->move(startButton_->pos().x()+startButton_->width()+10, 10); stopButton_->setEnabled(false); stopButton_->setAutoDefault(false); stopButton_->show(); QPalette pal; pal.setColor(QPalette::Button, BTN_RED); colorButton_ = new QPushButton(NULL, this); colorButton_->setToolTip(tr("\"Traffic light\" or connection state color")); colorButton_->setFixedSize(rc.height()*2, rc.height()*2); colorButton_->move(stopButton_->pos().x()+stopButton_->width()+10, 10); colorButton_->setAutoDefault(false); colorButton_->setPalette( pal ); colorButton_->show(); QObject::connect(reconnectBox_ = new QCheckBox(tr("Reconnect After Failure"), this), SIGNAL(stateChanged(int)), netman_->scheduler(), SLOT(setReconnectEnabled(int))); reconnectBox_->setToolTip(tr("Enable/disable auto-reconnecting after connection failures\nNote that the button takes off itself if disconnection was\nby reason of invalid connection settings,\nnot on server side,\nreceived exchange's logout message")); reconnectBox_->setCheckState(Qt::Checked); reconnectBox_->setFont(*Global::buttons); reconnectBox_->move(colorButton_->pos().x()+colorButton_->width()+10, 10); reconnectBox_->show(); QObject::connect(settingsButton_ = new QPushButton(NULL, this), SIGNAL(clicked()), this, SLOT(onSettings())); settingsButton_->setFixedSize(rc.height()*2, rc.height()*2); settingsButton_->setIconSize( QSize(colorButton_->width(), colorButton_->height()) ); settingsButton_->setIcon(QIcon( *Global::pxSettings )); settingsButton_->move(width() - rc.height()*2 - 10, 10); settingsButton_->setAutoDefault(false); }
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), loginWindow_(NULL), connectWindow_(NULL), serverListWindow_(0), timer_(NULL), settingsMenu_(0), connected_(0), getServers_(NULL) { QCoreApplication::setOrganizationName("CPPP"); QCoreApplication::setApplicationName("VPNht"); ui.setupUi(this); setWindowTitle("VPN.ht " + QString(VERSION)); g_openVPNConnection = new OpenVPNConnectorQt(this); if (!g_openVPNConnection->installHelper(SERVICE_NAME)) { QMessageBox::information(this, "VPNht", "Failed to install helper for program. Please contact support."); QTimer::singleShot(1, this, SLOT(close())); return; } #if defined Q_OS_MAC //setAttribute(Qt::WA_QuitOnClose, false); #endif trayIcon_ = new QSystemTrayIcon(this); trayMenu_ = new QMenu(this); actConnect_ = new QAction("Connect", this); actDisconnect_ = new QAction("Disconnect", this); actHelp_ = new QAction("Help", this); actLiveChat_ = new QAction("Live chat", this); actExit_ = new QAction("Quit", this); trayMenu_->addAction(actConnect_); trayMenu_->addAction(actDisconnect_); trayMenu_->addSeparator(); trayMenu_->addAction(actHelp_); trayMenu_->addAction(actLiveChat_); trayMenu_->addAction(actExit_); trayIcon_->setContextMenu(trayMenu_); trayIcon_->hide(); setTrayStatusDisconnected(false); settingsMenu_ = new QMenu(this); settingsMenu_->addAction("Settings", this, SLOT(onSettings())); settingsMenu_->addAction("Status", this, SLOT(onStatus())); settingsMenu_->addAction("Help", this, SLOT(onHelp())); settingsMenu_->addAction("Proxy", this, SLOT(onProxy())); settingsMenu_->addAction("Show logs", this, SLOT(onShowLogs())); settingsMenu_->addAction("Logout", this, SLOT(onReturnToSignUp())); settingsMenu_->setStyleSheet(ctxMenuStyle); loginWindow_ = new LoginWindow(this); ui.verticalLayout->addWidget(loginWindow_); loginWindow_->loadSettings(); loginWindow_->hide(); connect(loginWindow_, SIGNAL(signedIn(QString, QString)), SLOT(onSignIn(QString, QString))); waitWindow_ = new WaitWindow(this); ui.verticalLayout->addWidget(waitWindow_); settingsWindow_ = new SettingsWindow(settingsMenu_, this); connect(settingsWindow_, SIGNAL(back()), SLOT(onBack())); ui.verticalLayout->addWidget(settingsWindow_); settingsWindow_->hide(); connectWindow_ = new ConnectWindow(settingsMenu_, this); connect(connectWindow_, SIGNAL(serverList()), SLOT(onServerList())); connect(connectWindow_, SIGNAL(connected()), SLOT(onConnected())); ui.verticalLayout->addWidget(connectWindow_); ui.verticalLayout->addWidget(connectWindow_); connectWindow_->hide(); serverListWindow_ = new ServerListWindow(this); connect(serverListWindow_, SIGNAL(serverSelected(const QString &)), this, SLOT( onChangeServer(const QString &) )); ui.verticalLayout->addWidget(serverListWindow_); serverListWindow_->hide(); proxySettingsWindow_ = new ProxySettingsWindow(settingsMenu_, this); connect(proxySettingsWindow_, SIGNAL(back()), SLOT(onBack())); ui.verticalLayout->addWidget(proxySettingsWindow_); proxySettingsWindow_->hide(); // tray action connect(actConnect_, SIGNAL(triggered()), connectWindow_, SLOT(onClickConnect())); connect(actDisconnect_, SIGNAL(triggered()), connectWindow_, SLOT(onClickConnect())); connect(actHelp_, SIGNAL(triggered()), SLOT(onActHelp())); connect(actLiveChat_, SIGNAL(triggered()), SLOT(onLiveChat())); connect(actExit_, SIGNAL(triggered()), SLOT(onExit())); #if defined Q_OS_WIN connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT( onTrayActivated(QSystemTrayIcon::ActivationReason) )); #endif QSettings settings; if (settings.value("savePass", "true").toString() == "true") { QString username = settings.value("login", "").toString(); QString password = settings.value("password", "").toString(); if (!username.isEmpty() && !password.isEmpty()) { adjustSize(); setFixedSize(size()); skipLoginScreen(username, password); } else { waitWindow_->hide(); loginWindow_->show(); adjustSize(); setFixedSize(size()); } } else { waitWindow_->hide(); loginWindow_->show(); adjustSize(); setFixedSize(size()); } }
/*! * Создаёт кнопки */ 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())); }
void ChessWidget::createMenu() { QMenu * gameMenu = menuBar()->addMenu(tr("&Game")); onNewAction_ = new QAction(tr("&New"), this); onNewAction_->setStatusTip(tr("Start new game")); onLoadAction_ = new QAction(tr("&Load"), this); onLoadAction_->setStatusTip(tr("Load previously saved game")); onSaveAction_ = new QAction(tr("&Save"), this); onSaveAction_->setStatusTip(tr("Save current game")); onPrevAction_ = new QAction(tr("&Undo move"), this); onPrevAction_->setStatusTip(tr("Undo last move. (only step of one color will be undone)")); onNextAction_ = new QAction(tr("&Redo move"), this); onNextAction_->setStatusTip(tr("Restore undone move")); onGoAction_ = new QAction(tr("&Go"), this); onGoAction_->setStatusTip(tr("Lets program make move")); onTurnBoardAction_ = new QAction(tr("&Turn board"), this); onTurnBoardAction_->setStatusTip(tr("Turn board to play another color")); onTurnBoardAction_->setCheckable(true); onTurnBoardAction_->setChecked(false); onHumanVsHumanAction_ = new QAction(tr("&Human vs. Human"), this); onHumanVsHumanAction_->setStatusTip(tr("Switch to Human with Human mode")); onHumanVsHumanAction_->setCheckable(true); onHumanVsHumanAction_->setChecked(false); QSettings settings(tr("Dimock"), tr("qchess")); onOpenBookAction_ = new QAction(tr("&Open book"), this); onOpenBookAction_->setStatusTip(tr("Use open book")); onOpenBookAction_->setCheckable(true); onOpenBookAction_->setChecked( settings.value(tr("open_book"), true).toBool() ); onSettingsAction_ = new QAction(tr("Settin&gs"), this); onSettingsAction_->setStatusTip(tr("Change game settings")); gameMenu->addAction(onNewAction_); gameMenu->addAction(onLoadAction_); gameMenu->addAction(onSaveAction_); gameMenu->addAction(onPrevAction_); gameMenu->addAction(onNextAction_); gameMenu->addAction(onGoAction_); gameMenu->addAction(onTurnBoardAction_); gameMenu->addAction(onOpenBookAction_); gameMenu->addSeparator(); gameMenu->addAction(onHumanVsHumanAction_); gameMenu->addSeparator(); gameMenu->addAction(onSettingsAction_); connect(onNewAction_, SIGNAL(triggered()), this, SLOT(onNew())); connect(onLoadAction_, SIGNAL(triggered()), this, SLOT(onLoad())); connect(onSaveAction_, SIGNAL(triggered()), this, SLOT(onSave())); connect(onPrevAction_, SIGNAL(triggered()), this, SLOT(onPrev())); connect(onNextAction_, SIGNAL(triggered()), this, SLOT(onNext())); connect(onGoAction_, SIGNAL(triggered()), this, SLOT(onGo())); connect(onTurnBoardAction_, SIGNAL(toggled(bool)), this, SLOT(onTurnBoard(bool))); connect(onHumanVsHumanAction_, SIGNAL(toggled(bool)), this, SLOT(onHumanWithHumanMode(bool))); connect(onOpenBookAction_, SIGNAL(toggled(bool)), this, SLOT(onUseOpenBook(bool))); connect(onSettingsAction_, SIGNAL(triggered()), this, SLOT(onSettings())); }