mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-06 01:13:10 +02:00
get abstract menu class to work
This commit is contained in:
parent
5c946090db
commit
ccd6058412
6 changed files with 17 additions and 40 deletions
|
@ -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})
|
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(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)
|
include(${MACRO_DIR}/SetupHifiProject.cmake)
|
||||||
setup_hifi_project(${TARGET_NAME} TRUE)
|
setup_hifi_project(${TARGET_NAME} TRUE)
|
||||||
|
|
||||||
qt5_use_modules(${TARGET_NAME} Network)
|
qt5_use_modules(${TARGET_NAME} Network)
|
||||||
qt5_use_modules(${TARGET_NAME} Gui)
|
|
||||||
|
|
||||||
# include glm
|
# include glm
|
||||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||||
|
|
|
@ -78,19 +78,10 @@ void Agent::run() {
|
||||||
QString scriptContents(reply->readAll());
|
QString scriptContents(reply->readAll());
|
||||||
|
|
||||||
qDebug() << "Downloaded script:" << scriptContents << "\n";
|
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;
|
timeval startTime;
|
||||||
gettimeofday(&startTime, NULL);
|
gettimeofday(&startTime, NULL);
|
||||||
|
|
||||||
int thisFrame = 0;
|
|
||||||
|
|
||||||
QTimer* domainServerTimer = new QTimer(this);
|
QTimer* domainServerTimer = new QTimer(this);
|
||||||
connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
|
connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
|
||||||
domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_USECS / 1000);
|
domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_USECS / 1000);
|
||||||
|
|
|
@ -689,10 +689,10 @@ void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString&
|
||||||
|
|
||||||
QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const QString actionName,
|
const QString actionName,
|
||||||
const QKeySequence& shortcut,
|
const QKEYSEQUENCE& shortcut,
|
||||||
const QObject* receiver,
|
const QObject* receiver,
|
||||||
const char* member,
|
const char* member,
|
||||||
QAction::MenuRole role) {
|
QACTION_MENUROLE role) {
|
||||||
QAction* action;
|
QAction* action;
|
||||||
|
|
||||||
if (receiver && member) {
|
if (receiver && member) {
|
||||||
|
@ -701,7 +701,7 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
action = destinationMenu->addAction(actionName);
|
action = destinationMenu->addAction(actionName);
|
||||||
action->setShortcut(shortcut);
|
action->setShortcut(shortcut);
|
||||||
}
|
}
|
||||||
action->setMenuRole(role);
|
action->setMenuRole((QAction::MenuRole)role);
|
||||||
|
|
||||||
_actionHash.insert(actionName, action);
|
_actionHash.insert(actionName, action);
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const bool checked,
|
const bool checked,
|
||||||
const QObject* receiver,
|
const QObject* receiver,
|
||||||
const char* member) {
|
const char* member) {
|
||||||
QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, shortcut, receiver, member);
|
QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, (QKEYSEQUENCE&)shortcut, receiver, member);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(checked);
|
action->setChecked(checked);
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,10 @@ public:
|
||||||
virtual QMenu* getActiveScriptsMenu() { return _activeScriptsMenu;}
|
virtual QMenu* getActiveScriptsMenu() { return _activeScriptsMenu;}
|
||||||
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const QString actionName,
|
const QString actionName,
|
||||||
const QKeySequence& shortcut = 0,
|
const QKEYSEQUENCE& shortcut = 0,
|
||||||
const QObject* receiver = NULL,
|
const QObject* receiver = NULL,
|
||||||
const char* member = NULL,
|
const char* member = NULL,
|
||||||
QAction::MenuRole role = QAction::NoRole);
|
QACTION_MENUROLE role = NO_ROLE);
|
||||||
virtual void removeAction(QMenu* menu, const QString& actionName);
|
virtual void removeAction(QMenu* menu, const QString& actionName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -6,15 +6,12 @@ set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
|
||||||
set(TARGET_NAME shared)
|
set(TARGET_NAME shared)
|
||||||
project(${TARGET_NAME})
|
project(${TARGET_NAME})
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
|
||||||
find_package(Qt5Gui REQUIRED)
|
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
|
|
||||||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||||
setup_hifi_library(${TARGET_NAME})
|
setup_hifi_library(${TARGET_NAME})
|
||||||
|
|
||||||
qt5_use_modules(${TARGET_NAME} Network)
|
qt5_use_modules(${TARGET_NAME} Network)
|
||||||
qt5_use_modules(${TARGET_NAME} Gui)
|
|
||||||
|
|
||||||
# include GLM
|
# include GLM
|
||||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||||
|
|
|
@ -10,26 +10,26 @@
|
||||||
#ifndef __hifi__AbstractMenuInterface__
|
#ifndef __hifi__AbstractMenuInterface__
|
||||||
#define __hifi__AbstractMenuInterface__
|
#define __hifi__AbstractMenuInterface__
|
||||||
|
|
||||||
#include <QMenuBar>
|
class QMenu;
|
||||||
//#include <QHash>
|
class QString;
|
||||||
//#include <QKeySequence>
|
class QObject;
|
||||||
|
class QKeySequence;
|
||||||
|
class QAction;
|
||||||
|
|
||||||
//class QMenu;
|
// these are actually class scoped enums, but we don't want to depend on the class for this abstract interface
|
||||||
//class QString;
|
const int NO_ROLE = 0;
|
||||||
//class QObject;
|
typedef int QACTION_MENUROLE;
|
||||||
//class QKeySequence;
|
typedef int QKEYSEQUENCE;
|
||||||
//class QAction;
|
|
||||||
//extern enum QAction::MenuRole;
|
|
||||||
|
|
||||||
class AbstractMenuInterface {
|
class AbstractMenuInterface {
|
||||||
public:
|
public:
|
||||||
virtual QMenu* getActiveScriptsMenu() = 0;
|
virtual QMenu* getActiveScriptsMenu() = 0;
|
||||||
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const QString actionName,
|
const QString actionName,
|
||||||
const QKeySequence& shortcut = 0,
|
const QKEYSEQUENCE& shortcut = 0,
|
||||||
const QObject* receiver = NULL,
|
const QObject* receiver = NULL,
|
||||||
const char* member = 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;
|
virtual void removeAction(QMenu* menu, const QString& actionName) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue