MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); // Settings m_settings = new VSettings("org.hawaii.desktop"); connect(m_settings, SIGNAL(changed()), this, SLOT(settingsChanged())); // Connect signals connect(ui->actionNewTab, SIGNAL(triggered()), this, SLOT(slotNewTab())); connect(ui->actionNewWindow, SIGNAL(triggered()), this, SLOT(slotNewWindow())); connect(ui->actionCloseTab, SIGNAL(triggered()), this, SLOT(slotCloseCurrentTab())); connect(ui->actionOpenFileManager, SIGNAL(triggered()), this, SLOT(slotOpenFileManager())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SLOT(slotPaste())); connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(slotFind())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout())); connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(slotCloseTab(int))); // Start with a tab slotNewTab(); }
void MainWindow::createActions() { if(opt.arg_debug) printf("createActions\n"); if(opt.arg_disable == 0) { optionAct = new QAction(QIcon(":/images/option.png"), l_options, this); #ifndef USE_MAEMO optionAct->setShortcut(tr("Ctrl+O")); #endif optionAct->setStatusTip(l_status_options); connect(optionAct, SIGNAL(triggered()), this, SLOT(slotFileOpt())); } if(opt.arg_disable == 0) { windowAct = new QAction(QIcon(":/images/window.png"), l_new_window, this); windowAct->setShortcut(tr("Ctrl+N")); windowAct->setStatusTip(l_status_new_window); connect(windowAct, SIGNAL(triggered()), this, SLOT(slotWindow())); newtabAct = new QAction(QIcon(":/images/newtab.png"), l_new_tab, this); //newtabAct->setShortcut(tr("Ctrl+N")); newtabAct->setStatusTip(l_status_new_tab); connect(newtabAct, SIGNAL(triggered()), this, SLOT(slotNewTab())); } reconnectAct = new QAction(QIcon(":/images/view-refresh.png"), l_reconnect, this); reconnectAct->setShortcut(tr("Ctrl+R")); reconnectAct->setStatusTip(l_status_reconnect); connect(reconnectAct, SIGNAL(triggered()), this, SLOT(slotReconnect())); storebmpAct = new QAction(QIcon(":/images/storebmp.png"), l_save_as_bmp, this); storebmpAct->setShortcut(tr("Ctrl+B")); storebmpAct->setStatusTip(l_status_save_as_bmp); connect(storebmpAct, SIGNAL(triggered()), this, SLOT(slotStorebmp())); gohomeAct = new QAction(QIcon(":/images/gohome.png"), opt.initialhost, this); gohomeAct->setStatusTip(opt.initialhost); connect(gohomeAct, SIGNAL(triggered()), this, SLOT(slotGohome())); logbmpAct = new QAction(QIcon(":/images/logbmp.png"), l_log_as_bmp, this); logbmpAct->setStatusTip(l_status_log_as_bmp); connect(logbmpAct, SIGNAL(triggered()), this, SLOT(slotLogbmp())); logpvmAct = new QAction(QIcon(":/images/logpvm.png"), l_log_as_pvm, this); logpvmAct->setStatusTip(l_status_log_as_pvm); connect(logpvmAct, SIGNAL(triggered()), this, SLOT(slotLogpvm())); printAct = new QAction(QIcon(":/images/print.png"), l_print, this); printAct->setShortcut(tr("Ctrl+P")); printAct->setStatusTip(l_status_print); connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint())); newtabActToolBar = new QAction(QIcon(":/images/newtab.png"), l_new_tab, this); newtabActToolBar->setStatusTip(l_status_new_tab); connect(newtabActToolBar, SIGNAL(triggered()), this, SLOT(slotNewTab())); exitAct = new QAction(QIcon(":/images/exit.png"), l_exit, this); exitAct->setShortcut(tr("Ctrl+Q")); exitAct->setStatusTip(l_status_exit); connect(exitAct, SIGNAL(triggered()), this, SLOT(slotExit())); copyAct = new QAction(QIcon(":/images/copy.png"), l_copy, this); copyAct->setShortcut(tr("Ctrl+C")); copyAct->setStatusTip(l_status_copy); connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy())); if(opt.arg_disable == 0) { editmenuAct = new QAction(l_editmenu, this); editmenuAct->setShortcut(tr("Ctrl+E")); editmenuAct->setStatusTip(l_status_editmenu); connect(editmenuAct, SIGNAL(triggered()), this, SLOT(slotEditmenu())); addAction(editmenuAct); toolbarAct = new QAction(QIcon(":/images/toolbar.png"), l_toolbar, this); toolbarAct->setShortcut(tr("Ctrl+T")); toolbarAct->setStatusTip(l_status_toolbar); connect(toolbarAct, SIGNAL(triggered()), this, SLOT(slotToolbar())); addAction(toolbarAct); statusbarAct = new QAction(QIcon(":/images/statusbar.png"), l_statusbar, this); statusbarAct->setShortcut(tr("Ctrl+S")); statusbarAct->setStatusTip(l_status_statusbar); connect(statusbarAct, SIGNAL(triggered()), this, SLOT(slotStatusbar())); addAction(statusbarAct); maximizedAct = new QAction(l_maximized, this); maximizedAct->setShortcut(tr("Ctrl+M")); maximizedAct->setStatusTip(l_status_toggle_maximized); connect(maximizedAct, SIGNAL(triggered()), this, SLOT(slotMaximized())); addAction(maximizedAct); fullscreenAct = new QAction(QIcon(":/images/fullscreen.png"), l_fullscreen, this); fullscreenAct->setShortcut(tr("Ctrl+F")); fullscreenAct->setStatusTip(l_status_toggle_full_screen); connect(fullscreenAct, SIGNAL(triggered()), this, SLOT(slotFullscreen())); addAction(fullscreenAct); } manualAct = new QAction(l_manual, this); manualAct->setShortcut(tr("Ctrl+H")); manualAct->setStatusTip(l_status_manual); connect(manualAct, SIGNAL(triggered()), this, SLOT(slotManual())); aboutAct = new QAction(l_about, this); aboutAct->setStatusTip(l_status_about); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction("About &Qt", this); aboutQtAct->setStatusTip("About Qt library"); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); logoAct = new QAction(QIcon(":/images/app.png"),"pvbrowser", this); logoAct->setStatusTip(tr("About pvbrowser")); connect(logoAct, SIGNAL(triggered()), this, SLOT(about())); }