MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(this, SIGNAL(windowWasShown()), this, SLOT(initWinSparkle()), Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection)); }
void MainWindow::createConnections() { connect(this, SIGNAL(windowWasShown()), this, SLOT(initUpdates()), Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection)); connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT(currentWidget(QWidget *))); connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), _recorder, SLOT(currentWidget(QWidget *))); connect(_playlistTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(_scheduleTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(_showInfoTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(ui->actionSupport, SIGNAL(triggered()), this, SLOT(support())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano())); connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui->actionLogoutExit, SIGNAL(triggered()), this, SLOT(exitLogout())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exit())); connect(ui->actionTop, SIGNAL(triggered()), this, SLOT(top())); connect(ui->actionLite, SIGNAL(triggered()), this, SLOT(lite())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openPlaylist())); connect(ui->actionOpenFile, SIGNAL(triggered()), _mediaPlayer, SLOT(openFile())); connect(ui->actionOpenUrl, SIGNAL(triggered()), _mediaPlayer, SLOT(openUrl())); connect(ui->actionSchedule, SIGNAL(triggered()), this, SLOT(showSchedule())); connect(ui->actionScheduleCurrent, SIGNAL(triggered()), this, SLOT(showScheduleCurrent())); connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings())); connect(ui->actionSettingsShortcuts, SIGNAL(triggered()), this, SLOT(showSettingsShortcuts())); connect(ui->actionEditPlaylist, SIGNAL(triggered()), this, SLOT(showPlaylistEditor())); connect(ui->actionPlay, SIGNAL(triggered()), _mediaPlayer, SLOT(togglePause())); connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stop())); connect(ui->actionPreview, SIGNAL(triggered(bool)), this, SLOT(preview(bool))); connect(_playlistTab->playlist(), SIGNAL(itemSelected(Channel *)), this, SLOT(playChannel(Channel *))); connect(_previewTimer, SIGNAL(timeout()), ui->actionNext, SLOT(trigger())); if (_trayIcon) { connect(_trayIcon, SIGNAL(restoreClick()), this, SLOT(tray())); connect(ui->actionTray, SIGNAL(triggered()), this, SLOT(tray())); } connect(ui->actionFullscreen, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen(bool))); connect(ui->actionMute, SIGNAL(toggled(bool)), _mediaPlayer->osd(), SLOT(mute(bool))); connect(ui->actionVolumeDown, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeDown())); connect(ui->actionVolumeUp, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeUp())); #if defined(Q_OS_LINUX) if (_mediaPlayer->teletextEnabled()) { connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer->osd(), SLOT(teletext(bool))); connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer, SLOT(teletext(bool))); connect(_mediaPlayer->osd(), SIGNAL(teletextClicked()), ui->actionTeletext, SLOT(trigger())); }
void MainWindow::showEvent(QShowEvent *event) { QMainWindow::showEvent(event); // showEvent() is called right *before* the window is shown, but WinSparkle // requires that the main UI of the application is already shown when // calling win_sparkle_init() (otherwise it could show its updates UI // behind the app instead of at top). By using a helper signal, we delay // calling initWinSparkle() until after the window was shown. // // Alternatively, one could achieve the same effect in arguably a simpler // way, by initializing WinSparkle in main(), right after showing the main // window. See https://github.com/vslavik/winsparkle/issues/41#issuecomment-70367197 // for a discussion of this. emit windowWasShown(); }
void MainWindow::showEvent(QShowEvent *event) { QMainWindow::showEvent(event); emit windowWasShown(); }