void Gui::executeMenuCommand(int action, Common::String &text) { switch(action) { case kMenuActionAbout: case kMenuActionNew: case kMenuActionClose: case kMenuActionRevert: case kMenuActionQuit: break; case kMenuActionOpen: _engine->scummVMSaveLoadDialog(false); break; case kMenuActionSave: case kMenuActionSaveAs: _engine->scummVMSaveLoadDialog(true); break; case kMenuActionUndo: actionUndo(); break; case kMenuActionCut: actionCut(); break; case kMenuActionCopy: actionCopy(); break; case kMenuActionPaste: actionPaste(); break; case kMenuActionClear: actionClear(); break; case kMenuActionCommand: _engine->processTurn(&text, NULL); break; default: warning("Unknown action: %d", action); } }
SharedPainter::SharedPainter(CSharedPainterScene *canvas, QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags), canvas_(canvas), currPaintItemId_(1), currPacketId_(-1), resizeFreezingFlag_(false), screenShotMode_(false), wroteProgressBar_(NULL) { ui.setupUi(this); ui.painterView->setScene( canvas ); canvas_->setEvent( this ); SharePaintManagerPtr()->registerObserver( this ); SharePaintManagerPtr()->setCanvas( canvas_ ); QMenuBar *menuBar = ui.menuBar; // Create Menu bar item { // File Menu QMenu* file = new QMenu( "&File", menuBar ); file->addAction( "&Connect", this, SLOT(actionConnect()), Qt::CTRL+Qt::Key_N ); file->addAction( "&Broadcast Channel", this, SLOT(actionBroadcastChannel()), Qt::CTRL+Qt::Key_H ); QMenu* broadCastTypeMenu = file->addMenu( "BroadCast Type" ); broadCastTypeMenu->addAction( "&Server", this, SLOT(actionServerType()), Qt::CTRL+Qt::Key_1 ); broadCastTypeMenu->addAction( "&Client", this, SLOT(actionClientType()), Qt::CTRL+Qt::Key_2 ); file->addSeparator(); file->addAction( "E&xit", this, SLOT(actionExit()), Qt::CTRL+Qt::Key_Q ); menuBar->addMenu( file ); // Edit Menu QMenu* edit = new QMenu( "&Edit", menuBar ); QMenu* penMenu = edit->addMenu( "Pen Setting" ); penMenu->addAction( "Pen &Width", this, SLOT(actionPenWidth()), Qt::CTRL+Qt::Key_V ); penMenu->addAction( "Pen &Color", this, SLOT(actionPenColor()), Qt::CTRL+Qt::Key_C ); penModeAction_ = edit->addAction( "Pen Mode", this, SLOT(actionPenMode()), Qt::CTRL+Qt::Key_A ); penModeAction_->setCheckable( true ); edit->addAction( "&Text", this, SLOT(actionAddText()), Qt::Key_Enter|Qt::Key_Return ); edit->addAction( "&Screen Shot", this, SLOT(actionScreenShot()), Qt::CTRL+Qt::Key_S ); edit->addSeparator(); edit->addAction( "Clear &Background Image", this, SLOT(actionClearBGImage()), Qt::CTRL+Qt::Key_B ); edit->addAction( "Cl&ear Screen", this, SLOT(actionClearScreen()), Qt::CTRL+Qt::Key_X ); edit->addSeparator(); edit->addAction( "&Undo", this, SLOT(actionUndo()), Qt::CTRL+Qt::Key_Z ); menuBar->addMenu( edit ); } // create status bar { statusBarLabel_ = new QLabel(); broadCastTypeLabel_ = new QLabel(); joinerCountLabel_ = new QLabel(); wroteProgressBar_ = new QProgressBar(); ui.statusBar->addPermanentWidget( broadCastTypeLabel_ ); ui.statusBar->addPermanentWidget( joinerCountLabel_, 1 ); ui.statusBar->addPermanentWidget( wroteProgressBar_ ); ui.statusBar->addPermanentWidget( statusBarLabel_ ); setStatusBar_Network( tr("Not Connected") ); setStatusBar_BroadCastType( tr("None Type") ); setStatusBar_JoinerCnt( 1 ); // my self } ui.painterView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui.painterView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setCursor( Qt::ArrowCursor ); // Pen mode activated.. penModeAction_->setChecked( true ); actionPenMode(); // Key Hooking Timer keyHookTimer_ = new QTimer(this); keyHookTimer_->start(20); connect(keyHookTimer_, SIGNAL(timeout()),this, SLOT(onTimer())); installEventFilter(this); // Title QString orgTitle = windowTitle(); QString newTitle = orgTitle; newTitle += " Ver "; newTitle += VERSION_TEXT; newTitle += ", "; newTitle += AUTHOR_TEXT; setWindowTitle( newTitle ); }