From ccd6058412dcf17df31d64b16297f1231387445c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 17 Dec 2013 13:55:17 -0800 Subject: [PATCH] get abstract menu class to work --- assignment-client/CMakeLists.txt | 11 ---------- assignment-client/src/Agent.cpp | 9 -------- interface/src/Menu.cpp | 8 +++---- interface/src/Menu.h | 4 ++-- libraries/shared/CMakeLists.txt | 3 --- libraries/shared/src/AbstractMenuInterface.h | 22 ++++++++++---------- 6 files changed, 17 insertions(+), 40 deletions(-) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 1d2fb866bb..9df3f2455a 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -10,23 +10,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH}) -find_package(Qt5Core REQUIRED) -find_package(Qt5Gui REQUIRED) find_package(Qt5Network REQUIRED) -#find_package(Qt5Multimedia REQUIRED) -#find_package(Qt5Network REQUIRED) -#find_package(Qt5OpenGL REQUIRED) -#find_package(Qt5Svg REQUIRED) -#find_package(Qt5WebKit REQUIRED) -#find_package(Qt5WebKitWidgets REQUIRED) - - include(${MACRO_DIR}/SetupHifiProject.cmake) setup_hifi_project(${TARGET_NAME} TRUE) qt5_use_modules(${TARGET_NAME} Network) -qt5_use_modules(${TARGET_NAME} Gui) # include glm include(${MACRO_DIR}/IncludeGLM.cmake) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 9fbe464a9e..a5fc32881f 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -78,19 +78,10 @@ void Agent::run() { QString scriptContents(reply->readAll()); qDebug() << "Downloaded script:" << scriptContents << "\n"; - QScriptValue result = engine.evaluate(scriptContents); - qDebug() << "Evaluated script.\n"; - - if (engine.hasUncaughtException()) { - int line = engine.uncaughtExceptionLineNumber(); - qDebug() << "Uncaught exception at line" << line << ":" << result.toString() << "\n"; - } timeval startTime; gettimeofday(&startTime, NULL); - int thisFrame = 0; - QTimer* domainServerTimer = new QTimer(this); connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit())); domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_USECS / 1000); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index d81e22d818..20afe38e67 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -689,10 +689,10 @@ void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString& QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, const QString actionName, - const QKeySequence& shortcut, + const QKEYSEQUENCE& shortcut, const QObject* receiver, const char* member, - QAction::MenuRole role) { + QACTION_MENUROLE role) { QAction* action; if (receiver && member) { @@ -701,7 +701,7 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, action = destinationMenu->addAction(actionName); action->setShortcut(shortcut); } - action->setMenuRole(role); + action->setMenuRole((QAction::MenuRole)role); _actionHash.insert(actionName, action); @@ -714,7 +714,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, const bool checked, const QObject* receiver, const char* member) { - QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, shortcut, receiver, member); + QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, (QKEYSEQUENCE&)shortcut, receiver, member); action->setCheckable(true); action->setChecked(checked); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index b62f49abe4..f896423b00 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -76,10 +76,10 @@ public: virtual QMenu* getActiveScriptsMenu() { return _activeScriptsMenu;} virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu, const QString actionName, - const QKeySequence& shortcut = 0, + const QKEYSEQUENCE& shortcut = 0, const QObject* receiver = NULL, const char* member = NULL, - QAction::MenuRole role = QAction::NoRole); + QACTION_MENUROLE role = NO_ROLE); virtual void removeAction(QMenu* menu, const QString& actionName); public slots: diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index 8de7e3f594..8c05b1ff8f 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -6,15 +6,12 @@ set(MACRO_DIR ${ROOT_DIR}/cmake/macros) set(TARGET_NAME shared) project(${TARGET_NAME}) -find_package(Qt5Core REQUIRED) -find_package(Qt5Gui REQUIRED) find_package(Qt5Network REQUIRED) include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) qt5_use_modules(${TARGET_NAME} Network) -qt5_use_modules(${TARGET_NAME} Gui) # include GLM include(${MACRO_DIR}/IncludeGLM.cmake) diff --git a/libraries/shared/src/AbstractMenuInterface.h b/libraries/shared/src/AbstractMenuInterface.h index c3857c456a..39c378f40b 100644 --- a/libraries/shared/src/AbstractMenuInterface.h +++ b/libraries/shared/src/AbstractMenuInterface.h @@ -10,26 +10,26 @@ #ifndef __hifi__AbstractMenuInterface__ #define __hifi__AbstractMenuInterface__ -#include -//#include -//#include +class QMenu; +class QString; +class QObject; +class QKeySequence; +class QAction; -//class QMenu; -//class QString; -//class QObject; -//class QKeySequence; -//class QAction; -//extern enum QAction::MenuRole; +// these are actually class scoped enums, but we don't want to depend on the class for this abstract interface +const int NO_ROLE = 0; +typedef int QACTION_MENUROLE; +typedef int QKEYSEQUENCE; class AbstractMenuInterface { public: virtual QMenu* getActiveScriptsMenu() = 0; virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu, const QString actionName, - const QKeySequence& shortcut = 0, + const QKEYSEQUENCE& shortcut = 0, const QObject* receiver = NULL, const char* member = NULL, - QAction::MenuRole role = QAction::NoRole) = 0; + QACTION_MENUROLE role = NO_ROLE) = 0; virtual void removeAction(QMenu* menu, const QString& actionName) = 0; };