Exemple #1
0
void MainWindow::buildTrayMenu() {
    trayMenu = new QMenu();
    QAction *a;
    a=trayMenu->addAction("Open Quack", this, SLOT(onTrayOpenQuack()));
    trayMenu->setDefaultAction(a);
    trayMenu->addAction("Quit", this, SLOT(on_actionQuit_triggered()));
}
Exemple #2
0
void ezQtTestGUI::on_actionRunTests_triggered()
{
  m_pTestFramework->SaveTestOrder();
  m_pModel->InvalidateAll();
  m_bExpandedCurrentTest = false;
  m_bAbort = false;
  m_pMessageLogDock->currentTestResultChanged(nullptr);

  m_pStatusTextWorkState->setText("<p><span style=\"font-weight:600; color:#ff5500;\" >  [Working...]</span></p>");

  // make sure we start with a clean state
  m_pTestFramework->ResetTests();

  while (m_pTestFramework->RunTestExecutionLoop() == ezTestAppRun::Continue)
  {
    UpdateButtonStates();

    if (m_bAbort)
    {
      m_pTestFramework->AbortTests();
    }
  }

  UpdateButtonStates();
  m_pMessageLogDock->currentTestResultChanged(nullptr);

  // MessageBox
  if (m_bAbort)
  {
    m_pStatusTextWorkState->setText("<p><span style=\"font-weight:600; color:#ff0000;\">  [Tests Aborted]</span></p>");

    if (m_pTestFramework->GetSettings().m_bShowMessageBox)
      QMessageBox::information(this, "Tests Aborted", "The tests were aborted by the user.", QMessageBox::Ok, QMessageBox::Ok);

    m_bAbort = false;
  }
  else
  {
    if (m_pTestFramework->GetTotalErrorCount() > 0)
    {
      m_pStatusTextWorkState->setText("<p><span style=\"font-weight:600; color:#ff0000;\">  [Tests Failed]</span></p>");

      if (m_pTestFramework->GetSettings().m_bShowMessageBox)
        QMessageBox::critical(this, "Tests Failed", "Some tests have failed.", QMessageBox::Ok, QMessageBox::Ok);
    }
    else
    {
      m_pStatusTextWorkState->setText("<p><span style=\"font-weight:600; color:#00aa00;\">  [All Tests Passed]</span></p>");

      if (m_pTestFramework->GetSettings().m_bShowMessageBox)
        QMessageBox::information(this, "Tests Succeeded", "All tests succeeded.", QMessageBox::Ok, QMessageBox::Ok);

      if (m_pTestFramework->GetSettings().m_bCloseOnSuccess)
        QTimer::singleShot(100, this, SLOT(on_actionQuit_triggered()));
    }
  }
}
Exemple #3
0
bool QuaMainWindow::IBFSetupConnections()
{
    connect(mQuaTextEdit, SIGNAL(signal_actionNew()), this, SLOT(on_actionNew_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionOpen()), this, SLOT(on_actionOpen_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionSave()), this, SLOT(on_actionSave_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionSaveAs()), this, SLOT(on_actionSaveAs_triggered()));
    connect(mQuaTextEdit, SIGNAL(signal_actionQuit()), this, SLOT(on_actionQuit_triggered()));

    connect(mQuaTextEdit, SIGNAL(textChanged()), this, SLOT(on_SignalModified()));
    connect(mIBFTreeView, SIGNAL(SignalModified()), this, SLOT(on_SignalModified()));

    return true;
}
Exemple #4
0
void MainWindow::createActions()
{
    minimizeAction = new QAction(tr("Mi&nimize"), this);
    connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));

    maximizeAction = new QAction(tr("Ma&ximize"), this);
    connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));

    restoreAction = new QAction(tr("&Restore"), this);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));

    quitAction = new QAction(tr("&Quit"), this);
    connect(quitAction, SIGNAL(triggered()), this, SLOT(on_actionQuit_triggered()));
}
Exemple #5
0
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setUpEditor();

    //adds new tab button
    QToolButton *newTabButton = new QToolButton(this);
    ui->tabWidget->setCornerWidget(newTabButton);
    newTabButton->setAutoRaise(true);
    newTabButton->setText("+");

    //connect signals
    QObject::connect(newTabButton, SIGNAL(clicked()), this, SLOT(makeNewTab()));
    QObject::connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));

    //create keyboard shortcuts
    QShortcut *shortcut = new QShortcut(QKeySequence("ctrl+w"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(deleteCurrentTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+t"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(makeNewTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+s"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSave_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+shift+s"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionSave_As_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+o"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionOpen_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+q"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(on_actionQuit_triggered()));

    shortcut = new QShortcut(QKeySequence("ctrl+tab"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(switchToNextTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+shift+tab"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(switchToPrevTab()));

    shortcut = new QShortcut(QKeySequence("ctrl+d"), ui->tabWidget);
    QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(deleteLine()));
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_value_le_textEdited((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: on_actionQuit_triggered(); break;
        case 2: on_operation_cb_activated((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: on_param_cb_activated((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 4: on_setparam_pb_clicked(); break;
        case 5: on_module_cb_activated((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
Exemple #7
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: horizontalSliderValueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: btnAddClicked(); break;
        case 2: btnRemoveClicked(); break;
        case 3: btnResizeClicked(); break;
        case 4: btnSelectOutDirClicked(); break;
        case 5: on_actionHelp_triggered(); break;
        case 6: on_actionAbout_triggered(); break;
        case 7: on_actionQuit_triggered(); break;
        default: ;
        }
        _id -= 8;
    }
    return _id;
}
Exemple #8
0
void MenuBar::makeConnections()
{
	printf("connected");
	connect(actionall_EDP_Load, SIGNAL(triggered()), this, SLOT(on_actionall_EDP_Load_triggered()), Qt::QueuedConnection);
	connect(actionall_EDP_Unload, SIGNAL(triggered()), this, SLOT(on_actionall_EDP_Unload_triggered()), Qt::QueuedConnection);
	connect(actionall_Synchronisation, SIGNAL(triggered()), this, SLOT(on_actionall_Synchronisation_triggered()), Qt::QueuedConnection);
	connect(actionall_Synchro_Position, SIGNAL(triggered()), this, SLOT(on_actionall_Synchro_Position_triggered()), Qt::QueuedConnection);
	connect(actionall_Front_Position, SIGNAL(triggered()), this, SLOT(on_actionall_Front_Position_triggered()), Qt::QueuedConnection);
	connect(actionall_Position_0, SIGNAL(triggered()), this, SLOT(on_actionall_Position_0_triggered()), Qt::QueuedConnection);
	connect(actionall_Position_1, SIGNAL(triggered()), this, SLOT(on_actionall_Position_1_triggered()), Qt::QueuedConnection);
	connect(actionall_Position_2, SIGNAL(triggered()), this, SLOT(on_actionall_Position_2_triggered()), Qt::QueuedConnection);
	connect(actionMP_Load, SIGNAL(triggered()), this, SLOT(on_actionMP_Load_triggered()), Qt::QueuedConnection);
	connect(actionMP_Unload, SIGNAL(triggered()), this, SLOT(on_actionMP_Unload_triggered()), Qt::QueuedConnection);
	connect(actionProcess_Control, SIGNAL(triggered()), this, SLOT(on_actionProcess_Control_triggered()), Qt::QueuedConnection);
	connect(actionOpen_Configuration, SIGNAL(triggered()), this, SLOT(on_actionOpen_Configuration_triggered()), Qt::QueuedConnection);
	connect(actionReload_Configuration, SIGNAL(triggered()), this, SLOT(on_actionReload_Configuration_triggered()), Qt::QueuedConnection);
	connect(actionClear_Console, SIGNAL(triggered()), this, SLOT(on_actionClear_Console_triggered()), Qt::QueuedConnection);
	connect(actionUnload_All, SIGNAL(triggered()), this, SLOT(on_actionUnload_All_triggered()), Qt::QueuedConnection);
	connect(actionSlay_All, SIGNAL(triggered()), this, SLOT(on_actionSlay_All_triggered()), Qt::QueuedConnection);
	connect(actionQuit, SIGNAL(triggered()), this, SLOT(on_actionQuit_triggered()), Qt::QueuedConnection);
}
/**
  * Create menu for mac
  */
void BursarApp::createMacStyleMenu()
{
    // create menu
    m_menuBar = new QMenuBar();

    // add file menu
    QMenu *fileMenu = m_menuBar->addMenu(tr("&File"));
    QAction *actionNew = fileMenu->addAction(tr("&New..."));
    QAction *actionOpen = fileMenu->addAction(tr("&Open..."));
    QAction *actionQuit = fileMenu->addAction(tr("&Quit"));

    // add help menu
    QMenu *helpMenu = m_menuBar->addMenu(tr("&Help"));
    QAction *actionAbout = helpMenu->addAction(tr("About %1").arg(APP_NAME));
    QAction *actionAboutQt = helpMenu->addAction(tr("About Qt"));

    // connect signals to slots
    connect(actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew_triggered()));
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered()));
    connect(actionQuit, SIGNAL(triggered()), this, SLOT(on_actionQuit_triggered()));
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(on_actionAbout_triggered()));
    connect(actionAboutQt, SIGNAL(triggered()), this, SLOT(on_actionAboutQt_triggered()));
}
void MainWindow::closeEvent(QCloseEvent *event)
{
	if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
	    ui.InfoWidget->isEditing()) {
		on_actionQuit_triggered();
		event->ignore();
		return;
	}

#ifndef NO_USERMANUAL
	if (helpView && helpView->isVisible()) {
		helpView->close();
		helpView->deleteLater();
	}
#endif

	if (unsaved_changes() && (askSaveChanges() == false)) {
		event->ignore();
		return;
	}
	event->accept();
	writeSettings();
	QApplication::closeAllWindows();
}
Exemple #11
0
ishara::ishara(QWidget *parent) : QMainWindow(parent), ui(new Ui::ishara) {

  if (QSystemTrayIcon::isSystemTrayAvailable()) {
      /*
       * init system tray
       */
      maximizeAction = new QAction(tr("&Show"), this);
      connect(maximizeAction, SIGNAL(triggered()), this, SLOT(show()));
      quitAction = new QAction(tr("&Quit"), this);
      connect(quitAction, SIGNAL(triggered()), this, SLOT(on_actionQuit_triggered()));

      startStopAction = new QAction(tr("S&tart"), this);
      connect(startStopAction, SIGNAL(triggered()), this, SLOT(startStop()));

      trayIconMenu = new QMenu(this);
      trayIconMenu->addAction(maximizeAction);
      trayIconMenu->addSeparator();
      trayIconMenu->addAction(startStopAction);
      trayIconMenu->addSeparator();
      trayIconMenu->addAction(quitAction);
      trayIcon = new QSystemTrayIcon(this);
      trayIcon->setContextMenu(trayIconMenu);

      connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
      const QIcon *icon = new QIcon(":/prefix1/res/ishara.ico");
      trayIcon->setIcon(*icon);
      trayIcon->hide();
    }

  /*
   * initializing some variables from the configuration file
   */
  settings.sync();

  hMin1 = settings.value("hMin1", 0).toInt();
  hMax1 = settings.value("hMax1", 179).toInt();
  sMin1 = settings.value("sMin1", 0).toInt();
  sMax1 = settings.value("sMax1", 255).toInt();
  vMin1 = settings.value("vMin1", 0).toInt();
  vMax1 = settings.value("vMax1", 255).toInt();

  hMin2 = settings.value("hMin2", 0).toInt();
  hMax2 = settings.value("hMax2", 179).toInt();
  sMin2 = settings.value("sMin2", 0).toInt();
  sMax2 = settings.value("sMax2", 255).toInt();
  vMin2 = settings.value("vMin2", 0).toInt();
  vMax2 = settings.value("vMax2", 255).toInt();

  pinchR = settings.value("pinchR", 66).toInt();
  rightClickDealy = settings.value("rightClickDealy", 20).toInt();
  smoothFac = settings.value("smoothFac", 8).toInt();

  cfgScroll = settings.value("cfgScroll", 2).toInt();
  cfgLClick = settings.value("cfgLClick", 2).toInt();
  cfgRClick = settings.value("cfgRClick", 2).toInt();

  /*
   * initializing some more variables
   */
  CAM_INDEX = -1;
  mcorInit_X = 0;
  mcorInit_Y = 0;
  msPoint_X = 0;
  msPoint_Y = 0;
  xScreenHeight = 0;
  xScreenWidth = 0;
  startEmulation = 0;
  motionEnable = 0;
  tmpX = 0;
  tmpY = 0;
  waitCountRC = 0;
  pinch = 0;
  ifScrollUp = 0;
  ifScrollDwn = 0;
  btnPress = 1;
  btnRel = 1;
  devSelActive = 0;
  iteration = 0;

  /*
   * setting up the user interface
   */
  ui->setupUi(this);

  /*
   * setting up smoothness factor slider; smoothness factor is the maximum allowable
   * distance the index finger can move without effecting any change in the mouse
   * cursor position; a reasonable value for this would be 6 to 8 depending on the user
   */
  ui->sliderSmoothFac->setRange(2, 12);
  ui->sliderSmoothFac->setValue(smoothFac);

  /*
   * setting up color selection sliders; the HSV range for the two color markers to be
   * detected are set using these sliders
   */
  ui->sliderHMin1->setRange(0, 179);
  ui->sliderHMax1->setRange(0, 179);
  ui->sliderSMin1->setRange(0, 255);
  ui->sliderSMax1->setRange(0, 255);
  ui->sliderVMin1->setRange(0, 255);
  ui->sliderVMax1->setRange(0, 255);

  ui->sliderHMin2->setRange(0, 179);
  ui->sliderHMax2->setRange(0, 179);
  ui->sliderSMin2->setRange(0, 255);
  ui->sliderSMax2->setRange(0, 255);
  ui->sliderVMin2->setRange(0, 255);
  ui->sliderVMax2->setRange(0, 255);

  ui->sliderHMin1->setValue(hMin1);
  ui->sliderHMax1->setValue(hMax1);
  ui->sliderSMin1->setValue(sMin1);
  ui->sliderSMax1->setValue(sMax1);
  ui->sliderVMin1->setValue(vMin1);
  ui->sliderVMax1->setValue(vMax1);

  ui->sliderHMin2->setValue(hMin2);
  ui->sliderHMax2->setValue(hMax2);
  ui->sliderSMin2->setValue(sMin2);
  ui->sliderSMax2->setValue(sMax2);
  ui->sliderVMin2->setValue(vMin2);
  ui->sliderVMax2->setValue(vMax2);

  /*
   * setting up color selection spinboxes; the values determining the HSV range can
   * also be altered using the spin boxes
   */
  ui->spnHMin1->setRange(0, 179);
  ui->spnHMax1->setRange(0, 179);
  ui->spnSMin1->setRange(0, 255);
  ui->spnSMax1->setRange(0, 255);
  ui->spnVMin1->setRange(0, 255);
  ui->spnVMax1->setRange(0, 255);

  ui->spnHMin2->setRange(0, 179);
  ui->spnHMax2->setRange(0, 179);
  ui->spnSMin2->setRange(0, 255);
  ui->spnSMax2->setRange(0, 255);
  ui->spnVMin2->setRange(0, 255);
  ui->spnVMax2->setRange(0, 255);

  ui->spnHMin1->setValue(hMin1);
  ui->spnHMax1->setValue(hMax1);
  ui->spnSMin1->setValue(sMin1);
  ui->spnSMax1->setValue(sMax1);
  ui->spnVMin1->setValue(vMin1);
  ui->spnVMax1->setValue(vMax1);

  ui->spnHMin2->setValue(hMin2);
  ui->spnHMax2->setValue(hMax2);
  ui->spnSMin2->setValue(sMin2);
  ui->spnSMax2->setValue(sMax2);
  ui->spnVMin2->setValue(vMin2);
  ui->spnVMax2->setValue(vMax2);

  /*
   * setting up pinchR slider; the pinchR variable determines the maximum distance
   * between the center co-ordinates of the two color markers when detecting a Pinch
   */
  ui->sliderPinchR->setRange(10, 120);
  ui->sliderPinchR->setValue(pinchR);

  /*
   * setting up pinchR spinbox; the value of pinchR can also be altered using a spinbox
   */
  ui->spnPinchR->setRange(10, 120);
  ui->spnPinchR->setValue(pinchR);

  /*
   * setting up rightClickDealy slider; the variables rightClickDealy
   * determines the loop count while determining a right click
   */
  ui->sliderRCRC->setRange(10, 30);
  ui->sliderRCRC->setValue(rightClickDealy);

  /*
   * setting up rightClickDealy spinbox, the usage is obvious
   */
  ui->spnRCRC->setRange(10, 30);
  ui->spnRCRC->setValue(rightClickDealy);

  /*
   * setting up check boxes to enable/disable functionalities
   */
  if(cfgScroll > 0) {
      ui->chkEnableScroll->setChecked(true);
    }
  else {
      ui->chkEnableScroll->setChecked(false);
    }

  if(cfgLClick > 0) {
      ui->chkEnableLeftClick->setChecked(true);
    }
  else {
      ui->chkEnableLeftClick->setChecked(false);
    }

  if(cfgRClick > 0) {
      ui->chkEnableRightClick->setChecked(true);
    }
  else {
      ui->chkEnableRightClick->setChecked(false);
    }

  /*
   * camera selection in Linux
   */
  for(deviceIndex = 0 ; deviceIndex < 64 ; ++deviceIndex) {
      QString device = "/dev/video" + QString::number(deviceIndex);
      QByteArray array = device.toLocal8Bit();
      char *buffer = array.data();
      if((fd = open(buffer, O_RDONLY)) != -1) {
          if(ioctl(fd, VIDIOC_QUERYCAP, &vidiocap) == -1) {
              ui->comboSelectCam->addItem(device);
            }
          else {
              ui->comboSelectCam->addItem(QString::fromLocal8Bit(reinterpret_cast<const char*>(vidiocap.card)));
            }
          if(CAM_INDEX == -1) {
              CAM_INDEX = deviceIndex;
            }
        }
    }

  /*
   * camera operations
   */
  camOpen();

  capture.read(src);
  if(src.empty() == true) {
      ui->statusBar->showMessage("Read error!");
      return;
    }

  /*
   * get the screen size
   */
  getxScreenSize();

  /*
   * time warp - make it so
   */
  timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(processFrameAndUpdateGUI()));
  timer->start(20);

  /*
   * clean up the crap
   */
  src.release();
  frame.release();
  imgHSV.release();
}