Beispiel #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_loggedIn(false)
{
    ui->setupUi(this);
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->email, SIGNAL(textEdited(QString)), this, SLOT(updateEmail()));
    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addCash()));
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(exit()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
    connect(ui->killKid, SIGNAL(clicked()), this, SLOT(killKid()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveData()));
    connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(findCash()));
    connect(ui->fileDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(displayInfo2()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportTab()));
    connect(ui->studentSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(displayInfo()));
    connect(ui->deleteCurrency, SIGNAL(clicked()), this, SLOT(removeCash()));
    connect(ui->loginButton, SIGNAL(clicked()), this, SLOT(login()));


    ui->actionAbout->setIcon(QIcon("questionface.xpm"));
    setWindowIcon(QIcon("btemp.xpm"));

    checkForSaveFile();
    checkForPasswordFile();

    addCashWindow = new CashWindow();
    addCashWindow->setWindowIcon(QIcon("btemp.xpm"));
    addCashWindow->setWindowTitle("Add Cash");

    connect(addCashWindow, SIGNAL(newKid()), this , SLOT(addCashFromWindow()));

    loginWindow = new UserWindow(0, true);
    loginWindow->setWindowIcon(QIcon("btemp.xpm"));

    connect(loginWindow, SIGNAL(unlockCash(QString,QString)), this, SLOT(tryUnlock(QString,QString)));
    //connect(loginWindow, SIGNAL(createAccount(QString,QString)), this, SLOT(makeAccount(QString,QString)));
}
Beispiel #2
0
bool ScanTreeEventListener::eventFilter(QObject*, QEvent* ev) {
  if (ev->type() == QEvent::KeyRelease) {
    QKeyEvent* keyEvent = static_cast<QKeyEvent*>(ev);

    if (keyEvent->key() == Qt::Key_Escape) {
      if (mainUi->getScanState() == UiState::Editing) {
        tryUnlock(*mainUi->scanUpdateMutex);
        mainUi->setScanState(UiState::Idle);
      }
    }

    if (keyEvent->key() == Qt::Key_F2) {
      QWidget* focused = mainUi->mainWindow->focusWidget()->parentWidget()->parentWidget(); // When the TreeView item value is selected, the TreeView will be the grandparent of the editing
      if (focused == treeView) {
        QModelIndex index = treeView->currentIndex();
        if (index.column() == SCAN_COL_VALUE && mainUi->getScanState() == UiState::Idle) {
          mainUi->scanUpdateMutex->lock();
          mainUi->setScanState(UiState::Editing);
        }
      }
    }
  }
  return false;
}