Пример #1
0
void Clock::initMenu()
{
    alwaysOnTopAct = new QAction(tr("Always On Top"), this);
    alwaysOnTopAct->setStatusTip(tr("Stay on top of all other windows"));
    alwaysOnTopAct->setCheckable(true);
    connect(alwaysOnTopAct, SIGNAL(triggered()), this, SLOT(setAlwaysOnTopSlot()));

    settingsAct = new QAction(tr("Settings"), this);
    settingsAct->setShortcut(tr("Dbl Click"));
    settingsAct->setStatusTip(tr("Binary Clock Settings"));
    connect(settingsAct, SIGNAL(triggered()), this, SLOT(openSettingsDialog()));

    aboutAct = new QAction(tr("About"), this);
    aboutAct->setStatusTip(tr("About Binary Clock"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(showAbout()));

    exitAct = new QAction(tr("Exit"), this);
    exitAct->setShortcut(tr("Alt+F4"));
    exitAct->setStatusTip(tr("Exit the binary clock"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    contextMenu = new QMenu();
    contextMenu->addAction(alwaysOnTopAct);
    contextMenu->addSeparator();
    contextMenu->addAction(settingsAct);
    contextMenu->addAction(aboutAct);
    contextMenu->addSeparator();
    contextMenu->addAction(exitAct);
}
Пример #2
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , m_ui(new Ui::MainWindow)
    , m_model(0)
    , m_controller(0)

{
    // instantiate settings once here
    new Settings(this);

    // acces them later on via instance()
    /*Settings* s = Settings::instance();

    qDebug() << "***** Current settings *****";
    qDebug() << "Player name" << s->playerName();
    qDebug() << "Player color" << s->playerColor();
    qDebug();
    qDebug() << "AI name" << s->aiName();
    qDebug() << "AI color" << s->aiColor();
    qDebug() << "AI level" << s->aiLevel();
    qDebug();*/

    m_ui->setupUi(this);
    m_ui->statusbar->setVisible(false);

    //connect actions to functions
    connect(m_ui->actionExit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit()));
    connect(m_ui->action640x480, SIGNAL(triggered()), this, SLOT(resolutionChange()));
    connect(m_ui->action800x600, SIGNAL(triggered()), this, SLOT(resolutionChange()));
    connect(m_ui->action1920x1080, SIGNAL(triggered()), this, SLOT(resolutionChange()));
    connect(m_ui->actionPlayer, SIGNAL(triggered()), this, SLOT(openSettingsDialog()));
    connect(m_ui->actionNew_Game, SIGNAL(triggered()), this, SLOT(newGame()));

    connect(m_ui->actionQuicksave, SIGNAL(triggered()), this, SLOT(quickSave()));
    connect(m_ui->actionQuickload, SIGNAL(triggered()), this, SLOT(quickLoad()));
    connect(m_ui->actionImpressum_2, SIGNAL(triggered()), this, SLOT(showImpressum()));
    connect(m_ui->actionHow_to_play, SIGNAL(triggered()), this, SLOT(showRules()));

    setupGame();
}
Пример #3
0
void Clock::mouseDoubleClickEvent(QMouseEvent * event)
{
    if (event->button() == Qt::LeftButton) {
        openSettingsDialog();
    }
}