/* ����������������������������������������������������������������������� */ void enableFallingAsleepMode(void) { menuExit(); if(time > 0) { //Set variable of mode to 1, falling asleep mode enabled fallingAsleepMode = 1; //Set falling asleep time to 1 hour fallingAsleepTime = 60; //Create the thread for falling asleep NutThreadCreate("FallingAsleep", FallingAsleep, NULL, 1024); } }
/** * @brief Dialog::initTray * 初始化托盘 */ void Dialog::initTray() { QMenu *contexmenu = new QMenu(this); //注意右键菜单的父对象,在窗口销毁后要把菜单也销毁掉 QAction *shut = new QAction(QStringLiteral("退出"),this); //菜单中两个动作 QAction *openNomal = new QAction(QStringLiteral("正常显示"),this); QAction *qqmsg = new QAction(QStringLiteral("QQ消息"),this); contexmenu->addAction(openNomal); contexmenu->addSeparator(); contexmenu->addAction(qqmsg); contexmenu->addSeparator(); contexmenu->addAction(shut); connect(shut, SIGNAL(triggered()), this, SLOT(menuExit())); //点击了这两个菜单 connect(openNomal, SIGNAL(triggered()), this, SLOT(showNormal())); connect(qqmsg, SIGNAL(triggered()), this, SLOT(qq_msg_com())); tray = new QSystemTrayIcon(this); tray->setToolTip("try to click"); //放在图表上时候显示 tray->setContextMenu(contexmenu); tray->setIcon(QIcon(":/image/icon.png")); tray->show(); connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason))); connect(tray, SIGNAL(messageClicked()), this, SLOT(showClickMsg())); //模拟QQ消息到来时候的闪烁图表 }
GameScene::GameScene(QWidget *parent) : QGraphicsScene(parent), myLock(false) { inputDisabled = true; dconfirm = new ConfirmDialog(); addWidget(dconfirm, Qt::FramelessWindowHint); dconfirm->hide(); menu = new MenuWidget(); addWidget(menu); menu->activate(); connect(menu, SIGNAL(menuNew()), this, SLOT(on_menuNew())); connect(menu, SIGNAL(menuContinue()), this, SLOT(on_menuContinue())); connect(menu, SIGNAL(menuExit()), this, SLOT(on_menuExit())); connect(menu, SIGNAL(menuPauseBack()), this, SLOT(on_menuPauseBack())); connect(menu, SIGNAL(menuRestartLevel()), this, SLOT(on_menuRestartLevel())); connect(menu, SIGNAL(menuAbandonGame()), this, SLOT(on_menuAbandonGame())); connect(menu, SIGNAL(menuThemeChanged()), this, SLOT(on_menuThemeChanged())); connect(menu, SIGNAL(menuGameStart()), this, SLOT(on_menuGameStart())); connect(menu, SIGNAL(menuLevelPack()), this, SLOT(on_menuLevelPack())); stat = new StatInfo(); connect(gameProfile, SIGNAL(profileChanged()), this, SLOT(initProfile())); rows = cols = 0; xoff = 20; yoff = 10; advanceTimer = new QTimer(this); advanceTimer->setInterval(30); connect(advanceTimer, SIGNAL(timeout()), this, SLOT(nextCycle())); timeTimer = new QTimer(this); timeTimer->setInterval(1000); connect(timeTimer, SIGNAL(timeout()), this, SLOT(countTime())); bonusTimer = new QTimer(this); bonusTimer->setInterval(500); connect(bonusTimer, SIGNAL(timeout()), this, SLOT(countBonusTime())); hintTimer = new QTimer(this); hintTimer->setInterval(10000); connect(hintTimer, SIGNAL(timeout()), this, SLOT(hintAvailableMoves())); // init components GameStock::init(); toolset = new ToolSet(); gameBonus = new GameBonus(); setSceneRect(0,0, WIDTH, HEIGHT); // set background gameBackground = new GameBackground(); setBackgroundBrush(Qt::black); setDefaultGameCursor(); // update max level for current pack max_level = gameProfile->levelPackCount(gameProfile->currentLevelPack()); // very first initialization initGame(); }
void MenuWidget::on_bExit_clicked() { emit menuExit(); }