MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // Setup UI ui->setupUi(this); // Set start tab as blank QLabel *newTab = new QLabel(ui->tabWidget); newTab->setText(tr("Neither camera connected nor file loaded.")); newTab->setAlignment(Qt::AlignCenter); ui->tabWidget->addTab(newTab, ""); ui->tabWidget->setTabsClosable(false); // Add "Connect to Camera" button to tab connectToCameraButton = new QPushButton(); connectToCameraButton->setText(tr("Connect/Open")); ui->tabWidget->setCornerWidget(connectToCameraButton, Qt::TopLeftCorner); connect(connectToCameraButton,SIGNAL(released()),this, SLOT(connectToCamera())); connect(ui->tabWidget,SIGNAL(tabCloseRequested(int)),this, SLOT(disconnectCamera(int))); // Set focus on button connectToCameraButton->setFocus(); connectToCameraButton->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_O)); // Connect other signals/slots connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelpDialog())); connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(showAboutQtDialog())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionFullScreen, SIGNAL(toggled(bool)), this, SLOT(setFullScreen(bool))); connect(ui->actionConnect_Open, SIGNAL(triggered()), this, SLOT(connectToCamera())); // Create SharedImageBuffer object sharedImageBuffer = new SharedImageBuffer(); addCodecs(); }
/** Default constructor */ ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags), mId(id) { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); ui._useOldFormat_CB->setChecked(true) ; ui.headerFrame->setHeaderImage(QPixmap(":/images/user/identityinfo64.png")); ui.headerFrame->setHeaderText(tr("Friend Details")); ui._chat_CB->hide() ; setAttribute(Qt::WA_DeleteOnClose, true); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyDialog())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend())); connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend())); connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey())); connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog())); connect(ui._shouldAddSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage())); connect(ui._useOldFormat_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage())); // connect(ui._anonymous_routing_CB, SIGNAL(toggled(bool)), this, SLOT(setServiceFlags())); // connect(ui._discovery_CB, SIGNAL(toggled(bool)), this, SLOT(setServiceFlags())); // connect(ui._forums_channels_CB, SIGNAL(toggled(bool)), this, SLOT(setServiceFlags())); ui.avatar->setFrameType(AvatarWidget::NORMAL_FRAME); MainWindow *w = MainWindow::getInstance(); if (w) { connect(this, SIGNAL(configChanged()), w->getPage(MainWindow::Network), SLOT(insertConnect())); } }
/** Create and bind actions to events. Setup for initial * tray menu configuration. */ void MainWindow::createActions() { _prefsAct = new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this); connect(_prefsAct, SIGNAL(triggered()), this, SLOT(showPreferencesWindow())); _bandwidthAct = new QAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), this); connect(_bandwidthAct, SIGNAL(triggered()), _bandwidthGraph, SLOT(showWindow())); _messengerwindowAct = new QAction(QIcon(IMAGE_RSM16), tr("Open Messenger"), this); connect(_messengerwindowAct, SIGNAL(triggered()),this, SLOT(showMessengerWindow())); _messagesAct = new QAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this); connect(_messagesAct, SIGNAL(triggered()),this, SLOT(showMess())); _appAct = new QAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this); connect(_appAct, SIGNAL(triggered()),this, SLOT(showApplWindow())); //_smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this); //connect(_smplayerAct, SIGNAL(triggered()),this, SLOT(showsmplayer())); _helpAct = new QAction(QIcon(IMG_HELP), tr("Help"), this); connect(_helpAct, SIGNAL(triggered()), this, SLOT(showHelpDialog())); }
MainWidget::MainWidget(int fps, QWidget *parent) : fps(fps), QWidget(parent) { ui.setupUi(this); srand((unsigned int)time(NULL));//初始化随机数种子 initWidgetProp(); initOpenGLContext(); initMultiSample(); initGlew(); initGLStates(); initLabels(); //设置绘制计时器 connect(&drawTimer, SIGNAL(timeout()), this, SLOT(update())); drawTimer.start(1000 / fps); fpsTime = new QTime; fpsTime->start(); isMousePress = false; pictureWidget = new PictureWidget; editPictureDialog = new EditPictureDialog; editPictureDialog->hide(); helpDialog = new QDialog; QPalette palette = helpDialog->palette(); QPixmap logo("Resources/bg/logo.jpg"); palette.setBrush(QPalette::Window, logo); helpDialog->setWindowTitle(QString::fromLocal8Bit("关于")); helpDialog->setPalette(palette); helpDialog->resize(logo.size()); helpDialog->hide(); Scene::initSingletons(WIDTH, HEIGHT); scene = new Scene(WIDTH, HEIGHT); connect(scene, SIGNAL(setFileName(QString)), this, SLOT(setFileName(QString))); connect(scene, SIGNAL(setResolution(int, int)), this, SLOT(setResolution(int, int))); connect(scene, SIGNAL(setAlpha(float)), this, SLOT(setAlpha(float))); connect(scene, SIGNAL(displayCenterPicture(QString)), this, SLOT(displayCenterPicture(QString))); connect(scene, SIGNAL(showEditPictureDialog(QString, QString, QString, int, int)), this, SLOT(showEditPictureDialog(QString, QString, QString, int, int))); connect(scene, SIGNAL(showHelpDialog()), this, SLOT(showHelpDialog())); connect(pictureWidget, SIGNAL(closing()), this, SLOT(show())); connect(editPictureDialog, SIGNAL(reloadPicture(QString)), scene, SLOT(reloadPicture(QString))); }
/** Creates a tray icon with a context menu and adds it to the system * notification area. */ void MainWindow::createTrayIcon() { /** Tray icon Menu **/ QMenu *trayMenu = new QMenu(this); QObject::connect(trayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); toggleVisibilityAction = trayMenu->addAction(QIcon(IMAGE_RETROSHARE), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu())); /* Create status menu */ QMenu *statusMenu = trayMenu->addMenu(tr("Status")); initializeStatusObject(statusMenu, true); /* Create notify menu */ notifyMenu = trayMenu->addMenu(tr("Notify")); notifyMenu->menuAction()->setVisible(false); trayMenu->addSeparator(); trayMenu->addAction(QIcon(IMAGE_RSM16), tr("Open Messenger"), this, SLOT(showMessengerWindow())); trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess())); trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), _bandwidthGraph, SLOT(showWindow())); #ifdef USE_DHTWINDOW trayMenu->addAction(QIcon(IMAGE_DHT), tr("DHT Details"), this, SLOT(showDhtWindow())); #endif #ifdef USE_BWCTRLWINDOW trayMenu->addAction(QIcon(IMAGE_DHT), tr("Bandwidth Details"), this, SLOT(showBwCtrlWindow())); #endif #ifdef UNFINISHED trayMenu->addAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this, SLOT(showApplWindow())); #endif trayMenu->addAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this, SLOT(showSettings())); trayMenu->addAction(QIcon(IMG_HELP), tr("Help"), this, SLOT(showHelpDialog())); trayMenu->addSeparator(); trayMenu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); trayMenu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized())); trayMenu->addSeparator(); trayMenu->addAction(QIcon(IMAGE_CLOSE), tr("&Quit"), this, SLOT(doQuit())); /** End of Icon Menu **/ // Create the tray icon trayIcon = new QSystemTrayIcon(this); trayIcon->setToolTip(tr("RetroShare")); trayIcon->setContextMenu(trayMenu); trayIcon->setIcon(QIcon(IMAGE_NOONLINE)); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason))); trayIcon->show(); }
/** Default constructor */ ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlags flags) : QDialog(parent, flags), mId(id) { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog())); connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close())); connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend())); connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend())); connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey())); connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog())); connect(ui._shouldAddSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage())); MainWindow *w = MainWindow::getInstance(); if (w) { connect(this, SIGNAL(configChanged()), w->getPage(MainWindow::Network), SLOT(insertConnect())); } }
ProgramConfigureDialog::ProgramConfigureDialog(Program *program, QWidget *parentObject) : QDialog(parentObject), ui(new Ui::ProgramConfigureDialog), m_program(program), m_helpDialog(NULL), m_isCustomized((m_program->launchSyntax() == Program::CUSTOM)), m_dirty(false) { ui->setupUi(this); populateSyntaxCombo(); connect(ui->combo_syntax, SIGNAL(currentIndexChanged(int)), this, SLOT(launchSyntaxChanged(int))); connect(ui->push_customize, SIGNAL(clicked()), this, SLOT(customizeLauncherClicked())); connect(ui->edit_executableName, SIGNAL(textChanged(QString)), this, SLOT(updateLaunchEditor())); connect(ui->edit_executablePath, SIGNAL(textChanged(QString)), this, SLOT(updateLaunchEditor())); connect(ui->edit_arguments, SIGNAL(textChanged(QString)), this, SLOT(updateLaunchEditor())); connect(ui->edit_inputFilename, SIGNAL(textChanged(QString)), this, SLOT(updateLaunchEditor())); connect(ui->edit_outputFilename, SIGNAL(textChanged(QString)), this, SLOT(updateLaunchEditor())); connect(ui->gb_executablePath, SIGNAL(toggled(bool)), this, SLOT(updateLaunchEditor())); connect(ui->text_launchTemplate, SIGNAL(textChanged()), this, SLOT(launchEditorTextChanged())); connect(ui->templateHelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog())); connect(ui->edit_name, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(ui->edit_executableName, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(ui->edit_executablePath, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(ui->edit_arguments, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(ui->edit_inputFilename, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(ui->edit_outputFilename, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(ui->gb_executablePath, SIGNAL(toggled(bool)), this, SLOT(setDirty())); connect(ui->combo_syntax, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty())); connect(ui->push_customize, SIGNAL(clicked()), this, SLOT(setDirty())); connect(ui->text_launchTemplate, SIGNAL(textChanged()), this, SLOT(setDirty())); connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonBoxButtonClicked(QAbstractButton*))); updateGuiFromProgram(); launchSyntaxChanged(ui->combo_syntax->currentIndex()); }
/// returns true if command is processed bool V3DocViewWin::onCommand( int command, int params ) { CRLog::info("V3DocViewWin::onCommand(%d [%s], %d)", command, getCommandName(command, params), params ); switch ( command ) { case MCMD_QUIT: getWindowManager()->closeAllWindows(); return true; case MCMD_MAIN_MENU: showMainMenu(); return true; case MCMD_SETTINGS_FONTSIZE: showFontSizeMenu(); return true; #if CR_INTERNAL_PAGE_ORIENTATION==1 case MCMD_SETTINGS_ORIENTATION: showOrientationMenu(); return true; #endif case MCMD_SETTINGS: showSettingsMenu(); return true; case MCMD_RECENT_BOOK_LIST: showRecentBooksMenu(); return true; case MCMD_OPEN_RECENT_BOOK: _docview->swapToCache(); _docview->getDocument()->updateMap(); openRecentBook( params ); return true; case MCMD_SWITCH_TO_RECENT_BOOK: _docview->swapToCache(); _docview->getDocument()->updateMap(); openRecentBook( 1 ); return true; case MCMD_ABOUT: showAboutDialog(); return true; case MCMD_CITE: activate_cite( _wm, this); return true; case MCMD_GO_PAGE_APPLY: _docview->doCommand( DCMD_GO_PAGE, params-1 ); return true; case MCMD_GO_PERCENT_APPLY: _docview->doCommand( DCMD_GO_POS, params * _docview->GetFullHeight() / 100 ); return true; case MCMD_SETTINGS_APPLY: #if CR_INTERNAL_PAGE_ORIENTATION==1 case mm_Orientation: #endif case mm_FontSize: applySettings(); saveSettings( lString16() ); _wm->getSkin()->gc(); return true; case DCMD_SAVE_HISTORY: saveHistory( lString16() ); saveSettings( lString16() ); return true; case DCMD_SAVE_TO_CACHE: _docview->swapToCache(); _docview->getDocument()->updateMap(); return true; case MCMD_BOOKMARK_LIST: showBookmarksMenu(false); return true; case MCMD_BOOKMARK_LIST_GO_MODE: showBookmarksMenu(true); return true; case DCMD_ZOOM_IN: case DCMD_ZOOM_OUT: showWaitIcon(); CRViewDialog::onCommand( command, params ); _props->setInt( PROP_FONT_SIZE, _docview->getFontSize() ); saveSettings( lString16() ); return true; case MCMD_HELP: showHelpDialog(); return true; case DCMD_BOOKMARK_SAVE_N: _docview->doCommand( DCMD_BOOKMARK_SAVE_N, params ); if ( _props->getBoolDef( PROP_AUTOSAVE_BOOKMARKS, true ) ) saveHistory( lString16() ); return true; default: // do nothing ; } return CRViewDialog::onCommand( command, params ); }
/** Displays the help browser and displays the most recently viewed help * topic. */ void ConfCertDialog::showHelpDialog() { showHelpDialog("trust"); }
/** Displays the help browser and displays the most recently viewed help * topic. */ void MainWindow::showHelpDialog() { showHelpDialog(QString()); }
/*! Stisk menu help*/ void MainWindow::on_actionHelp_activated() { showHelpDialog(); }