Exemple #1
0
/***********************************************************************
    These functions implement the X button being a close to tray button. Closing from the tray will then exit the progam.
*/
void BitSplit::closeEvent(QCloseEvent * event){
    if(exit){
        actionCreator.exit();
        smartMatch.exit();
        trayIcon->hide();
        event->accept();
    }
    else{
        onShowHide();
        event->ignore();
    }
}
void SceneViewerContextMenu::addShowHideCommand(QMenu *menu,
                                                TXshColumn *column) {
  bool isHidden = !column->isCamstandVisible();
  TXsheet *xsh  = TApp::instance()->getCurrentXsheet()->getXsheet();
  TStageObject *stageObject =
      xsh->getStageObject(TStageObjectId::ColumnId(column->getIndex()));
  QString text    = (isHidden ? "Show " : "Hide ") + getName(stageObject);
  QAction *action = new QAction(text, this);
  action->setData(column->getIndex());
  connect(action, SIGNAL(triggered()), this, SLOT(onShowHide()));
  menu->addAction(action);
}
Exemple #3
0
/***********************************************************************
    This function handles events such as translating the UI and minimisation to tray.
*/
void BitSplit::changeEvent(QEvent * e){
    switch (e->type())
     {
         case QEvent::LanguageChange:

             break;
         case QEvent::WindowStateChange:
             {
                 if (this->windowState() & Qt::WindowMinimized)
                    onShowHide();
                 break;

             }
         default:
             break;
     }

     QMainWindow::changeEvent(e);

}
Exemple #4
0
/***********************************************************************
    This function creates a tray icon with the necessary actions and connects it to the main program.
*/
void BitSplit::createTrayIcon(){

    trayIcon = new QSystemTrayIcon(QIcon(":images/general/icon16.png"), this);

    connect( trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT( trayHide(QSystemTrayIcon::ActivationReason)) );

    QAction * showHideAction = new QAction("Show/Hide", trayIcon);
    connect(showHideAction, SIGNAL(triggered()), this, SLOT(onShowHide()));

    QAction * exitAction = new QAction("Exit", trayIcon);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(allowExit()));

    QMenu * trayMenu = new QMenu();

    trayMenu->addAction(exitAction);
    trayMenu->addAction(showHideAction);

    trayIcon->setContextMenu( trayMenu );

    trayIcon->show();
}
Exemple #5
0
/***********************************************************************
    These functions lets the user minimise/restore the program from the tray.
*/
void BitSplit::trayHide(QSystemTrayIcon::ActivationReason reason){
    if(reason && reason != QSystemTrayIcon::DoubleClick)
        return;

    onShowHide();
}