diff --git a/configurationServer/gui/.ini b/configurationServer/gui/.ini new file mode 100644 index 0000000..81f777f --- /dev/null +++ b/configurationServer/gui/.ini @@ -0,0 +1,67 @@ +[General] +D2ModelWindowWasMaximized=true +LineType=-1 +OpenQRSProjectFileDialogLastDir=C:/TRIKStudio/examples +robotModel=3 +ResizeLabels=true +Autosave=true +showTitlesForRobots=false +DragArea=12 +PaletteIconsInARowCount=3 +PreferencesDialogLastPosition=@Point(225 23) +LabelsDistance=100 +toolbarSize=30 +ShowAlignment=true +ShowGrid=true +2dFollowingRobot=true +2dShowGrid=true +IndexGrid=25 +LoopEdgeBoundsIndent=1 +Splashscreen=true +recentProjectsLimit=0 +EmbeddedLinkerIndent=5 +port2SensorType=0 +temp=D:/proga/SummerSchool/qreal/bin/unsaved +touchMode=false +oldLineColor=magenta +D2ModelWindowLastPosition=@Point(-8 -8) +MoveLabels=true +pos=@Point(-8 -8) +EmbeddedLinkerSize=6 +version=3.0.0 \x3b1\x37 +CurrentIndex=0 +2d_displayVisible=true +autoscalingInterval=3000 +sensorUpdateInterval=50 +textUpdateInterval=500 +collectErgonomicValues=true +gestureDelay=1000 +ActivateGrid=true +Antialiasing=true +maximized=true +ActivateAlignment=true +tcpServer=192.168.1.8 +EditorsLoadedCount=1 +nxtFlashToolRunPolicy=0 +CustomFont=false +PaletteTabSwitching=true +2DModelRealisticPhysics=true +%U0414%U0438%U0430%U0433%U0440%U0430%U043C%U043C%U0430%20%U043F%U043E%U0432%U0435%U0434%U0435%U043D%U0438%U044F%20%U0440%U043E%U0431%U043E%U0442%U0430=true +valueOfCommunication=tcp +usabilityTestingMode=false +pathToImages=./images/iconset1 +bluetoothPortName= +PreferencesDialogLastSize=@Size(892 593) +2dCursorType=1 +recentProjects="C:\\Users\\Admin\\Downloads\\WFABTree (1).qrs;C:\\Users\\Admin\\Downloads\\125_97_2-___2_2.qrs;C:/TRIKStudio/examples/smiles.qrs;C:/TRIKStudio/examples/alongTheLineByCam.qrs;C:/TRIKStudio/examples/smile_wall.qrs;C:/TRIKStudio/examples/helloworld.qrs;C:/TRIKStudio/examples/thewall.qrs;C:/TRIKStudio/examples/simpleSayExample.qrs;" +PaletteRepresentation=false +enableNoiseOfSensors=false +D2ModelWindowLastSize=@Size(1366 706) +port1SensorType=0 +PreferencesDialogWasMaximized=false +enableNoiseOfMotors=false +GridWidth=10 +size=@Size(1366 706) +SelectedModelFortrikKit=TwoDRobotModelForTrikRealRobotModelV6 +AutosaveInterval=60 +PaintOldEdgeMode=true diff --git a/configurationServer/gui/brandManager/brandManager.cpp b/configurationServer/gui/brandManager/brandManager.cpp new file mode 100644 index 0000000..167af3c --- /dev/null +++ b/configurationServer/gui/brandManager/brandManager.cpp @@ -0,0 +1,51 @@ +#include "brandManager.h" + +using namespace qReal; + +BrandManager::BrandManager() + : mFonts(new Fonts) + , mStyles(new Styles(*mFonts)) +{ +} + +BrandManager::~BrandManager() +{ + delete mFonts; + delete mStyles; +} + +BrandManager &BrandManager::instance() +{ + static BrandManager instance; + return instance; +} + +//void BrandManager::configure(ToolPluginManager const *toolPluginManager) +//{ +// instance().mCustomizer = toolPluginManager->customizer(); +//} + +Fonts const *BrandManager::fonts() +{ + return instance().mFonts; +} + +Styles const *BrandManager::styles() +{ + return instance().mStyles; +} + +//QString BrandManager::applicationName() +//{ +// return instance().mCustomizer->windowTitle(); +//} + +//const QImage BrandManager::applicationLogo() +//{ +// return instance().mCustomizer->applicationLogo(); +//} + +//const QIcon BrandManager::applicationIcon() +//{ +// return instance().mCustomizer->applicationIcon(); +//} diff --git a/configurationServer/gui/brandManager/brandManager.h b/configurationServer/gui/brandManager/brandManager.h new file mode 100644 index 0000000..d7e96ee --- /dev/null +++ b/configurationServer/gui/brandManager/brandManager.h @@ -0,0 +1,44 @@ +#pragma once + +//#include "pluginManager/toolPluginManager.h" +#include "fonts.h" +#include "styles.h" + +namespace qReal { + +/// Provides information about everything about application appearance: fonts, styles and so on +class BrandManager +{ +public: + static BrandManager &instance(); + + /// Retrieves from plugins customization information +// static void configure(ToolPluginManager const *toolPluginManager); + + // TODO: Pluginize two following methods + + /// Returns information about all fonts in system + static Fonts const *fonts(); + + /// Returns information about all json stylesheets in system + static Styles const *styles(); + + /// Returns application`s name and probably version + static QString applicationName(); + + /// Returns application`s logo image in wide format + static QImage const applicationLogo(); + + /// Returns small application`s icon + static QIcon const applicationIcon(); + +private: + BrandManager(); + ~BrandManager(); + +// Customizer *mCustomizer; // Doesn`t take ownership + Fonts const *mFonts; // Takes ownership + Styles const *mStyles; // Takes ownership +}; + +} diff --git a/configurationServer/gui/brandManager/brandManager.pri b/configurationServer/gui/brandManager/brandManager.pri new file mode 100644 index 0000000..eb9773a --- /dev/null +++ b/configurationServer/gui/brandManager/brandManager.pri @@ -0,0 +1,11 @@ +HEADERS += \ + $$PWD/brandManager.h \ + $$PWD/fonts.h \ + $$PWD/styles.h \ + +SOURCES += \ + $$PWD/brandManager.cpp \ + +RESOURCES += \ + $$PWD/fonts/fonts.qrc \ + $$PWD/styles/styles.qrc \ diff --git a/configurationServer/gui/brandManager/fonts.h b/configurationServer/gui/brandManager/fonts.h new file mode 100644 index 0000000..a119919 --- /dev/null +++ b/configurationServer/gui/brandManager/fonts.h @@ -0,0 +1,65 @@ +#pragma once + +#include + +#include + +namespace qReal { + +/// A class for managing all used in system fonts +class Fonts +{ +public: + Fonts() + { + initTitlesFont(); + } + + virtual ~Fonts() + { + } + + /// Returns font for inline labels on scene + QFont sceneLabelsFont() const + { + return mTitlesFont; + } + + /// Returns a path to a font for inline labels on scene if other was not selected by user + virtual QString defaultSceneLabelsFont() const + { + return ":/fonts/Pfennig.ttf"; + } + + /// Returns a path to a font for a text on styled command buttons + virtual QString commandButtonsFont() const + { + return ":/fonts/Pfennig.ttf"; + } + + /// Returns a path to a font for a styled text, non-regular one + virtual QString styledTextFont() const + { + return ":/fonts/Pfennig.ttf"; + } + +private: + void initTitlesFont() + { + if (SettingsManager::value("CustomFont").toBool()) { + mTitlesFont.fromString(SettingsManager::value("CurrentFont").toString()); + } else { + int const fontId = QFontDatabase::addApplicationFont(defaultSceneLabelsFont()); + if (fontId != -1) { + mTitlesFont.fromString(QFontDatabase::applicationFontFamilies(fontId).at(0) + ",11,-1,5,50,0,0,0,0,0"); + } + } + } + + QFont mTitlesFont; + +}; + +} + +// Implemented in .h file for correct linkage diff --git a/configurationServer/gui/brandManager/fonts/Pfennig.ttf b/configurationServer/gui/brandManager/fonts/Pfennig.ttf new file mode 100644 index 0000000..bbbe463 Binary files /dev/null and b/configurationServer/gui/brandManager/fonts/Pfennig.ttf differ diff --git a/configurationServer/gui/brandManager/fonts/fonts.qrc b/configurationServer/gui/brandManager/fonts/fonts.qrc new file mode 100644 index 0000000..4400e66 --- /dev/null +++ b/configurationServer/gui/brandManager/fonts/fonts.qrc @@ -0,0 +1,5 @@ + + + Pfennig.ttf + + diff --git a/configurationServer/gui/brandManager/styles.h b/configurationServer/gui/brandManager/styles.h new file mode 100644 index 0000000..abb02e8 --- /dev/null +++ b/configurationServer/gui/brandManager/styles.h @@ -0,0 +1,151 @@ +#pragma once + +#include + +//#include +#include "fonts.h" + +namespace qReal { + +/// Manages all json stylesheets in system +class Styles +{ +public: + explicit Styles(Fonts const &fonts) + : mFonts(fonts) + { + } + + virtual ~Styles() + { + } + + /// Returns json stylesheet for start tab background + virtual QString startTabBackgroundStyle() const + { + return nullptr; + // return utils::InFile::readAll(startTabBackgroundStylePath()); + } + + /// Returns json stylesheet for start tab substrate background + virtual QString startTabSubstrateBackgroundStyle() const + { + return nullptr; + // return utils::InFile::readAll(startTabSubstrateBackgroundStylePath()); + } + + /// Returns json stylesheet for start tab header background + virtual QString startTabHeaderBackgroundStyle() const + { + return nullptr; + // return utils::InFile::readAll(startTabHeaderBackgroundStylePath()); + } + + /// Returns json stylesheet for recent projects section background on start tab + virtual QString startTabRecentProjectsBackgroundStyle() const + { + return nullptr; + // return utils::InFile::readAll(startTabRecentProjectsBackgroundStylePath()); + } + + /// Returns json stylesheet for projects management section background on start tab + virtual QString startTabProjectsManagementBackgroundStyle() const + { + return nullptr; + // return utils::InFile::readAll(startTabProjectsManagementBackgroundStylePath()); + } + + /// Returns json stylesheet for command buttons on start tab + virtual QString startTabButtonStyle() const + { + return nullptr; + // return utils::InFile::readAll(startTabButtonStylePath()) + // .replace("@@FONT@@", mFonts.commandButtonsFont()); + } + + /// Returns json stylesheet for styled text on start tab of level 1 heading + virtual QString startTabLabelLevel1Style() const + { + return nullptr; + // return utils::InFile::readAll(startTabLabelLevel1StylePath()) + // .replace("@@FONT@@", mFonts.styledTextFont()); + } + + /// Returns json stylesheet for styled text on start tab of level 2 heading + virtual QString startTabLabelLevel2Style() const + { + return nullptr; + // return utils::InFile::readAll(startTabLabelLevel2StylePath()) + // .replace("@@FONT@@", mFonts.styledTextFont()); + } + +protected: + /// Returns a path to a file with json stylesheet for start tab background + virtual QString startTabBackgroundStylePath() const + { + return processUrl(":/styles/startTab/background.js"); + } + + /// Returns a path to a file with json stylesheet for start tab substrate background + virtual QString startTabSubstrateBackgroundStylePath() const + { + return processUrl(":/styles/startTab/substrate.js"); + } + + /// Returns a path to a file with json stylesheet for start tab header background + virtual QString startTabHeaderBackgroundStylePath() const + { + return processUrl(":/styles/startTab/header.js"); + } + + /// Returns a path to a file with json stylesheet for recent projects section background on start tab + virtual QString startTabRecentProjectsBackgroundStylePath() const + { + return processUrl(":/styles/startTab/recentProjectsBackground.js"); + } + + /// Returns a path to a file with json stylesheet for projects management section background on start tab + virtual QString startTabProjectsManagementBackgroundStylePath() const + { + return processUrl(":/styles/startTab/projectsManagementBackground.js"); + } + + /// Returns a path to a file with json stylesheet for command buttons on start tab + virtual QString startTabButtonStylePath() const + { + return processUrl(":/styles/startTab/button.js"); + } + + /// Returns a path to a file with json stylesheet for styled text on start tab of level 1 heading + virtual QString startTabLabelLevel1StylePath() const + { + return processUrl(":/styles/startTab/labelLevel1.js"); + } + + /// Returns a path to a file with json stylesheet for styled text on start tab of level 2 heading + virtual QString startTabLabelLevel2StylePath() const + { + return processUrl(":/styles/startTab/labelLevel2.js"); + } + + /// Returns either given url without modifications or transforms it into absolute disk location + /// for more convenient styles debugging (modifications do not need rebuilds then) + QString processUrl(QString const &resourceUrl) const + { + // TODO: uncomment one of the next scenarious + + // Scenario one: use it for releases + return resourceUrl; + + // Scenario two: use it for debugging + // QString choppedString = resourceUrl; + // choppedString.remove(0, 1); + // return QApplication::applicationDirPath() + "/../qrgui/brandManager" + choppedString; + } + + Fonts const &mFonts; +}; + +} + +// Implemented in .h file for correct linkage diff --git a/configurationServer/gui/brandManager/styles/startTab/background.js b/configurationServer/gui/brandManager/styles/startTab/background.js new file mode 100644 index 0000000..93c36b8 --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/background.js @@ -0,0 +1 @@ +background-color: white; diff --git a/configurationServer/gui/brandManager/styles/startTab/button.js b/configurationServer/gui/brandManager/styles/startTab/button.js new file mode 100644 index 0000000..5ab45b0 --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/button.js @@ -0,0 +1,20 @@ +* { + background-color: transparent; + font-family:url(@@FONT@@); + color: black; + font: bold 20px; + text-align: left; +} + +QPushButton { + border-radius: 5px; + border-color: beige; +} + +QPushButton:hover, QPushButton:pressed { + color: rgb(110, 70, 156); +} + +QWidget[enabled="true"] { + color: rgb(110, 70, 156); +} diff --git a/configurationServer/gui/brandManager/styles/startTab/header.js b/configurationServer/gui/brandManager/styles/startTab/header.js new file mode 100644 index 0000000..5012a6d --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/header.js @@ -0,0 +1 @@ +background-color: rgb(110, 70, 156); \ No newline at end of file diff --git a/configurationServer/gui/brandManager/styles/startTab/labelLevel1.js b/configurationServer/gui/brandManager/styles/startTab/labelLevel1.js new file mode 100644 index 0000000..f8bd91f --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/labelLevel1.js @@ -0,0 +1,3 @@ +font-family: url(@@FONT@@); +font: bold 35px; +color: white; \ No newline at end of file diff --git a/configurationServer/gui/brandManager/styles/startTab/labelLevel2.js b/configurationServer/gui/brandManager/styles/startTab/labelLevel2.js new file mode 100644 index 0000000..2c56e7c --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/labelLevel2.js @@ -0,0 +1,3 @@ +font-family: url(@@FONT@@); +font: bold 28px; +color: black; \ No newline at end of file diff --git a/configurationServer/gui/brandManager/styles/startTab/projectsManagementBackground.js b/configurationServer/gui/brandManager/styles/startTab/projectsManagementBackground.js new file mode 100644 index 0000000..309c730 --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/projectsManagementBackground.js @@ -0,0 +1 @@ +background-color: rgb(246, 246, 242); \ No newline at end of file diff --git a/configurationServer/gui/brandManager/styles/startTab/recentProjectsBackground.js b/configurationServer/gui/brandManager/styles/startTab/recentProjectsBackground.js new file mode 100644 index 0000000..9ee8714 --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/recentProjectsBackground.js @@ -0,0 +1 @@ +background-color: rgb(238, 238, 230); \ No newline at end of file diff --git a/configurationServer/gui/brandManager/styles/startTab/substrate.js b/configurationServer/gui/brandManager/styles/startTab/substrate.js new file mode 100644 index 0000000..f83ec24 --- /dev/null +++ b/configurationServer/gui/brandManager/styles/startTab/substrate.js @@ -0,0 +1 @@ +background-color: rgb(220, 220, 220); diff --git a/configurationServer/gui/brandManager/styles/styles.qrc b/configurationServer/gui/brandManager/styles/styles.qrc new file mode 100644 index 0000000..9d3552f --- /dev/null +++ b/configurationServer/gui/brandManager/styles/styles.qrc @@ -0,0 +1,12 @@ + + + startTab/background.js + startTab/button.js + startTab/header.js + startTab/labelLevel1.js + startTab/labelLevel2.js + startTab/projectsManagementBackground.js + startTab/recentProjectsBackground.js + startTab/substrate.js + + diff --git a/configurationServer/gui/gui.pro b/configurationServer/gui/gui.pro new file mode 100644 index 0000000..213c23c --- /dev/null +++ b/configurationServer/gui/gui.pro @@ -0,0 +1,78 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-07-03T12:21:10 +# +#------------------------------------------------- + +QT += core gui +QT += network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = gui +TEMPLATE = app +CONFIG += c++11 + +SOURCES += main.cpp\ + preferencesDialog.cpp \ + preferencesPages/behaviourPage.cpp \ + preferencesPages/debuggerPage.cpp \ + preferencesPages/editorPage.cpp \ + preferencesPages/featuresPage.cpp \ + preferencesPages/miscellaniousPage.cpp \ + qrkernel/ids.cpp \ + qrkernel/settingsManager.cpp \ + qrkernel/timeMeasurer.cpp \ + qrkernel/version.cpp \ + qrutils/qRealFileDialog.cpp \ + brandManager/brandManager.cpp \ + hotKeyManager/hotKeyManager.cpp \ + hotKeyManager/hotKeyManagerPage.cpp \ + hotKeyManager/shortcutEdit.cpp \ + qrutils/qRealDialog.cpp \ + widget.cpp \ + server/server.cpp + +HEADERS += \ + preferencesDialog.h \ + preferencesPages/behaviourPage.h \ + preferencesPages/debuggerPage.h \ + preferencesPages/editorPage.h \ + preferencesPages/featuresPage.h \ + preferencesPages/miscellaniousPage.h \ + preferencesPages/preferencesPage.h \ + qrkernel/definitions.h \ + qrkernel/ids.h \ + qrkernel/kernelDeclSpec.h \ + qrkernel/roles.h \ + qrkernel/settingsManager.h \ + qrkernel/timeMeasurer.h \ + qrkernel/version.h \ + qrutils/qRealFileDialog.h \ + brandManager/brandManager.h \ + brandManager/fonts.h \ + brandManager/styles.h \ + hotKeyManager/hotKeyManager.h \ + hotKeyManager/hotKeyManagerPage.h \ + hotKeyManager/shortcutEdit.h \ + qrutils/qRealDialog.h \ + widget.h \ + ui_widget.h \ + server/server.h + +FORMS += \ + preferencesDialog.ui \ + preferencesPages/behaviourPage.ui \ + preferencesPages/debuggerPage.ui \ + preferencesPages/editorPage.ui \ + preferencesPages/featuresPage.ui \ + preferencesPages/miscellaniousPage.ui \ + hotKeyManager/hotKeyManagerPage.ui \ + widget.ui + +SUBDIRS += \ + qrkernel/qrkernel.pro \ + server/server.pro + +OTHER_FILES += + +RESOURCES += diff --git a/configurationServer/gui/hotKeyManager/hotKeyManager.cpp b/configurationServer/gui/hotKeyManager/hotKeyManager.cpp new file mode 100644 index 0000000..f46c571 --- /dev/null +++ b/configurationServer/gui/hotKeyManager/hotKeyManager.cpp @@ -0,0 +1,212 @@ +#include "hotKeyManager.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace qReal; + +HotKeyManager::HotKeyManager() +{ +} + +HotKeyManager::~HotKeyManager() +{ +} + +HotKeyManager& HotKeyManager::instance() +{ + static HotKeyManager instance; + return instance; +} + +void HotKeyManager::setCommand(QString const &id, QString const &label, QAction *command) +{ + command->setWhatsThis(label); + instance().registerCommand(id, command); +} + +void HotKeyManager::deleteCommand(QString const &id) +{ + resetShortcuts(id); + instance().deleteCommandPrivate(id); +} + +bool HotKeyManager::setShortcut(QString const &id, QKeySequence const &keyseq) +{ + return instance().registerShortcut(id, keyseq); +} + +void HotKeyManager::resetShortcuts(QString const &id) +{ + instance().resetShortcutsPrivate(id); +} + +void HotKeyManager::resetAllShortcuts() +{ + instance().resetAllShortcutsPrivate(); +} + +void HotKeyManager::deleteShortcut(const QString &id, const QString &shortcut) +{ + instance().deleteShortcutPrivate(id, shortcut); +} + +QHash HotKeyManager::commands() +{ + return instance().commandsPrivate(); +} + +QHash HotKeyManager::shortcuts() +{ + return instance().shortcutsPrivate(); +} + +void HotKeyManager::registerCommand(QString const &id, QAction *command) +{ + QList const shortcuts = command->shortcuts(); + + foreach (QKeySequence const &shortcut, shortcuts) { + instance().registerShortcut(id, shortcut.toString()); + } + + mCommands[id] = command; +} + +bool HotKeyManager::registerShortcut(QString const &id, QKeySequence const &keyseq) +{ + if (mCommands.contains(id)) { + QString const shortcut = keyseq.toString(); + + if (!hasPrefixOf(shortcut)) { + addPrefixes(shortcut); + mShortcuts[shortcut] = id; + mCommands[id]->setShortcuts(mCommands[id]->shortcuts() << keyseq); + return true; + } + } + return false; +} + +void HotKeyManager::registerShortcut(QString const &id, QString const &shortcut) +{ + if (!hasPrefixOf(shortcut)) { + addPrefixes(shortcut); + mShortcuts[shortcut] = id; + } +} + +void HotKeyManager::findShortcut(QString const &shortcut) +{ + if (mShortcuts.contains(shortcut) && mCommands[mShortcuts.value(shortcut)]->parentWidget()->isActiveWindow()) { + mCommands[mShortcuts.value(shortcut)]->trigger(); + } +} + +void HotKeyManager::resetShortcutsPrivate(QString const &id) +{ + if (mCommands.contains(id)) { + QStringList const shortcuts = mShortcuts.keys(id); + + foreach (QString const &shortcut, shortcuts) { + deletePrefixes(shortcut); + mShortcuts.remove(shortcut); + } + + mCommands[id]->setShortcuts(QList()); + } +} + +void HotKeyManager::resetAllShortcutsPrivate() +{ + QList const cmds = mCommands.values(); + + foreach (QAction *cmd, cmds) { + cmd->setShortcuts(QList()); + } + + mShortcuts.clear(); + mPrefixes.clear(); +} + +void HotKeyManager::deleteShortcutPrivate(const QString &id, const QString &shortcut) +{ + mShortcuts.remove(shortcut); + deletePrefixes(shortcut); + + QList shortcuts = mCommands[id]->shortcuts(); + + shortcuts.removeOne(shortcut); + mCommands[id]->setShortcuts(shortcuts); +} + +void HotKeyManager::deleteCommandPrivate(QString const &id) +{ + if (mCommands.contains(id)) { + mCommands.remove(id); + } +} + +QHash HotKeyManager::commandsPrivate() +{ + return mCommands; +} + +QHash HotKeyManager::shortcutsPrivate() +{ + return mShortcuts; +} + +bool HotKeyManager::hasPrefixOf(QString const &keyseq) +{ + if (!mPrefixes.contains(keyseq)) { + QStringList const seqlist = keyseq.split(", "); + QString prefix; + + foreach (QString const &seq, seqlist) { + prefix += seq; + if (mShortcuts.contains(prefix)) { + return true; + } + prefix += ", "; + } + return false; + } + return true; +} + +void HotKeyManager::addPrefixes(QString const &keyseq) +{ + QStringList const seqlist = keyseq.split(", "); + QString prefix; + + foreach (QString const &seq, seqlist) { + prefix += seq; + if (mPrefixes.contains(prefix)) { + ++mPrefixes[prefix]; + } else { + mPrefixes[prefix] = 1; + } + prefix += ", "; + } +} + +void HotKeyManager::deletePrefixes(QString const &keyseq) +{ + QStringList const seqlist = keyseq.split(", "); + QString prefix; + + foreach (QString const &seq, seqlist) { + prefix += seq; + --mPrefixes[prefix]; + if (mPrefixes.value(prefix) == 0) { + mPrefixes.remove(prefix); + } + prefix += ", "; + } +} diff --git a/configurationServer/gui/hotKeyManager/hotKeyManager.h b/configurationServer/gui/hotKeyManager/hotKeyManager.h new file mode 100644 index 0000000..4fa71c1 --- /dev/null +++ b/configurationServer/gui/hotKeyManager/hotKeyManager.h @@ -0,0 +1,77 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace qReal { + +enum MouseButtons +{ + None + , MouseLB + , MouseRB + , MouseMB + , MouseWU + , MouseWD +}; + +class HotKeyManager +{ +public: + static HotKeyManager& instance(); + + /// Sets a new command. Connect (on signal triggered()) and key sequences are made by component. + /// @param id Command id. + /// @param label Short description of command + /// @param command QAction object which contains shortcuts and with whom connection is performed. + static void setCommand(QString const &id, QString const &label, QAction *command); + + static void deleteCommand(QString const &id); + + /// Sets a new shortcut to existing command + /// @param id Command id + /// @param keyseq Shortcut + static bool setShortcut(QString const &id, QKeySequence const &keyseq); + + static void resetShortcuts(QString const &id); + static void resetAllShortcuts(); + static void deleteShortcut(QString const &id, QString const &shortcut); + + static QHash commands(); + static QHash shortcuts(); + +private: + HotKeyManager(); + explicit HotKeyManager(HotKeyManager const&); + ~HotKeyManager(); + + void operator=(HotKeyManager const&); + + void registerCommand(QString const &id, QAction *command); + + bool registerShortcut(QString const &id, QKeySequence const &keyseq); + void registerShortcut(QString const &id, QString const &shortcut); + + void findShortcut(QString const &shortcut); + + void resetShortcutsPrivate(QString const &id); + void resetAllShortcutsPrivate(); + void deleteShortcutPrivate(QString const &id, QString const &shortcut); + + void deleteCommandPrivate(QString const &id); + bool hasPrefixOf(QString const &keyseq); + void addPrefixes(QString const &keyseq); + void deletePrefixes(QString const &keyseq); + + QHash commandsPrivate(); + QHash shortcutsPrivate(); + + QHash mCommands; + QHash mShortcuts; + QHash mPrefixes; +}; + +} diff --git a/configurationServer/gui/hotKeyManager/hotKeyManager.pri b/configurationServer/gui/hotKeyManager/hotKeyManager.pri new file mode 100644 index 0000000..9120995 --- /dev/null +++ b/configurationServer/gui/hotKeyManager/hotKeyManager.pri @@ -0,0 +1,12 @@ +HEADERS += \ + $$PWD/hotKeyManagerPage.h \ + $$PWD/hotKeyManager.h \ + $$PWD/shortcutEdit.h + +SOURCES += \ + $$PWD/hotKeyManagerPage.cpp \ + $$PWD/hotKeyManager.cpp \ + $$PWD/shortcutEdit.cpp + +FORMS += \ + $$PWD/hotKeyManagerPage.ui diff --git a/configurationServer/gui/hotKeyManager/hotKeyManagerPage.cpp b/configurationServer/gui/hotKeyManager/hotKeyManagerPage.cpp new file mode 100644 index 0000000..9e4ebd6 --- /dev/null +++ b/configurationServer/gui/hotKeyManager/hotKeyManagerPage.cpp @@ -0,0 +1,224 @@ +#include "hotKeyManagerPage.h" +#include "ui_hotKeyManagerPage.h" + +#include +#include +#include +#include +#include +#include + +#include "hotKeyManager/hotKeyManager.h" + +using namespace qReal; + +int const maxShortcutParts = 3; // Actually, 3 = number of commas in string (= 4 shortcut parts) + // e.g. "Ctrl+X, Alt+V, Shift+G, Ctrl+Y" +int const maxShortcuts = 3; // Max number of shortcuts which we can set to one command + +PreferencesHotKeyManagerPage:: PreferencesHotKeyManagerPage(QWidget *parent) + : PreferencesPage(parent) + , mUi(new Ui::hotKeyManagerPage) + , mCurrentId("") + , mCurrentItem(NULL) + , mCurrentModifiers(Qt::NoModifier) +{ + mUi->setupUi(this); + mIcon = QIcon(":/icons/hotkeys.png"); + +// mUi->hotKeysTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive); + + // TODO: implement export/import + mUi->importPushButton->hide(); + mUi->exportPushButton->hide(); + + connect(mUi->hotKeysTable, SIGNAL(cellClicked(int,int)), this, SLOT(activateShortcutLineEdit(int,int))); + connect(mUi->hotKeysTable, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(doubleClicked(int,int))); + connect(mUi->shortcutLineEdit, SIGNAL(newModifiers(Qt::KeyboardModifiers)) + , this, SLOT(newModifiers(Qt::KeyboardModifiers))); + connect(mUi->shortcutLineEdit, SIGNAL(newKey(int)), this, SLOT(newKey(int))); + connect(mUi->resetShortcutPushButton, SIGNAL(clicked()), this, SLOT(resetShortcuts())); + connect(mUi->resetAllPushButton, SIGNAL(clicked()), this, SLOT(resetAllShortcuts())); + + restoreSettings(); +} + +PreferencesHotKeyManagerPage::~PreferencesHotKeyManagerPage() +{ + delete mUi; +} + +void PreferencesHotKeyManagerPage::save() +{ +} + +void PreferencesHotKeyManagerPage::restoreSettings() +{ + mUi->hotKeysTable->clearContents(); + initTable(); + loadHotKeys(); + mUi->hotKeysTable->sortByColumn(0, Qt::AscendingOrder); + + int const tableWidth = mUi->hotKeysTable->horizontalHeader()->width(); + mUi->hotKeysTable->setColumnWidth(0, 0.25 * tableWidth); + mUi->hotKeysTable->setColumnWidth(1, 0.5 * tableWidth); + mUi->hotKeysTable->setColumnWidth(2, 0.25 * tableWidth); +} + +void PreferencesHotKeyManagerPage::resetShortcuts() +{ + if (!mCurrentId.isEmpty()) { + if (mCurrentItem->textColor() == Qt::black) { + HotKeyManager::deleteShortcut(mCurrentId, mCurrentItem->text()); + } + + mCurrentItem->setText(""); + mUi->shortcutLineEdit->setText(""); + setTextColor(Qt::black); + } +} + +void PreferencesHotKeyManagerPage::resetAllShortcuts() +{ + if (QMessageBox::question(this, tr("Question"), tr("This will clear all "\ + "current shortcuts. Are you sure?")) == QMessageBox::Yes) { + mCurrentItem = NULL; + mCurrentId = ""; + + HotKeyManager::resetAllShortcuts(); + restoreSettings(); + } +} + +void PreferencesHotKeyManagerPage::showEvent(QShowEvent *e) +{ + restoreSettings(); + QWidget::showEvent(e); +} + +void PreferencesHotKeyManagerPage::loadHotKeys() +{ + QHash cmds = HotKeyManager::commands(); + QHash shortcuts = HotKeyManager::shortcuts(); + + QHash::iterator i; + int k; + + for (i = cmds.begin(), k = 0; i != cmds.end(); ++i, ++k) { + QStringList const sequences = shortcuts.keys(i.key()); + + mUi->hotKeysTable->item(k, 0)->setText(i.key()); + mUi->hotKeysTable->item(k, 1)->setText(i.value()->whatsThis()); + + int j = 0; + foreach (QString const &sequence, sequences) { + mUi->hotKeysTable->item(k, 2 + j)->setText(sequence); + mUi->hotKeysTable->item(k, 2 + j)->setTextColor(Qt::black); + + if (++j >= maxShortcuts) { + break; + } + } + } +} + +void PreferencesHotKeyManagerPage::initTable() +{ + int const rows = HotKeyManager::commands().size(); + mUi->hotKeysTable->setRowCount(rows); + + for (int i = 0; i < mUi->hotKeysTable->rowCount(); ++i) { + // first column - name of command, second - short description, rest - shortcuts + for (int j = 0; j < 2 + maxShortcuts; ++j) { + mUi->hotKeysTable->setItem(i, j, new QTableWidgetItem("")); + } + } +} + +void PreferencesHotKeyManagerPage::doubleClicked(const int row, const int column) +{ + mUi->shortcutLineEdit->setFocus(); + activateShortcutLineEdit(row, column); +} + +void PreferencesHotKeyManagerPage::activateShortcutLineEdit(int const row, int const column) +{ + // Columns with shortcuts start from index 2 + if (column > 1) { + if (mCurrentItem) { + mCurrentItem->setBackgroundColor(Qt::white); + } + + mCurrentId = mUi->hotKeysTable->item(row, 0)->text(); + mCurrentItem = mUi->hotKeysTable->item(row, column); + mCurrentItem->setBackgroundColor(Qt::lightGray); + + mUi->shortcutLineEdit->setText(mCurrentItem->text()); + mUi->shortcutLineEdit->setEnabled(true); + + setTextColor(mCurrentItem->textColor()); + + if (HotKeyManager::setShortcut(mCurrentId, mCurrentItem->text())) { + setTextColor(Qt::black); + } + } else { + mCurrentId = ""; + mUi->shortcutLineEdit->clear(); + mUi->shortcutLineEdit->setEnabled(false); + } +} + +void PreferencesHotKeyManagerPage::newModifiers(Qt::KeyboardModifiers modifiers) +{ + mCurrentModifiers = modifiers; +} + +void PreferencesHotKeyManagerPage::newKey(int const key) +{ + if (!mCurrentId.isEmpty()) { + if (mCurrentItem->text().isEmpty()) { + if (HotKeyManager::setShortcut(mCurrentId, QKeySequence(mCurrentModifiers + key))) { + setTextColor(Qt::black); + } else { + setTextColor(Qt::red); + } + mCurrentItem->setText(QKeySequence(mCurrentModifiers + key).toString()); + mUi->shortcutLineEdit->setText(mCurrentItem->text()); + } else { + int const parts = mCurrentItem->text().count(','); + + if (parts != maxShortcutParts) { + QString const shortcut = QString("%1, %2").arg( + mCurrentItem->text() + , QKeySequence(mCurrentModifiers + key).toString() + ); + + if (mCurrentItem->textColor() == Qt::black) { + HotKeyManager::deleteShortcut(mCurrentId, mCurrentItem->text()); + } + + if (HotKeyManager::setShortcut(mCurrentId, QKeySequence(shortcut))) { + setTextColor(Qt::black); + mCurrentItem->setText(shortcut); + mUi->shortcutLineEdit->setText(mCurrentItem->text()); + } else { + HotKeyManager::setShortcut(mCurrentId, mCurrentItem->text()); + + if (parts < maxShortcutParts - 1) { + setTextColor(Qt::red); + mCurrentItem->setText(shortcut); + mUi->shortcutLineEdit->setText(mCurrentItem->text()); + } + } + } + } + } +} + +void PreferencesHotKeyManagerPage::setTextColor(QColor const &color) +{ + mCurrentItem->setTextColor(color); + QPalette palette; + palette.setColor(QPalette::Text, color); + mUi->shortcutLineEdit->setPalette(palette); +} diff --git a/configurationServer/gui/hotKeyManager/hotKeyManagerPage.h b/configurationServer/gui/hotKeyManager/hotKeyManagerPage.h new file mode 100644 index 0000000..b413ace --- /dev/null +++ b/configurationServer/gui/hotKeyManager/hotKeyManagerPage.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include + +#include "preferencesPages/preferencesPage.h" + +namespace Ui { + class hotKeyManagerPage; +} + +class PreferencesHotKeyManagerPage : public PreferencesPage +{ + Q_OBJECT + +public: + explicit PreferencesHotKeyManagerPage(QWidget *parent = 0); + ~PreferencesHotKeyManagerPage(); + + void save(); + void restoreSettings(); + +private slots: + void doubleClicked(int const row, int const column); + void activateShortcutLineEdit(int const row, int const column); + void newModifiers(Qt::KeyboardModifiers modifiers); + void newKey(int const key); + void resetShortcuts(); + void resetAllShortcuts(); + +protected: + void showEvent(QShowEvent *e); + +private: + void loadHotKeys(); + void initTable(); + void setTextColor(QColor const &color); + + Ui::hotKeyManagerPage *mUi; + + QString mCurrentId; + QTableWidgetItem *mCurrentItem; + Qt::KeyboardModifiers mCurrentModifiers; +}; diff --git a/configurationServer/gui/hotKeyManager/hotKeyManagerPage.ui b/configurationServer/gui/hotKeyManager/hotKeyManagerPage.ui new file mode 100644 index 0000000..7174b14 --- /dev/null +++ b/configurationServer/gui/hotKeyManager/hotKeyManagerPage.ui @@ -0,0 +1,222 @@ + + + hotKeyManagerPage + + + + 0 + 0 + 654 + 350 + + + + Form + + + + + + Keyboard Shortcuts + + + + + + Qt::Horizontal + + + + 381 + 38 + + + + + + + + Import... + + + + + + + Export... + + + + + + + true + + + + 0 + 0 + + + + Qt::WheelFocus + + + QAbstractItemView::NoEditTriggers + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectItems + + + false + + + true + + + true + + + 0 + + + 5 + + + 100 + + + true + + + false + + + 19 + + + false + + + + Command + + + + + Label + + + + + Shortcut 1 + + + + + Shortcut 2 + + + + + Shortcut 3 + + + + + + + + Reset All + + + + + + + + + + Shortcut + + + + + + Reset + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 10 + 20 + + + + + + + + Key sequence + + + + + + + false + + + false + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 2 + 20 + + + + + + + + + + + + ShortcutEdit + QLineEdit +
hotKeyManager/shortcutEdit.h
+
+
+ + +
diff --git a/configurationServer/gui/hotKeyManager/shortcutEdit.cpp b/configurationServer/gui/hotKeyManager/shortcutEdit.cpp new file mode 100644 index 0000000..c595c52 --- /dev/null +++ b/configurationServer/gui/hotKeyManager/shortcutEdit.cpp @@ -0,0 +1,34 @@ +#include "shortcutEdit.h" + +#include +#include +#include +#include +#include + +ShortcutEdit::ShortcutEdit(QWidget *parent) + : QLineEdit(parent) +{ +} + +bool ShortcutEdit::event(QEvent *event) +{ + if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { + QKeyEvent *keyevent = static_cast (event); + + switch (keyevent->key()) { + case Qt::Key_Shift: + case Qt::Key_Control: + case Qt::Key_Alt: + case Qt::Key_AltGr: + emit newModifiers(keyevent->modifiers()); + break; + default: + if (event->type() == QEvent::KeyPress) { + emit newKey(keyevent->key()); + } + } + return true; + } + return QLineEdit::event(event); +} diff --git a/configurationServer/gui/hotKeyManager/shortcutEdit.h b/configurationServer/gui/hotKeyManager/shortcutEdit.h new file mode 100644 index 0000000..280781d --- /dev/null +++ b/configurationServer/gui/hotKeyManager/shortcutEdit.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include + +class ShortcutEdit : public QLineEdit +{ + Q_OBJECT +public: + explicit ShortcutEdit(QWidget *parent = 0); + + bool event(QEvent *event); + +signals: + void newKey(int const key); + void newModifiers(Qt::KeyboardModifiers modifiers); +}; diff --git a/configurationServer/gui/main.cpp b/configurationServer/gui/main.cpp new file mode 100644 index 0000000..89711ec --- /dev/null +++ b/configurationServer/gui/main.cpp @@ -0,0 +1,12 @@ +#include +#include "widget.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Widget w; + w.init(); + w.show(); + + return a.exec(); +} diff --git a/configurationServer/gui/preferencesDialog.cpp b/configurationServer/gui/preferencesDialog.cpp new file mode 100644 index 0000000..dbe778e --- /dev/null +++ b/configurationServer/gui/preferencesDialog.cpp @@ -0,0 +1,187 @@ +#include "preferencesDialog.h" +#include "ui_preferencesDialog.h" + +#include + +#include + +#include "preferencesPages/behaviourPage.h" +#include "preferencesPages/debuggerPage.h" +#include "preferencesPages/editorPage.h" +#include "preferencesPages/miscellaniousPage.h" +#include "preferencesPages/featuresPage.h" +#include "hotKeyManager/hotKeyManagerPage.h" +#include "brandManager/brandManager.h" + +using namespace qReal; +using namespace utils; + +PreferencesDialog::PreferencesDialog(QWidget *parent) + : QRealDialog("PreferencesDialog", parent) + , mUi(new Ui::PreferencesDialog) +{ + mUi->setupUi(this); +} + +PreferencesDialog::~PreferencesDialog() +{ + SettingsManager::setValue("currentPreferencesTab", mUi->listWidget->currentRow()); + delete mUi; +} + +void PreferencesDialog::init(QAction * const showGridAction, QAction * const showAlignmentAction + , QAction * const activateGridAction, QAction * const activateAlignmentAction) +{ + PreferencesPage *behaviourPage = new PreferencesBehaviourPage(mUi->pageContentWigdet); + // Debugger page removed due to #736 + PreferencesMiscellaniousPage *miscellaniousPage = new PreferencesMiscellaniousPage(mUi->pageContentWigdet); + PreferencesPage *editorPage = new PreferencesEditorPage(showGridAction + , showAlignmentAction, activateGridAction, activateAlignmentAction, mUi->pageContentWigdet); + PreferencesPage *hotKeyManagerPage = new PreferencesHotKeyManagerPage(mUi->pageContentWigdet); + + mUi->applyButton->setVisible(false); + mUi->cancelButton->setVisible(false); + mUi->okButton->setVisible(false); + + connect(mUi->listWidget, SIGNAL(clicked(QModelIndex)) + , this, SLOT(chooseTab(const QModelIndex &))); + connect(mUi->listWidget, SIGNAL(activated(const QModelIndex &)) + , this, SLOT(chooseTab(const QModelIndex &))); + connect(mUi->applyButton, SIGNAL(clicked()), this, SLOT(applyChanges())); + connect(mUi->okButton, SIGNAL(clicked()), this, SLOT(saveAndClose())); + connect(mUi->cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); + connect(mUi->exportButton, SIGNAL(clicked()), this, SLOT(exportSettings())); + connect(mUi->importButton, SIGNAL(clicked()), this, SLOT(importSettings())); + connect(mUi->saveButton, SIGNAL(clicked()), this, SLOT(applyChanges())); + + connect(editorPage, SIGNAL(gridChanged()), this, SIGNAL(gridChanged())); + connect(editorPage, SIGNAL(fontChanged()), this, SIGNAL(fontChanged())); + connect(editorPage, SIGNAL(paletteRepresentationChanged()), this + , SIGNAL(paletteRepresentationChanged())); + connect(miscellaniousPage, SIGNAL(iconsetChanged()), this, SIGNAL(iconsetChanged())); + connect(miscellaniousPage, &PreferencesMiscellaniousPage::toolbarSizeChanged + , this, &PreferencesDialog::toolbarSizeChanged); + connect(behaviourPage, SIGNAL(usabilityTestingModeChanged(bool)) + , this, SIGNAL(usabilityTestingModeChanged(bool)), Qt::UniqueConnection); + + registerPage(tr("Behaviour"), behaviourPage); + registerPage(tr("Miscellanious"), miscellaniousPage); + registerPage(tr("Editor"), editorPage); + registerPage(tr("Shortcuts"), hotKeyManagerPage); + + int const currentTab = SettingsManager::value("currentPreferencesTab").toInt(); + mUi->listWidget->setCurrentRow(currentTab); + chooseTab(mUi->listWidget->currentIndex()); +} + +void PreferencesDialog::updatePluginDependendSettings() +{ +// setWindowIcon(BrandManager::applicationIcon()); +} + +void PreferencesDialog::applyChanges() +{ + bool shouldRestart = false; + foreach (PreferencesPage *page, mCustomPages.values()) { + page->save(); + shouldRestart |= page->mShouldRestartSystemToApply; + page->mShouldRestartSystemToApply = false; + } + + SettingsManager::instance()->saveData(); + + if (shouldRestart) { + QMessageBox::information(this, tr("Information"), tr("You should restart the system to apply changes")); + } + + emit settingsApplied(); +} + +void PreferencesDialog::restoreSettings() +{ + foreach (PreferencesPage *page, mCustomPages.values()) { + page->restoreSettings(); + } +} + +void PreferencesDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + mUi->retranslateUi(this); + foreach (PreferencesPage *page, mCustomPages.values()) + page->changeEvent(e); + break; + default: + break; + } +} + +void PreferencesDialog::showEvent(QShowEvent *e) +{ + restoreSettings(); + QRealDialog::showEvent(e); +} + +void PreferencesDialog::saveAndClose() +{ + applyChanges(); + close(); +} + +void PreferencesDialog::cancel() +{ + restoreSettings(); + close(); +} + +void PreferencesDialog::chooseTab(QModelIndex const &index) +{ + mUi->listWidget->setCurrentRow(index.row()); + mUi->pageContentWigdet->setCurrentIndex(index.row() + 1); +} + +void PreferencesDialog::registerPage(QString const &pageName, PreferencesPage * const page) +{ + mUi->pageContentWigdet->addWidget(page); + mCustomPages.insert(pageName, page); + mPagesIndexes.insert(pageName, mCustomPages.count() - 1); + mUi->listWidget->addItem(new QListWidgetItem(QIcon(page->getIcon()), pageName)); +} + +void PreferencesDialog::switchCurrentTab(QString const &tabName) +{ + if (mCustomPages.contains(tabName)) { + int const currentIndex = mPagesIndexes[tabName]; + mUi->listWidget->setCurrentRow(currentIndex); + mUi->pageContentWigdet->setCurrentIndex(currentIndex + 1); + } +} +void PreferencesDialog::changePaletteParameters() +{ + if (mCustomPages.count(tr("Editor")) > 0) { + static_cast(mCustomPages[tr("Editor")])->changePaletteParameters(); + } +} + +void PreferencesDialog::exportSettings() +{ + QString fileNameForExport = QRealFileDialog::getSaveFileName("SaveEnginePreferences", this + , tr("Save File"),"/mySettings",tr("*.ini")); + if (!fileNameForExport.endsWith(".ini")) { + fileNameForExport += ".ini"; + } + SettingsManager::instance()->saveSettings(fileNameForExport); +} + +void PreferencesDialog::importSettings() +{ + QString fileNameForImport = QRealFileDialog::getOpenFileName("OpenEnginePreferences", this + , tr("Open File"),"/mySettings",tr("*.ini")); + SettingsManager::instance()->loadSettings(fileNameForImport); + + foreach (PreferencesPage *page, mCustomPages.values()) { + page->restoreSettings(); + } +} diff --git a/configurationServer/gui/preferencesDialog.h b/configurationServer/gui/preferencesDialog.h new file mode 100644 index 0000000..24b4180 --- /dev/null +++ b/configurationServer/gui/preferencesDialog.h @@ -0,0 +1,61 @@ +#pragma once + +#include +#include +#include + +#include +#include + +#include "preferencesPages/preferencesPage.h" + +namespace Ui { +class PreferencesDialog; +} + +class PreferencesDialog : public utils::QRealDialog +{ + Q_OBJECT + +public: + + explicit PreferencesDialog(QWidget *parent = 0); + ~PreferencesDialog(); + + void init(QAction * const showGridAction, QAction * const showAlignmentAction + , QAction * const activateGridAction, QAction * const activateAlignmentAction); + void updatePluginDependendSettings(); + + void registerPage(QString const &pageName, PreferencesPage * const page); + void switchCurrentTab(QString const &tabName); + +protected: + void changeEvent(QEvent *e); + void showEvent(QShowEvent *e); + +signals: + void gridChanged(); + void iconsetChanged(); + void toolbarSizeChanged(int size); + void settingsApplied(); + void fontChanged(); + void paletteRepresentationChanged(); + void usabilityTestingModeChanged(bool on); + +public slots: + void changePaletteParameters(); + +private slots: + void cancel(); + void applyChanges(); + void restoreSettings(); + void saveAndClose(); + void chooseTab(const QModelIndex &); + void exportSettings(); + void importSettings(); + +private: + Ui::PreferencesDialog *mUi; + QMap mCustomPages; + QMap mPagesIndexes; +}; diff --git a/configurationServer/gui/preferencesDialog.ui b/configurationServer/gui/preferencesDialog.ui new file mode 100644 index 0000000..db7fb7c --- /dev/null +++ b/configurationServer/gui/preferencesDialog.ui @@ -0,0 +1,160 @@ + + + PreferencesDialog + + + + 0 + 0 + 892 + 593 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Preferences + + + + :/icons/qreal.png:/icons/qreal.png + + + + + + false + + + OK + + + + + + + false + + + Cancel + + + + + + + false + + + Apply + + + + + + + + 0 + 0 + + + + + 500 + 16777215 + + + + QListView::TopToBottom + + + QListView::ListMode + + + true + + + true + + + -1 + + + + + + + + 0 + 0 + + + + true + + + + + 0 + 0 + 610 + 509 + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + + + + + + + + + + Export + + + + + + + Import + + + + + + + + diff --git a/configurationServer/gui/preferencesPages/behaviourPage.cpp b/configurationServer/gui/preferencesPages/behaviourPage.cpp new file mode 100644 index 0000000..3c6c33d --- /dev/null +++ b/configurationServer/gui/preferencesPages/behaviourPage.cpp @@ -0,0 +1,102 @@ +#include "behaviourPage.h" +#include "ui_behaviourPage.h" + +#include + +using namespace qReal; + +PreferencesBehaviourPage::PreferencesBehaviourPage(QWidget *parent) + : PreferencesPage(parent) + , mUi(new Ui::PreferencesBehaviourPage) +{ + mIcon = QIcon(":/icons/preferences/behaviour.png"); + mUi->setupUi(this); + + initLanguages(); + + connect(mUi->autoSaveCheckBox, SIGNAL(clicked(bool)), this, SLOT(showAutoSaveBox(bool))); +// connect(mUi->collectErgonomicValuesCheckBox, SIGNAL(clicked(bool)) +// , &mFilterObject, SLOT(setStatusCollectUsabilityStatistics(bool))); + restoreSettings(); +} + +PreferencesBehaviourPage::~PreferencesBehaviourPage() +{ + delete mUi; +} + +void PreferencesBehaviourPage::changeEvent(QEvent *e) +{ + switch (e->type()) { + case QEvent::LanguageChange: + mUi->retranslateUi(this); + break; + default: + break; + } +} + +void PreferencesBehaviourPage::save() +{ + QString const language = mUi->languageComboBox->itemData(mUi->languageComboBox->currentIndex()).toString(); + SettingsManager::setValue("systemLocale", language); + if (mOldLanguage != language) { + setRestartFlag(); + } + + SettingsManager::setValue("PaletteTabSwitching", mUi->paletteTabCheckBox->isChecked()); + SettingsManager::setValue("Autosave", mUi->autoSaveCheckBox->isChecked()); + SettingsManager::setValue("AutosaveInterval", mUi->autoSaveSpinBox->value()); + SettingsManager::setValue("gestureDelay", mUi->gestureDelaySpinBox->value()); + bool const usabilityTestingMode = mUi->usabilityModeCheckBox->isChecked(); + SettingsManager::setValue("usabilityTestingMode", usabilityTestingMode); + SettingsManager::setValue("collectErgonomicValues", mUi->collectErgonomicValuesCheckBox->isChecked() + || usabilityTestingMode); + SettingsManager::setValue("touchMode", mUi->touchModeCheckBox->isChecked()); + if (mUsabilityTestingMode != usabilityTestingMode) { + if (usabilityTestingMode) { + mUi->collectErgonomicValuesCheckBox->setChecked(true); + } + + mUsabilityTestingMode = usabilityTestingMode; + emit usabilityTestingModeChanged(mUsabilityTestingMode); + } +} + +void PreferencesBehaviourPage::restoreSettings() +{ + QString const locale = SettingsManager::value("systemLocale").toString(); + mOldLanguage = locale; + for (int index = 0; index < mUi->languageComboBox->count(); ++index) { + if (locale == mUi->languageComboBox->itemData(index).toString()) { + mUi->languageComboBox->setCurrentIndex(index); + } + } + + mUi->paletteTabCheckBox->setChecked(SettingsManager::value("PaletteTabSwitching").toBool()); + mUi->autoSaveCheckBox->setChecked(SettingsManager::value("Autosave").toBool()); + mUi->autoSaveSpinBox->setValue(SettingsManager::value("AutosaveInterval").toInt()); + mUi->gestureDelaySpinBox->setValue(SettingsManager::value("gestureDelay").toInt()); + mUi->collectErgonomicValuesCheckBox->setChecked(SettingsManager::value("collectErgonomicValues").toBool()); + mUsabilityTestingMode = SettingsManager::value("usabilityTestingMode").toBool(); + mUi->usabilityModeCheckBox->setChecked(mUsabilityTestingMode); + mUi->touchModeCheckBox->setChecked(SettingsManager::value("touchMode").toBool()); + + showAutoSaveBox(mUi->autoSaveCheckBox->isChecked()); + int const editorsLoadedCount = SettingsManager::value("EditorsLoadedCount").toInt(); + mUi->paletteTabCheckBox->setVisible(editorsLoadedCount != 1); +// mFilterObject.setStatusCollectUsabilityStatistics(mUi->collectErgonomicValuesCheckBox->isChecked()); +} + +void PreferencesBehaviourPage::showAutoSaveBox(bool show) +{ + mUi->autoSaveSpinBox->setVisible(show); + mUi->autoSaveLabel->setVisible(show); +} + +void PreferencesBehaviourPage::initLanguages() +{ + mUi->languageComboBox->addItem(tr("")); + mUi->languageComboBox->addItem("English", "en"); + mUi->languageComboBox->addItem(QString::fromUtf8("Русский"), "ru"); +} diff --git a/configurationServer/gui/preferencesPages/behaviourPage.h b/configurationServer/gui/preferencesPages/behaviourPage.h new file mode 100644 index 0000000..8b7e75a --- /dev/null +++ b/configurationServer/gui/preferencesPages/behaviourPage.h @@ -0,0 +1,37 @@ +#pragma once + +#include "preferencesPages/preferencesPage.h" +//#include "mainwindow/filterObject.h" + +namespace Ui { + class PreferencesBehaviourPage; +} + +class PreferencesBehaviourPage : public PreferencesPage +{ + Q_OBJECT + +public: + explicit PreferencesBehaviourPage(QWidget *parent = 0); + ~PreferencesBehaviourPage() override; + + void save() override; + void restoreSettings() override; + +signals: + void usabilityTestingModeChanged(bool on); + +protected: + void changeEvent(QEvent *e); + +private slots: + void showAutoSaveBox(bool show); + +private: + void initLanguages(); + + Ui::PreferencesBehaviourPage *mUi; +// FilterObject mFilterObject; + bool mUsabilityTestingMode; + QString mOldLanguage; +}; diff --git a/configurationServer/gui/preferencesPages/behaviourPage.ui b/configurationServer/gui/preferencesPages/behaviourPage.ui new file mode 100644 index 0000000..50ce7fb --- /dev/null +++ b/configurationServer/gui/preferencesPages/behaviourPage.ui @@ -0,0 +1,198 @@ + + + PreferencesBehaviourPage + + + + 0 + 0 + 500 + 340 + + + + + 0 + 0 + + + + + + + User Interface + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Language + + + + + + + + + + + + + Automatics + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 100000 + + + 10 + + + + + + + sec + + + + + + + msec + + + + + + + Delay after gesture + + + + + + + Palette tab switching + + + + + + + 1 + + + 10000 + + + 1 + + + 600 + + + + + + + Autosave + + + true + + + + + + + Collect ergonomic values + + + true + + + + + + + Usability testing mode + + + + + + + + + + Touch + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Touch Mode + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/configurationServer/gui/preferencesPages/debuggerPage.cpp b/configurationServer/gui/preferencesPages/debuggerPage.cpp new file mode 100644 index 0000000..7a5f4cb --- /dev/null +++ b/configurationServer/gui/preferencesPages/debuggerPage.cpp @@ -0,0 +1,48 @@ +#include "debuggerPage.h" +#include "ui_debuggerPage.h" + +#include + +using namespace qReal; + +PreferencesDebuggerPage::PreferencesDebuggerPage(QWidget *parent) + : PreferencesPage(parent) + , mUi(new Ui::PreferencesDebuggerPage) + +{ + mIcon = QIcon(":/icons/preferences/bug.png"); + mUi->setupUi(this); + + restoreSettings(); +} + +PreferencesDebuggerPage::~PreferencesDebuggerPage() +{ + delete mUi; +} + +void PreferencesDebuggerPage::changeEvent(QEvent *e) +{ + switch (e->type()) { + case QEvent::LanguageChange: + mUi->retranslateUi(this); + break; + default: + break; + } +} + +void PreferencesDebuggerPage::save() +{ + SettingsManager::setValue("debuggerTimeout", mUi->timeoutLineEdit->text()); + SettingsManager::setValue("debugColor", mUi->colorComboBox->currentText()); +} + +void PreferencesDebuggerPage::restoreSettings() +{ + mUi->timeoutLineEdit->setText(SettingsManager::value("debuggerTimeout").toString()); + mUi->colorComboBox->addItems(QColor::colorNames()); + QString curColor = SettingsManager::value("debugColor").toString(); + int curColorIndex = mUi->colorComboBox->findText(curColor); + mUi->colorComboBox->setCurrentIndex(curColorIndex); +} diff --git a/configurationServer/gui/preferencesPages/debuggerPage.h b/configurationServer/gui/preferencesPages/debuggerPage.h new file mode 100644 index 0000000..7513a42 --- /dev/null +++ b/configurationServer/gui/preferencesPages/debuggerPage.h @@ -0,0 +1,25 @@ +#pragma once + +#include "preferencesPages/preferencesPage.h" + +namespace Ui { + class PreferencesDebuggerPage; +} + +class PreferencesDebuggerPage : public PreferencesPage +{ + Q_OBJECT + +public: + explicit PreferencesDebuggerPage(QWidget *parent = 0); + ~PreferencesDebuggerPage(); + + void save(); + virtual void restoreSettings(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::PreferencesDebuggerPage *mUi; +}; diff --git a/configurationServer/gui/preferencesPages/debuggerPage.ui b/configurationServer/gui/preferencesPages/debuggerPage.ui new file mode 100644 index 0000000..df24ba1 --- /dev/null +++ b/configurationServer/gui/preferencesPages/debuggerPage.ui @@ -0,0 +1,76 @@ + + + PreferencesDebuggerPage + + + + 0 + 0 + 407 + 122 + + + + + 0 + 0 + + + + + + + Presentation + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Debug timeout (ms): + + + + + + + + + + Color of highlighting: + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/configurationServer/gui/preferencesPages/editorPage.cpp b/configurationServer/gui/preferencesPages/editorPage.cpp new file mode 100644 index 0000000..c2621b4 --- /dev/null +++ b/configurationServer/gui/preferencesPages/editorPage.cpp @@ -0,0 +1,205 @@ +#include "editorPage.h" +#include "ui_editorPage.h" + +#include + +//#include "mainwindow/mainWindow.h" + +using namespace qReal; +//using namespace enums::linkShape; + +PreferencesEditorPage::PreferencesEditorPage(QAction * const showGridAction, QAction * const showAlignmentAction + , QAction * const activateGridAction, QAction * const activateAlignmentAction, QWidget *parent) + : PreferencesPage(parent) + , mUi(new Ui::PreferencesEditorPage) + , mWidthGrid(SettingsManager::value("GridWidth").toInt()) + , mIndexGrid(SettingsManager::value("IndexGrid").toInt()) + , mFontButtonWasPressed(false) + , mShowGridAction(showGridAction) + , mShowAlignmentAction(showAlignmentAction) + , mActivateGridAction(activateGridAction) + , mActivateAlignmentAction(activateAlignmentAction) +{ + mIcon = QIcon(":/icons/preferences/editor.png"); + mUi->setupUi(this); + + // changing grid size in QReal:Robots is forbidden + connect(mUi->gridWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(widthGridSliderMoved(int))); + connect(mUi->indexGridSlider, SIGNAL(valueChanged(int)), this, SLOT(indexGridSliderMoved(int))); + connect(mUi->dragAreaSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(dragAreaSliderMoved(int))); + connect(mUi->fontCheckBox, SIGNAL(toggled(bool)), this, SLOT(manualFontCheckBoxChecked(bool))); + connect(mUi->fontSelectionButton, SIGNAL(clicked()),this, SLOT(fontSelectionButtonClicked())); + connect(mUi->paletteComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(paletteComboBoxClicked(int))); + + connect(mShowGridAction, SIGNAL(toggled(bool)), this, SLOT(showGrid(bool))); + connect(mShowAlignmentAction, SIGNAL(toggled(bool)), this, SLOT(showAlignment(bool))); + connect(mActivateGridAction, SIGNAL(toggled(bool)), this, SLOT(activateGrid(bool))); + connect(mActivateAlignmentAction, SIGNAL(toggled(bool)), this, SLOT(activateAlignment(bool))); + + // use customizer to blick it somehow +// mUi->indexGridSlider->setVisible(false); +// mUi->label_20->setVisible(false); + + mUi->gridWidthSlider->setValue(mWidthGrid); + mUi->indexGridSlider->setValue(mIndexGrid); + + mDragArea = mUi->dragAreaSizeSlider->value(); + SettingsManager::setValue("DragArea", mDragArea); + restoreSettings(); +} + +PreferencesEditorPage::~PreferencesEditorPage() +{ + SettingsManager::setValue("GridWidth", mWidthGrid); + SettingsManager::setValue("IndexGrid", mIndexGrid); + + delete mUi; +} + +void PreferencesEditorPage::manualFontCheckBoxChecked(bool state) +{ + mUi->fontSelectionButton->setVisible(state); +} + +void PreferencesEditorPage::fontSelectionButtonClicked() +{ + mFontButtonWasPressed = true; + + QFontDialog fontDialog(this); + fontDialog.setModal(true); + QFont font; + font.fromString(mFont); + fontDialog.setCurrentFont(font); + fontDialog.exec(); + mFont = fontDialog.currentFont().toString(); +} + +void PreferencesEditorPage::changeEvent(QEvent *e) +{ + + switch (e->type()) { + case QEvent::LanguageChange: + mUi->retranslateUi(this); + break; + default: + break; + } +} + +void PreferencesEditorPage::widthGridSliderMoved(int value) +{ + SettingsManager::setValue("GridWidth", value); + emit gridChanged(); +} + +void PreferencesEditorPage::indexGridSliderMoved(int value) +{ + SettingsManager::setValue("IndexGrid", value); + emit gridChanged(); +} + +void PreferencesEditorPage::dragAreaSliderMoved(int value) +{ + SettingsManager::setValue("DragArea", value); +} + +void PreferencesEditorPage::save() +{ + SettingsManager::setValue("EmbeddedLinkerIndent", mUi->embeddedLinkerIndentSlider->value()); + SettingsManager::setValue("EmbeddedLinkerSize", mUi->embeddedLinkerSizeSlider->value()); + SettingsManager::setValue("LineType", mUi->lineMode->currentIndex() - 1); + SettingsManager::setValue("LoopEdgeBoundsIndent", mUi->loopEdgeBoundsIndent->value()); + SettingsManager::setValue("ShowGrid", mUi->showGridCheckBox->isChecked()); + SettingsManager::setValue("ShowAlignment", mUi->showAlignmentCheckBox->isChecked()); + SettingsManager::setValue("ActivateGrid", mUi->activateGridCheckBox->isChecked()); + SettingsManager::setValue("ActivateAlignment", mUi->activateAlignmentCheckBox->isChecked()); + SettingsManager::setValue("CustomFont", mUi->fontCheckBox->isChecked()); + SettingsManager::setValue("PaletteRepresentation", mUi->paletteComboBox->currentIndex()); + SettingsManager::setValue("PaletteIconsInARowCount", mUi->paletteSpinBox->value()); + SettingsManager::setValue("MoveLabels", mUi->enableMoveLabelsCheckBox->isChecked()); + SettingsManager::setValue("ResizeLabels", mUi->enableResizeLabelsCheckBox->isChecked()); + SettingsManager::setValue("LabelsDistance", mUi->labelDistanceSlider->value()); + SettingsManager::setValue("manualFontCheckBoxChecked", mUi->fontCheckBox->isChecked()); + + emit paletteRepresentationChanged(); + + mWidthGrid = mUi->gridWidthSlider->value(); + mIndexGrid = mUi->indexGridSlider->value(); + mDragArea = mUi->dragAreaSizeSlider->value(); + SettingsManager::setValue("GridWidth", mWidthGrid); + SettingsManager::setValue("IndexGrid", mIndexGrid); + SettingsManager::setValue("DragArea", mDragArea); + + mShowGridAction->setChecked(mUi->showGridCheckBox->isChecked()); + mShowAlignmentAction->setChecked(mUi->showAlignmentCheckBox->isChecked()); + mActivateGridAction->setChecked(mUi->activateGridCheckBox->isChecked()); + mActivateAlignmentAction->setChecked(mUi->activateAlignmentCheckBox->isChecked()); + + if (mWasChecked != mUi->fontCheckBox->isChecked() || mOldFont != mFont) { + if (mFontButtonWasPressed) { + SettingsManager::setValue("CurrentFont", mFont); + } + + setRestartFlag(); + mFontButtonWasPressed = false; + } +} + +void PreferencesEditorPage::restoreSettings() +{ + mUi->showGridCheckBox->setChecked(SettingsManager::value("ShowGrid").toBool()); + mUi->showAlignmentCheckBox->setChecked(SettingsManager::value("ShowAlignment").toBool()); + mUi->activateGridCheckBox->setChecked(SettingsManager::value("ActivateGrid").toBool()); + mUi->activateAlignmentCheckBox->setChecked(SettingsManager::value("ActivateAlignment").toBool()); + mUi->embeddedLinkerIndentSlider->setValue(SettingsManager::value("EmbeddedLinkerIndent").toInt()); + mUi->embeddedLinkerSizeSlider->setValue(SettingsManager::value("EmbeddedLinkerSize").toInt()); + mUi->loopEdgeBoundsIndent->setValue(SettingsManager::value("LoopEdgeBoundsIndent").toInt()); + + mUi->enableMoveLabelsCheckBox->setChecked(SettingsManager::value("MoveLabels").toBool()); + mUi->enableResizeLabelsCheckBox->setChecked(SettingsManager::value("ResizeLabels").toBool()); + mUi->labelDistanceSlider->setValue(SettingsManager::value("LabelsDistance").toInt()); + +// LinkShape const type = static_cast(SettingsManager::value("LineType", unset).toInt()); +// mUi->lineMode->setCurrentIndex(type + 1); + + mUi->fontCheckBox->setChecked(SettingsManager::value("CustomFont").toBool()); + mUi->fontSelectionButton->setVisible(mUi->fontCheckBox->isChecked()); + mWasChecked = mUi->fontCheckBox->isChecked(); + + mUi->paletteComboBox->setCurrentIndex(SettingsManager::value("PaletteRepresentation").toInt()); + paletteComboBoxClicked(mUi->paletteComboBox->currentIndex()); + mUi->paletteSpinBox->setValue(SettingsManager::value("PaletteIconsInARowCount").toInt()); + mFont = SettingsManager::value("CurrentFont").toString(); + mOldFont = mFont; +} + +void PreferencesEditorPage::paletteComboBoxClicked(int index) +{ + mUi->paletteSpinBox->setEnabled((bool)index); +} + +void PreferencesEditorPage::changePaletteParameters() +{ + mUi->paletteComboBox->setCurrentIndex(SettingsManager::value("PaletteRepresentation").toInt()); + mUi->paletteSpinBox->setValue(SettingsManager::value("PaletteIconsInARowCount").toInt()); +} + +void PreferencesEditorPage::showGrid(bool show) +{ + mUi->showGridCheckBox->setChecked(show); +} + +void PreferencesEditorPage::showAlignment(bool show) +{ + mUi->showAlignmentCheckBox->setChecked(show); +} + +void PreferencesEditorPage::activateGrid(bool activate) +{ + mUi->activateGridCheckBox->setChecked(activate); +} + +void PreferencesEditorPage::activateAlignment(bool activate) +{ + mUi->activateAlignmentCheckBox->setChecked(activate); +} diff --git a/configurationServer/gui/preferencesPages/editorPage.h b/configurationServer/gui/preferencesPages/editorPage.h new file mode 100644 index 0000000..a677078 --- /dev/null +++ b/configurationServer/gui/preferencesPages/editorPage.h @@ -0,0 +1,61 @@ +#pragma once + +#include + +#include "preferencesPages/preferencesPage.h" + +namespace Ui { + class PreferencesEditorPage; +} + +class PreferencesEditorPage : public PreferencesPage +{ + Q_OBJECT + +public: + explicit PreferencesEditorPage(QAction * const showGridAction, QAction * const showAlignmentAction + ,QAction * const activateGridAction, QAction * const activateAlignmentAction, QWidget *parent = 0); + ~PreferencesEditorPage(); + + /// Sets value to palette combo box and spin box respectively/ + void changePaletteParameters(); + void save(); + virtual void restoreSettings(); + +protected: + void changeEvent(QEvent *e); + +signals: + void gridChanged(); + void fontChanged(); + void paletteRepresentationChanged(); + +private slots: + void widthGridSliderMoved(int value); + void indexGridSliderMoved(int value); + void dragAreaSliderMoved(int value); + void manualFontCheckBoxChecked(bool); + void fontSelectionButtonClicked(); + void paletteComboBoxClicked(int index); + + void showGrid(bool); + void showAlignment(bool); + void activateGrid(bool); + void activateAlignment(bool); + +private: + Ui::PreferencesEditorPage *mUi; + int mWidthGrid; + int mIndexGrid; + int mDragArea; + QString mFont; + + bool mFontButtonWasPressed; + bool mWasChecked; + QString mOldFont; + + QAction * const mShowGridAction; + QAction * const mShowAlignmentAction; + QAction * const mActivateGridAction; + QAction * const mActivateAlignmentAction; +}; diff --git a/configurationServer/gui/preferencesPages/editorPage.ui b/configurationServer/gui/preferencesPages/editorPage.ui new file mode 100644 index 0000000..7b7c7b5 --- /dev/null +++ b/configurationServer/gui/preferencesPages/editorPage.ui @@ -0,0 +1,687 @@ + + + PreferencesEditorPage + + + + 0 + 0 + 500 + 638 + + + + + 0 + 0 + + + + + 50 + 50 + + + + + 16777215 + 16777215 + + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 480 + 782 + + + + + + + Font + + + + + + + + 0 + 0 + + + + + 0 + 40 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + true + + + + 0 + 0 + + + + Use some of system fonts + + + + + + + + 0 + 0 + + + + Choose Font + + + + + + + + + + Grid + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + 3 + + + 150 + + + 1 + + + 10 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + Activate alignment + + + true + + + + + + + Cell size + + + + + + + + 0 + 0 + + + + Activate grid + + + false + + + + + + + Width + + + + + + + Show grid + + + true + + + + + + + + 130 + 0 + + + + Show alignment + + + true + + + + + + + + 0 + 0 + + + + 5 + + + 150 + + + 1 + + + 10 + + + 50 + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Node Elements + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 4 + + + 20 + + + 12 + + + Qt::Horizontal + + + + + + + Drag area + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 70 + 0 + 160 + 21 + + + + Qt::Horizontal + + + + + + + + Edge + + + + + + + + 0 + 30 + + + + + 50 + 60 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + unset + + + + + broken + + + + + square + + + + + curve + + + + + + + + Line mode + + + + + + + + 0 + 0 + + + + Loop edges indent + + + + + + + + 0 + 0 + + + + 1 + + + 15 + + + 2 + + + 2 + + + 2 + + + Qt::Horizontal + + + + + + + + + + Embedded Linkers + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 4 + + + 20 + + + Qt::Horizontal + + + + + + + 5 + + + 20 + + + Qt::Horizontal + + + + + + + Size + + + + + + + Indent + + + + + + + + + + Labels + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Enable move + + + true + + + + + + + Enable resize + + + true + + + + + + + Label distance + + + + + + + 500 + + + Qt::Horizontal + + + + + + + + + + Palette + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Representation + + + + + + + Count of items in a row + + + + + + + Qt::LeftToRight + + + false + + + 1 + + + true + + + + Icons and names + + + + + Icons + + + + + + + + 1 + + + 5 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/configurationServer/gui/preferencesPages/featuresPage.cpp b/configurationServer/gui/preferencesPages/featuresPage.cpp new file mode 100644 index 0000000..91ee78e --- /dev/null +++ b/configurationServer/gui/preferencesPages/featuresPage.cpp @@ -0,0 +1,46 @@ +#include "featuresPage.h" +#include "ui_featuresPage.h" + +#include + +using namespace qReal; + +PreferencesFeaturesPage::PreferencesFeaturesPage(QWidget *parent) + : PreferencesPage(parent) + , mUi(new Ui::PreferencesFeaturesPage) +{ + mIcon = QIcon(":/icons/preferences/features.png"); + mUi->setupUi(this); + + restoreSettings(); +} + +PreferencesFeaturesPage::~PreferencesFeaturesPage() +{ + delete mUi; +} + +void PreferencesFeaturesPage::changeEvent(QEvent *e) +{ + switch (e->type()) { + case QEvent::LanguageChange: + mUi->retranslateUi(this); + break; + default: + break; + } +} + +void PreferencesFeaturesPage::save() +{ + SettingsManager::setValue("Gestures", mUi->gesturesCheckBox->isChecked()); + SettingsManager::setValue("EmbeddedLinkers", mUi->embeddedLinkersCheckBox->isChecked()); + SettingsManager::setValue("EmbeddedControls", mUi->embeddedControlsCheckBox->isChecked()); +} + +void PreferencesFeaturesPage::restoreSettings() +{ + mUi->gesturesCheckBox->setChecked(SettingsManager::value("Gestures").toBool()); + mUi->embeddedLinkersCheckBox->setChecked(SettingsManager::value("EmbeddedLinkers").toBool()); + mUi->embeddedControlsCheckBox->setChecked(SettingsManager::value("EmbeddedControls").toBool()); +} diff --git a/configurationServer/gui/preferencesPages/featuresPage.h b/configurationServer/gui/preferencesPages/featuresPage.h new file mode 100644 index 0000000..5f68fa4 --- /dev/null +++ b/configurationServer/gui/preferencesPages/featuresPage.h @@ -0,0 +1,25 @@ +#pragma once + +#include "preferencesPages/preferencesPage.h" + +namespace Ui { + class PreferencesFeaturesPage; +} + +class PreferencesFeaturesPage : public PreferencesPage +{ + Q_OBJECT + +public: + explicit PreferencesFeaturesPage(QWidget *parent = 0); + ~PreferencesFeaturesPage(); + + void save(); + virtual void restoreSettings(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::PreferencesFeaturesPage *mUi; +}; diff --git a/configurationServer/gui/preferencesPages/featuresPage.ui b/configurationServer/gui/preferencesPages/featuresPage.ui new file mode 100644 index 0000000..1b9336e --- /dev/null +++ b/configurationServer/gui/preferencesPages/featuresPage.ui @@ -0,0 +1,98 @@ + + + PreferencesFeaturesPage + + + + 0 + 0 + 500 + 300 + + + + + 0 + 0 + + + + + + + Element controls + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Gestures + + + + + + + fast linking with mouse + + + + + + + fast linking with mouse + + + + + + + Embedded Linkers + + + + + + + fast property editing + + + + + + + Embedded Controls + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/configurationServer/gui/preferencesPages/miscellaniousPage.cpp b/configurationServer/gui/preferencesPages/miscellaniousPage.cpp new file mode 100644 index 0000000..2c83e44 --- /dev/null +++ b/configurationServer/gui/preferencesPages/miscellaniousPage.cpp @@ -0,0 +1,81 @@ +#include "miscellaniousPage.h" +#include "ui_miscellaniousPage.h" + +#include +#include + +using namespace qReal; + +PreferencesMiscellaniousPage::PreferencesMiscellaniousPage(QWidget *parent) + : PreferencesPage(parent) + , mUi(new Ui::PreferencesMiscellaniousPage) +{ + mIcon = QIcon(":/icons/preferences/miscellaneous.png"); + mUi->setupUi(this); + + connect(mUi->imagesPathBrowseButton, SIGNAL(clicked()), this, SLOT(browseImagesPath())); + connect(mUi->toolbarSizeSlider, &QSlider::valueChanged, this, &PreferencesMiscellaniousPage::toolbarSizeChanged); + + mUi->colorComboBox->addItems(QColor::colorNames()); + + restoreSettings(); +} + +PreferencesMiscellaniousPage::~PreferencesMiscellaniousPage() +{ + delete mUi; +} + +void PreferencesMiscellaniousPage::changeEvent(QEvent *e) +{ + switch (e->type()) { + case QEvent::LanguageChange: + mUi->retranslateUi(this); + break; + default: + break; + } +} + +void PreferencesMiscellaniousPage::browseImagesPath() +{ + QString const path = utils::QRealFileDialog::getExistingDirectory("OpenImagesOnMiscellaniousPage" + , this, tr("Open Directory")).replace("\\", "/"); + if (!path.isEmpty()) { + mUi->imagesPathEdit->setText(path); + } +} + +void PreferencesMiscellaniousPage::save() +{ + SettingsManager::setValue("Splashscreen", mUi->splashScreenCheckBox->isChecked()); + SettingsManager::setValue("Antialiasing", mUi->antialiasingCheckBox->isChecked()); + + SettingsManager::setValue("pathToImages", mUi->imagesPathEdit->text()); + SettingsManager::setValue("recentProjectsLimit", mUi->recentProjectsLimitSpinBox->value()); + SettingsManager::setValue("PaintOldEdgeMode", mUi->paintOldLineCheckBox->isChecked()); + SettingsManager::setValue("oldLineColor", mUi->colorComboBox->currentText()); + + SettingsManager::setValue("toolbarSize", mUi->toolbarSizeSlider->value()); + + if (mLastIconsetPath != mUi->imagesPathEdit->text()) { + emit iconsetChanged(); + } +} + +void PreferencesMiscellaniousPage::restoreSettings() +{ + mUi->antialiasingCheckBox->setChecked(SettingsManager::value("Antialiasing").toBool()); + mUi->splashScreenCheckBox->setChecked(SettingsManager::value("Splashscreen").toBool()); + + mUi->paintOldLineCheckBox->setChecked(SettingsManager::value("PaintOldEdgeMode").toBool()); + + QString curColor = SettingsManager::value("oldLineColor").toString(); + int curColorIndex = mUi->colorComboBox->findText(curColor); + mUi->colorComboBox->setCurrentIndex(curColorIndex); + + mUi->toolbarSizeSlider->setValue(SettingsManager::value("toolbarSize").toInt()); + + mLastIconsetPath = SettingsManager::value("pathToImages").toString(); + mUi->imagesPathEdit->setText(mLastIconsetPath); +} diff --git a/configurationServer/gui/preferencesPages/miscellaniousPage.h b/configurationServer/gui/preferencesPages/miscellaniousPage.h new file mode 100644 index 0000000..1db0727 --- /dev/null +++ b/configurationServer/gui/preferencesPages/miscellaniousPage.h @@ -0,0 +1,34 @@ +#pragma once + +#include "preferencesPages/preferencesPage.h" + +namespace Ui { + class PreferencesMiscellaniousPage; +} + +class PreferencesMiscellaniousPage : public PreferencesPage +{ + Q_OBJECT + +public: + explicit PreferencesMiscellaniousPage(QWidget *parent = 0); + ~PreferencesMiscellaniousPage(); + + void save(); + virtual void restoreSettings(); + +signals: + void iconsetChanged(); + void toolbarSizeChanged(int size); + +protected: + void changeEvent(QEvent *e); + +private slots: + void browseImagesPath(); + +private: + Ui::PreferencesMiscellaniousPage *mUi; + + QString mLastIconsetPath; +}; diff --git a/configurationServer/gui/preferencesPages/miscellaniousPage.ui b/configurationServer/gui/preferencesPages/miscellaniousPage.ui new file mode 100644 index 0000000..af08387 --- /dev/null +++ b/configurationServer/gui/preferencesPages/miscellaniousPage.ui @@ -0,0 +1,267 @@ + + + PreferencesMiscellaniousPage + + + + 0 + 0 + 561 + 325 + + + + + 0 + 0 + + + + + + + Graphics + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Antialiasing + + + + + + + + + + Other + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Show splashscreen + + + + + + + Color of old line: + + + + + + + + 170 + 0 + + + + true + + + + + + + true + + + Paint the old line + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + 5 + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Limit recent projects list + + + true + + + + + + + + 0 + 0 + + + + + 40 + 16777215 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 40 + 20 + + + + + + + + + + + + + Images + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Browse + + + + + + + + + + + + + Toolbars + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Size + + + + + + + 20 + + + 50 + + + Qt::Horizontal + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/configurationServer/gui/preferencesPages/preferencesPage.h b/configurationServer/gui/preferencesPages/preferencesPage.h new file mode 100644 index 0000000..b7fb03e --- /dev/null +++ b/configurationServer/gui/preferencesPages/preferencesPage.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include + +/// Abstract class for preferences page +class PreferencesPage : public QWidget +{ + Q_OBJECT + + /// @todo friend to be able to call protected changeEvent() method. It seems to be bad idea. + friend class PreferencesDialog; + +public: + explicit PreferencesPage(QWidget *parent = 0) + : QWidget(parent) + , mShouldRestartSystemToApply(false) + { + } + + virtual ~PreferencesPage() + { + } + + /// This method will be called on pressing "Apply" or "Ok" + virtual void save() = 0; + + /// This method will be called before page is shown and when user pressed "Cancel" + virtual void restoreSettings() = 0; + + /// This method will be called when need to get icon on label in form + virtual QIcon getIcon() const + { + return mIcon; + } + +protected: + /// Indicates the system to prompt system restart after settings applying. + void setRestartFlag() + { + mShouldRestartSystemToApply = true; + } + + /// An icon to be shown near this tab in preferences window + QIcon mIcon; + +private: + /// If this flag is set to true then system restart will be prompted after settings applying. + bool mShouldRestartSystemToApply; +}; diff --git a/configurationServer/gui/qrkernel/Makefile b/configurationServer/gui/qrkernel/Makefile new file mode 100644 index 0000000..6758694 --- /dev/null +++ b/configurationServer/gui/qrkernel/Makefile @@ -0,0 +1,311 @@ +############################################################################# +# Makefile for building: qrkernel +# Generated by qmake (3.0) (Qt 5.2.1) +# Project: qrkernel.pro +# Template: lib +# Command: C:\Qt\5.2.1\mingw48_32\bin\qmake.exe -spec win32-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile qrkernel.pro +############################################################################# + +MAKEFILE = Makefile + +first: debug +install: debug-install +uninstall: debug-uninstall +QMAKE = C:\Qt\5.2.1\mingw48_32\bin\qmake.exe +DEL_FILE = del +CHK_DIR_EXISTS= if not exist +MKDIR = mkdir +COPY = copy /y +COPY_FILE = $(COPY) +COPY_DIR = xcopy /s /q /y /i +INSTALL_FILE = $(COPY_FILE) +INSTALL_PROGRAM = $(COPY_FILE) +INSTALL_DIR = $(COPY_DIR) +DEL_FILE = del +SYMLINK = copy /y +DEL_DIR = rmdir +MOVE = move +SUBTARGETS = \ + debug \ + release + + +debug: FORCE + $(MAKE) -f $(MAKEFILE).Debug +debug-make_first: FORCE + $(MAKE) -f $(MAKEFILE).Debug +debug-all: FORCE + $(MAKE) -f $(MAKEFILE).Debug all +debug-clean: FORCE + $(MAKE) -f $(MAKEFILE).Debug clean +debug-distclean: FORCE + $(MAKE) -f $(MAKEFILE).Debug distclean +debug-install: FORCE + $(MAKE) -f $(MAKEFILE).Debug install +debug-uninstall: FORCE + $(MAKE) -f $(MAKEFILE).Debug uninstall +release: FORCE + $(MAKE) -f $(MAKEFILE).Release +release-make_first: FORCE + $(MAKE) -f $(MAKEFILE).Release +release-all: FORCE + $(MAKE) -f $(MAKEFILE).Release all +release-clean: FORCE + $(MAKE) -f $(MAKEFILE).Release clean +release-distclean: FORCE + $(MAKE) -f $(MAKEFILE).Release distclean +release-install: FORCE + $(MAKE) -f $(MAKEFILE).Release install +release-uninstall: FORCE + $(MAKE) -f $(MAKEFILE).Release uninstall + +Makefile: qrkernel.pro C:/Qt/5.2.1/mingw48_32/mkspecs/win32-g++/qmake.conf C:/Qt/5.2.1/mingw48_32/mkspecs/features/spec_pre.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/qdevice.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/device_config.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/common/shell-win32.conf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/qconfig.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_axbase.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_axbase_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_axcontainer.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_axcontainer_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_axserver.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_axserver_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_bluetooth.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_bluetooth_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_bootstrap_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_clucene_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_concurrent.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_concurrent_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_core.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_core_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_declarative.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_declarative_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_designer.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_designer_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_designercomponents_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_gui.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_gui_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_help.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_help_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_multimedia.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_multimedia_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_multimediawidgets.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_multimediawidgets_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_network.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_network_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_nfc.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_nfc_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_opengl.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_opengl_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_openglextensions.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_openglextensions_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_platformsupport_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_positioning.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_positioning_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_printsupport.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_printsupport_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_qml.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_qml_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_qmldevtools_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_qmltest.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_qmltest_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_quick.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_quick_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_quickparticles_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_script.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_script_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_scripttools.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_scripttools_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_sensors.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_sensors_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_serialport.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_serialport_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_sql.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_sql_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_svg.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_svg_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_testlib.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_testlib_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_uitools.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_uitools_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_webkit.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_webkit_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_webkitwidgets.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_webkitwidgets_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_widgets.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_widgets_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_winextras.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_winextras_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_xml.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_xml_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_xmlpatterns.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/modules/qt_lib_xmlpatterns_private.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/qt_functions.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/qt_config.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/win32-g++/qmake.conf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/spec_post.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/exclusive_builds.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/default_pre.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/win32/default_pre.prf \ + qrkernel.pri \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/resolve_config.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/exclusive_builds_post.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/default_post.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/c++11.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/qml_debug.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/declarative_debug.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/win32/rtti.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/warn_on.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/qt.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/resources.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/moc.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/win32/opengl.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/win32/windows.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/testcase_targets.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/exceptions.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/yacc.prf \ + C:/Qt/5.2.1/mingw48_32/mkspecs/features/lex.prf \ + qrkernel.pro \ + C:/Qt/5.2.1/mingw48_32/lib/Qt5Gui.prl \ + C:/Qt/5.2.1/mingw48_32/lib/Qt5Core.prl + $(QMAKE) -spec win32-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile qrkernel.pro +C:\Qt\5.2.1\mingw48_32\mkspecs\features\spec_pre.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\qdevice.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\device_config.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\common\shell-win32.conf: +C:\Qt\5.2.1\mingw48_32\mkspecs\qconfig.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_axbase.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_axbase_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_axcontainer.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_axcontainer_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_axserver.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_axserver_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_bluetooth.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_bluetooth_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_bootstrap_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_clucene_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_concurrent.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_concurrent_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_core.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_core_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_declarative.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_declarative_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_designer.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_designer_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_designercomponents_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_gui.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_gui_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_help.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_help_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_multimedia.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_multimedia_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_multimediawidgets.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_multimediawidgets_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_network.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_network_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_nfc.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_nfc_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_opengl.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_opengl_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_openglextensions.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_openglextensions_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_platformsupport_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_positioning.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_positioning_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_printsupport.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_printsupport_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_qml.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_qml_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_qmldevtools_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_qmltest.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_qmltest_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_quick.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_quick_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_quickparticles_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_script.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_script_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_scripttools.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_scripttools_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_sensors.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_sensors_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_serialport.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_serialport_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_sql.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_sql_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_svg.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_svg_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_testlib.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_testlib_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_uitools.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_uitools_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_webkit.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_webkit_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_webkitwidgets.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_webkitwidgets_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_widgets.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_widgets_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_winextras.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_winextras_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_xml.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_xml_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_xmlpatterns.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\modules\qt_lib_xmlpatterns_private.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\qt_functions.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\qt_config.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\win32-g++\qmake.conf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\spec_post.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\exclusive_builds.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\default_pre.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\win32\default_pre.prf: +qrkernel.pri: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\resolve_config.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\exclusive_builds_post.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\default_post.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\c++11.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\qml_debug.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\declarative_debug.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\win32\rtti.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\warn_on.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\qt.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\resources.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\moc.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\win32\opengl.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\win32\windows.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\testcase_targets.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\exceptions.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\yacc.prf: +C:\Qt\5.2.1\mingw48_32\mkspecs\features\lex.prf: +qrkernel.pro: +C:/Qt/5.2.1/mingw48_32/lib/Qt5Gui.prl: +C:/Qt/5.2.1/mingw48_32/lib/Qt5Core.prl: +qmake: FORCE + @$(QMAKE) -spec win32-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile qrkernel.pro + +qmake_all: FORCE + +make_first: debug-make_first release-make_first FORCE +all: debug-all release-all FORCE +clean: debug-clean release-clean FORCE + -$(DEL_FILE) ..\bin\libqrkernel.a +distclean: debug-distclean release-distclean FORCE + -$(DEL_FILE) Makefile + +debug-mocclean: + $(MAKE) -f $(MAKEFILE).Debug mocclean +release-mocclean: + $(MAKE) -f $(MAKEFILE).Release mocclean +mocclean: debug-mocclean release-mocclean + +debug-mocables: + $(MAKE) -f $(MAKEFILE).Debug mocables +release-mocables: + $(MAKE) -f $(MAKEFILE).Release mocables +mocables: debug-mocables release-mocables + +check: first +FORCE: + +$(MAKEFILE).Debug: Makefile +$(MAKEFILE).Release: Makefile diff --git a/configurationServer/gui/qrkernel/definitions.h b/configurationServer/gui/qrkernel/definitions.h new file mode 100644 index 0000000..fa71685 --- /dev/null +++ b/configurationServer/gui/qrkernel/definitions.h @@ -0,0 +1,14 @@ +#pragma once + +#include "ids.h" +#include "roles.h" + +namespace qReal { + +/// Separator used in situations where there is need to form path consisting of multiple Ids. +const char ID_PATH_DIVIDER = '#'; + +/// MIME type for drag-and-drop operations inside QReal +QString const DEFAULT_MIME_TYPE = "application/x-real-uml-data"; + +} diff --git a/configurationServer/gui/qrkernel/exception/exception.cpp b/configurationServer/gui/qrkernel/exception/exception.cpp new file mode 100644 index 0000000..5cbd91f --- /dev/null +++ b/configurationServer/gui/qrkernel/exception/exception.cpp @@ -0,0 +1,16 @@ +#include "exception.h" + +#include + +using namespace qReal; + +Exception::Exception(QString const &message) + : mMessage(message) +{ + qDebug() << "QReal exception: " << message; +} + +QString Exception::message() const +{ + return mMessage; +} diff --git a/configurationServer/gui/qrkernel/exception/exception.h b/configurationServer/gui/qrkernel/exception/exception.h new file mode 100644 index 0000000..662c4a5 --- /dev/null +++ b/configurationServer/gui/qrkernel/exception/exception.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include "qrkernel/kernelDeclSpec.h" + +namespace qReal { + +/// Base class for all QReal exceptions. Thrown when "something is wrong" +/// in QReal code. +class QRKERNEL_EXPORT Exception +{ +public: + /// Constructor. + /// @param message Error message. + explicit Exception(QString const &message); + + /// Get error message. + QString message() const; + +private: + /// Error message. + QString const mMessage; +}; + +} diff --git a/configurationServer/gui/qrkernel/ids.cpp b/configurationServer/gui/qrkernel/ids.cpp new file mode 100644 index 0000000..e73cba9 --- /dev/null +++ b/configurationServer/gui/qrkernel/ids.cpp @@ -0,0 +1,195 @@ +#include "ids.h" + +#include +#include + +using namespace qReal; + +Id Id::loadFromString(QString const &string) +{ + QStringList const path = string.split('/'); + Q_ASSERT(path.count() > 0 && path.count() <= 5); + Q_ASSERT(path[0] == "qrm:"); + + Id result; + switch (path.count()) { + case 5: result.mId = path[4]; + // Fall-thru + case 4: result.mElement = path[3]; + // Fall-thru + case 3: result.mDiagram = path[2]; + // Fall-thru + case 2: result.mEditor = path[1]; + // Fall-thru + } + Q_ASSERT(string == result.toString()); + return result; +} + +Id Id::createElementId(QString const &editor, QString const &diagram, QString const &element) +{ + return Id(editor, diagram, element, QUuid::createUuid().toString()); +} + +Id Id::rootId() +{ + return Id("ROOT_ID", "ROOT_ID", "ROOT_ID", "ROOT_ID"); +} + +Id::Id(QString const &editor, QString const &diagram, QString const &element, QString const &id) + : mEditor(editor) + , mDiagram(diagram) + , mElement(element) + , mId(id) +{ + Q_ASSERT(checkIntegrity()); +} + +Id::Id(Id const &base, QString const &additional) + : mEditor(base.mEditor) + , mDiagram(base.mDiagram) + , mElement(base.mElement) + , mId(base.mId) +{ + unsigned const baseSize = base.idSize(); + switch (baseSize) { + case 0: + mEditor = additional; + break; + case 1: + mDiagram = additional; + break; + case 2: + mElement = additional; + break; + case 3: + mId = additional; + break; + default: + Q_ASSERT(!"Can not add a part to Id, it will be too long"); + } + Q_ASSERT(checkIntegrity()); +} + +bool Id::isNull() const +{ + return mEditor.isEmpty() && mDiagram.isEmpty() + && mElement.isEmpty() && mId.isEmpty(); +} + +QString Id::editor() const +{ + return mEditor; +} + +QString Id::diagram() const +{ + return mDiagram; +} + +QString Id::element() const +{ + return mElement; +} + +QString Id::id() const +{ + return mId; +} + +Id Id::type() const +{ + return Id(mEditor, mDiagram, mElement); +} + +Id Id::sameTypeId() const +{ + return Id(mEditor, mDiagram, mElement, QUuid::createUuid().toString()); +} + +unsigned Id::idSize() const +{ + if (!mId.isEmpty()) { + return 4; + } if (!mElement.isEmpty()) { + return 3; + } if (!mDiagram.isEmpty()) { + return 2; + } if (!mEditor.isEmpty()) { + return 1; + } + return 0; +} + +QUrl Id::toUrl() const +{ + return QUrl(toString()); +} + +QString Id::toString() const +{ + QString path = "qrm:/" + mEditor; + if (mDiagram != "") { + path += "/" + mDiagram; + } if (mElement != "") { + path += "/" + mElement; + } if (mId != "") { + path += "/" + mId; + } + return path; +} + +bool Id::checkIntegrity() const +{ + bool emptyPartsAllowed = true; + + if (!mId.isEmpty()) { + emptyPartsAllowed = false; + } + + if (!mElement.isEmpty()) { + emptyPartsAllowed = false; + } else if (!emptyPartsAllowed) { + return false; + } + + if (!mDiagram.isEmpty()) { + emptyPartsAllowed = false; + } else if (!emptyPartsAllowed) { + return false; + } + + if (mEditor.isEmpty() && !emptyPartsAllowed) { + return false; + } + + return true; +} + +QVariant Id::toVariant() const +{ + QVariant result; + result.setValue(*this); + return result; +} + +QVariant IdListHelper::toVariant(IdList const &list) +{ + QVariant v; + v.setValue(list); + return v; +} + +QDataStream& operator<< (QDataStream &out, Id const &id) +{ + out << id.toString(); + return out; +} + +QDataStream& operator>> (QDataStream &in, Id &id) +{ + QString idString; + in >> idString; + id = Id::loadFromString(idString); + return in; +} diff --git a/configurationServer/gui/qrkernel/ids.h b/configurationServer/gui/qrkernel/ids.h new file mode 100644 index 0000000..d5ca167 --- /dev/null +++ b/configurationServer/gui/qrkernel/ids.h @@ -0,0 +1,150 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "kernelDeclSpec.h" + +namespace qReal { + +/// Identifier of model element or element type. Consists of four parts --- +/// editor (metamodel to which our element belongs to), diagram in that editor +/// (a tab in palette where this element will appear), element (type of +/// an element, actually), id (id of an element). +class QRKERNEL_EXPORT Id +{ +public: + /// Loads Id from string in format "qrm:////". + /// @param string A string from which we must load Id. + /// @returns Loaded Id. + static Id loadFromString(QString const &string); + + /// Creates element Id, assigning to its first three parts values passed as + /// parameters and generating new GUID for "id" part. + /// @param editor Editor name of an element (its metamodel). + /// @param diagram Diagram name of an element (tab in a palette). + /// @param element Type name of an element ("Class", for example). + /// @returns Created element Id. + static Id createElementId(QString const &editor, QString const &diagram, QString const &element); + + /// Root Id for a model tree stored in repository. + /// @returns Root id. + static Id rootId(); + + /// Constructor. Takes all four parts of an Id as optional parameters. + /// @param editor Editor part of an Id (metamodel name). + /// @param diagram Diagram part of an Id (palette tab name). + /// @param element Element part of an Id (element type name). + /// @param id Id part of an, mm, Id. Represents identity of a model element. + explicit Id(QString const &editor = "", QString const &diagram = "" + , QString const &element = "", QString const &id = ""); + + /// Convenience constructor, creates Id by given base Id adding new part as + /// a next section. For example, by given editor Id and diagram name + /// constructs diagram Id. + /// @param base Id that will be extended. + /// @param additional Part of Id that will be added to base Id. + Id(Id const &base, QString const &additional); + + /// Returns true if this id is an empty one (same as == Id()) + bool isNull() const; + + /// Converts Id to URI in format "qrm:////". + QUrl toUrl() const; + + /// Returns unique part of an Id. + QString id() const; + + /// Returns editor (metamodel) part of an Id. + QString editor() const; + + /// Returns diagram (palette tab) part of an Id. + QString diagram() const; + + /// Returns element (type) part of an Id. + QString element() const; + + /// Converts Id to string in format "qrm:////". + QString toString() const; + + /// Returns number of parts Id has. + unsigned idSize() const; + + /// Applicable only to element's Ids. Returns type's Id. + Id type() const; + + /// Creates Id of the same type as given Id. + Id sameTypeId() const; + + /// Cast to QVariant. Not an operator, to avoid problems with autocasts. + QVariant toVariant() const; + + // default destructor and copy constuctor are OK +private: + /// Used only for debug. Checks that Id is correct. + bool checkIntegrity() const; + + QString mEditor; + QString mDiagram; + QString mElement; + QString mId; +}; + +/// Id equality operator. Ids are equal when all their parts are equal. +inline bool operator==(Id const &i1, Id const &i2) +{ + return i1.editor() == i2.editor() + && i1.diagram() == i2.diagram() + && i1.element() == i2.element() + && i1.id() == i2.id(); +} + +/// Id inequality operator. +inline bool operator!=(Id const &i1, Id const &i2) +{ + return !(i1 == i2); +} + +/// Comparison operator for using Id in maps +inline bool operator<(Id const &i1, Id const &i2) +{ + return i1.toString() < i2.toString(); +} + +/// Hash function for Id for using it in QHash. +inline uint qHash(Id const &key) +{ + return qHash(key.editor()) ^ qHash(key.diagram()) ^ qHash(key.element()) + ^ qHash(key.id()); +} + +/// Operator for printing Id in QDebug. +inline QDebug operator<<(QDebug dbg, Id const &id) +{ + dbg << id.toString(); + return dbg.space(); +} + +/// Convenience typedef for list of Ids. +typedef QList IdList; + +/// Static class with convenience functions for Id lists. +class QRKERNEL_EXPORT IdListHelper { +public: + static QVariant toVariant(IdList const &list); +}; + +typedef Id Metatype; +} + +// qReal::Id and qReal::IdList could be used straight in QVariant +Q_DECLARE_METATYPE(qReal::Id) + +Q_DECLARE_METATYPE(qReal::IdList) + +QRKERNEL_EXPORT QDataStream& operator<< (QDataStream &out, qReal::Id const &id); +QRKERNEL_EXPORT QDataStream& operator>> (QDataStream &in, qReal::Id &id); diff --git a/configurationServer/gui/qrkernel/kernelDeclSpec.h b/configurationServer/gui/qrkernel/kernelDeclSpec.h new file mode 100644 index 0000000..f3fa22e --- /dev/null +++ b/configurationServer/gui/qrkernel/kernelDeclSpec.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +#ifndef QRKERNEL_EXPORT +# if defined(QRKERNEL_LIBRARY) +# define QRKERNEL_EXPORT Q_DECL_EXPORT +# else +# define QRKERNEL_EXPORT Q_DECL_IMPORT +# endif +#endif diff --git a/configurationServer/gui/qrkernel/qrkernel.pri b/configurationServer/gui/qrkernel/qrkernel.pri new file mode 100644 index 0000000..2ca9a56 --- /dev/null +++ b/configurationServer/gui/qrkernel/qrkernel.pri @@ -0,0 +1,26 @@ +DEFINES += QRKERNEL_LIBRARY + +CONFIG += c++11 + +INCLUDEPATH += \ + $$PWD/.. + +HEADERS += \ + $$PWD/ids.h \ + $$PWD/definitions.h \ + $$PWD/exception/exception.h \ + $$PWD/roles.h \ + $$PWD/settingsManager.h \ + $$PWD/kernelDeclSpec.h \ + $$PWD/timeMeasurer.h \ + $$PWD/version.h \ + +SOURCES += \ + $$PWD/ids.cpp \ + $$PWD/exception/exception.cpp \ + $$PWD/settingsManager.cpp \ + $$PWD/timeMeasurer.cpp \ + $$PWD/version.cpp \ + +RESOURCES += \ + $$PWD/qrkernel.qrc \ diff --git a/configurationServer/gui/qrkernel/qrkernel.pro b/configurationServer/gui/qrkernel/qrkernel.pro new file mode 100644 index 0000000..0c257cc --- /dev/null +++ b/configurationServer/gui/qrkernel/qrkernel.pro @@ -0,0 +1,11 @@ +TEMPLATE = lib + +DESTDIR = ../bin + +OBJECTS_DIR = .obj +MOC_DIR = .moc +RCC_DIR = .moc + +include(qrkernel.pri) + + diff --git a/configurationServer/gui/qrkernel/qrkernel.qrc b/configurationServer/gui/qrkernel/qrkernel.qrc new file mode 100644 index 0000000..6f85c26 --- /dev/null +++ b/configurationServer/gui/qrkernel/qrkernel.qrc @@ -0,0 +1,5 @@ + + + settingsDefaultValues + + diff --git a/configurationServer/gui/qrkernel/roles.h b/configurationServer/gui/qrkernel/roles.h new file mode 100644 index 0000000..cd8539c --- /dev/null +++ b/configurationServer/gui/qrkernel/roles.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include "ids.h" + +namespace qReal { + +namespace roles { + +/// Roles that are heavily used by front-end. Should be present in all entities. +enum { + idRole = Qt::UserRole + 1 // element's ID. e.g. qReal::Id + , logicalIdRole // For elements of graphical model it is an Id of corresponding logical element, + // if any. Otherwise it's Id(). + , positionRole // element's position within current context (model knows which one it is) + , configurationRole // element's configuration (e.g. shape, size) within current context + , fromRole // for edges it's an ID of a node, which this edge starts from. is ignored for nodes + , toRole // for edges it's an ID of a node, which this edge ends on. is ignored for nodes + , fromPortRole // for edges it's a port ID, which this edge starts from. is ignored for nodes + , toPortRole // for edges it's a port ID, which this edge ends on. is ignored for nodes + , customPropertiesBeginRole // generated roles start from this one + // also, `name' is also among the mandatory attributes. it's handled by Qt::EditRole and Qt::DisplayRole +}; +} +} diff --git a/configurationServer/gui/qrkernel/settingsDefaultValues b/configurationServer/gui/qrkernel/settingsDefaultValues new file mode 100644 index 0000000..adabe1e --- /dev/null +++ b/configurationServer/gui/qrkernel/settingsDefaultValues @@ -0,0 +1,65 @@ +ActivateGrid=true +ActivateAlignment=true +Antialiasing=true +arrangeLinks=true +Autosave=true +AutosaveInterval=60 +AutosaveDirPath= +AutosaveFileName=autosave.qrs +buildedFileName=builded +builderPath=gcc +ChaoticEdition=false +CodeFileName=code.c +currentPreferencesTab=0 +debugColor=red +debuggerPath=gdb +debuggerTimeout=750 +debugWorkingDirectory= +diagramCreateSuggestion=true +EmbeddedControls=false +EmbeddedLinkers=true +EmbeddedLinkerSize=6 +gestureDelay=1000 +Gestures=true +GridWidth=10 +IndexGrid=25 +linuxButton=false +maximized=true +maxZoom=5.0 +minZoom=0.27 +OpenGL=true +otherButton=false +PaletteIconsInARowCount=3 +PaletteRepresentation=0 +PaletteTabSwitching=true +pathToQmake= +pathToMake= +pluginExtension= +pos=@Point(0 0) +prefix= +ShowAlignment=true +ShowGrid=true +size=@Size(1024 800) +Splashscreen=true +LineType=0 +MoveLabels = true +ResizeLabels = true +LabelsDistance = 100 +temp= +warningWindow=true +windowsButton=false +workingDir=./save +zoomFactor=1.08 +oldLineColor=magenta +PaintOldEdgeMode=true +pathToImages=./images/iconset1 +toolbarSize=30 +AutosaveTempFile=~tempFile +pythonPath=python +generationTimeout=100 +nodesStateButtonExpands=true +recentProjectsLimit=5 +dragArea = 12 +usabilityTestingMode=false +collectErgonomicValues=true +touchMode=false diff --git a/configurationServer/gui/qrkernel/settingsManager.cpp b/configurationServer/gui/qrkernel/settingsManager.cpp new file mode 100644 index 0000000..fba04c6 --- /dev/null +++ b/configurationServer/gui/qrkernel/settingsManager.cpp @@ -0,0 +1,135 @@ +#include "settingsManager.h" + +#include +#include +#include +#include + +using namespace qReal; + +SettingsManager* SettingsManager::mInstance = nullptr; + +SettingsManager::SettingsManager() + : mSettings("SPbSU", "QReal") +{ + initDefaultValues(); + load(); +} + +SettingsManager::~SettingsManager() +{ +} + +void SettingsManager::setValue(QString const &name, QVariant const &value) +{ + QVariant const oldValue = instance()->value(name); + if (oldValue != value) { + instance()->set(name, value); + emit instance()->settingsChanged(name, oldValue, value); + } +} + +QVariant SettingsManager::value(QString const &key) +{ + return instance()->get(key); +} + +QVariant SettingsManager::value(QString const &key, QVariant const &defaultValue) +{ + return instance()->get(key, defaultValue); +} + +SettingsManager* SettingsManager::instance() +{ + if (mInstance == nullptr) { + mInstance = new SettingsManager(); + } + + return mInstance; + //return nullptr; +} + +void SettingsManager::set(QString const &name, QVariant const &value) +{ + mData[name] = value; +} + +QVariant SettingsManager::get(QString const &name, QVariant const &defaultValue) const +{ + if (mData.contains(name)) { + return mData[name]; + } + + if (mDefaultValues.contains(name) && defaultValue == QVariant()) { + return mDefaultValues[name]; + } + + return defaultValue; +} + +void SettingsManager::saveData() +{ + for (QString const &name : mData.keys()) { + mSettings.setValue(name, mData[name]); + } + + mSettings.sync(); +} + +void SettingsManager::saveSettings(QString const &fileNameForExport) +{ + QSettings settingsForSave(fileNameForExport, QSettings::IniFormat); + for (QString const &name : mData.keys()) { + settingsForSave.setValue(name, mData[name]); + } + + settingsForSave.sync(); +} + +void SettingsManager::load() +{ + for (QString const &name : mSettings.allKeys()) { + mData[name] = mSettings.value(name); + } +} + +void SettingsManager::loadSettings(QString const &fileNameForImport) +{ + mergeSettings(fileNameForImport, mData); + saveData(); +} + +void SettingsManager::initDefaultValues() +{ + mergeSettings(":/settingsDefaultValues", mDefaultValues); +} + +void SettingsManager::loadDefaultSettings(QString const &filePath) +{ + instance()->mergeSettings(filePath, instance()->mDefaultValues); +} + +void SettingsManager::mergeSettings(QString const &fileNameForImport, QHash &target) +{ + QSettings settings(fileNameForImport, QSettings::IniFormat); + for (QString const &name : settings.allKeys()) { + target[name] = settings.value(name); + } +} + +void SettingsManager::clearSettings() +{ + instance()->mSettings.clear(); + instance()->mData.clear(); + instance()->mDefaultValues.clear(); +} + +QString SettingsManager::convertToString() +{ + QString allSettings; + QStringList keyList = mSettings.allKeys(); + for (int i = 0; i < keyList.size(); i++) + allSettings += keyList[i] + "###" + value(keyList[i]).toString() + "#*#"; + + return allSettings; +} diff --git a/configurationServer/gui/qrkernel/settingsManager.h b/configurationServer/gui/qrkernel/settingsManager.h new file mode 100644 index 0000000..ac06c6f --- /dev/null +++ b/configurationServer/gui/qrkernel/settingsManager.h @@ -0,0 +1,91 @@ +#pragma once + +#include +#include +#include +#include + +#include "kernelDeclSpec.h" + +namespace qReal { + +/// Singleton class that allows to change settings in run-time +/// (replaces QSettings). Purpose of this class is to allow two instances +/// of an application coexist without changing each other's settings, +/// by storing settings separately in memory for each instance and syncing +/// them only on start/exit. +class SettingsManager : public QObject +{ + Q_OBJECT + +public: + /// Get value associated with given key from settings. + /// @param key Parameter name. + /// @returns Variant with parameter value. + static QVariant value(QString const &key); + + /// Get value associated with given key from settings with given default value. + /// @param key Parameter name. + /// @param defaultValue Default value, used when parameter not found. + /// @returns Variant with parameter value. + static QVariant value(QString const &key, QVariant const &defaultValue); + + /// Set value associated with given key. + /// @param key Parameter name. + /// @param value Parameter value. + static void setValue(QString const &key, QVariant const &value); + + /// Removes all entries in persistent external storage + static void clearSettings(); + + /// Returns an instance of a singleton. + static SettingsManager *instance(); + + /// Saves settings into persistent external storage (for example, Windows + /// registry), making them available to new instances of an application. + void saveData(); + + /// Saves settings into selected file with name fileNameForExport. + void saveSettings(QString const &fileNameForExport); + + /// Loads settings from persistent external storage into SettingsManager. + void load(); + + /// Merges settings from the given file in INI format. + void loadSettings(QString const &fileNameForImport); + + /// Merges default settings from the given file in INI format. + static void loadDefaultSettings(QString const &filePath); + + /// Convertes settings into QString. + QString convertToString(); + +signals: + /// Emitted each time when settings with the given key were modified. + /// For connection instance() method can be useful. + void settingsChanged(QString const &name, QVariant const &oldValue, QVariant const &newValue); + +private: + /// Private constructor. + SettingsManager(); + ~SettingsManager(); + + void set(QString const &name, QVariant const &value); + QVariant get(QString const &key, QVariant const &defaultValue = QVariant()) const; + + /// Merges settings from the given file in INI format into the given map. + void mergeSettings(QString const &fileNameForImport, QHash &target); + + void initDefaultValues(); + + /// Singleton sole instance. + static SettingsManager *mInstance; + + /// In-memory settings storage. + QHash mData; + QHash mDefaultValues; + /// Persistent settings storage. + QSettings mSettings; +}; + +} diff --git a/configurationServer/gui/qrkernel/timeMeasurer.cpp b/configurationServer/gui/qrkernel/timeMeasurer.cpp new file mode 100644 index 0000000..b0ed0c1 --- /dev/null +++ b/configurationServer/gui/qrkernel/timeMeasurer.cpp @@ -0,0 +1,22 @@ +#include "timeMeasurer.h" + +#include + +using namespace qReal; + +TimeMeasurer::TimeMeasurer(QString const &methodName) + : mStartTime(QDateTime::currentDateTime()) + , mMethodName(methodName) +{ +} + +TimeMeasurer::~TimeMeasurer() +{ + QDateTime currentTime = QDateTime::currentDateTime(); + qDebug() << QString("TimeMeasurer %1: The operation lasted for %2 mseconds") + .arg(mMethodName, QString::number(static_cast(mStartTime.msecsTo(currentTime)))); +} + +void TimeMeasurer::doNothing() +{ +} diff --git a/configurationServer/gui/qrkernel/timeMeasurer.h b/configurationServer/gui/qrkernel/timeMeasurer.h new file mode 100644 index 0000000..5f0d09c --- /dev/null +++ b/configurationServer/gui/qrkernel/timeMeasurer.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +#include "kernelDeclSpec.h" + +namespace qReal { + +/// Measures time interval between its creation and deletion, writes results +/// to qDebug. Used for profiling. +class QRKERNEL_EXPORT TimeMeasurer +{ +public: + /// Constructor. + /// @param methodName A name of a method or part of program to be measured. + explicit TimeMeasurer(QString const &methodName); + + /// Destructor. Calling it indicates end of measured interval. + ~TimeMeasurer(); + + /// This method is used to avoid unused variables problem, + /// because sometimes the functionality of the object of this class + /// is limited to the functionality in destructor. + void doNothing(); + +private: + /// Time of start of measured interval. + QDateTime mStartTime; + + /// Name of a method to measure. + QString mMethodName; +}; +} diff --git a/configurationServer/gui/qrkernel/version.cpp b/configurationServer/gui/qrkernel/version.cpp new file mode 100644 index 0000000..f365203 --- /dev/null +++ b/configurationServer/gui/qrkernel/version.cpp @@ -0,0 +1,158 @@ +#include "version.h" + +#include + +using namespace qReal; + +Version Version::fromString(QString const &version) +{ + QStringList const dashParts = version.split("-", QString::SkipEmptyParts); + QStringList const spaceParts = version.split(" ", QString::SkipEmptyParts); + if (dashParts.isEmpty() || spaceParts.isEmpty() || dashParts.count() > 2 || spaceParts.count() > 2) { + return Version(); + } + + QStringList const parts = dashParts.count() == 2 ? dashParts : spaceParts; + QString const prefix = parts[0]; + QString const suffix = parts.count() == 1 ? QString() : parts[1]; + + bool success = true; + bool currentIsOk; + + QStringList const numbers = prefix.split(".", QString::SkipEmptyParts); + if (numbers.isEmpty() || numbers.count() > 3) { + return Version(); + } + + QString const majorString = numbers[0]; + QString const minorString = numbers.count() > 1 ? numbers[1] : "0"; + QString const buildString = numbers.count() > 2 ? numbers[2] : "0"; + + int const major = majorString.toInt(¤tIsOk); + success &= currentIsOk; + int const minor = minorString.toInt(¤tIsOk); + success &= currentIsOk; + int const build = buildString.toInt(¤tIsOk); + success &= currentIsOk; + + if (suffix.isEmpty() && success) { + return Version(major, minor, build); + } + + // Splitting string into two parts: first is maximum letter prefix, second is remaining part. + QString letterSuffix; + QString numberSuffix; + bool iteratingFirstPart = true; + for (QChar const ch : suffix) { + if (!ch.isLetter() && iteratingFirstPart) { + iteratingFirstPart = false; + } + + if (iteratingFirstPart) { + letterSuffix.append(ch); + } else { + numberSuffix.append(ch); + } + } + + if (numberSuffix.isEmpty()) { + numberSuffix = "0"; + } + + Stage const stage = parseStage(letterSuffix, currentIsOk); + success &= currentIsOk; + int const stageNumber = numberSuffix.toInt(¤tIsOk); + success &= currentIsOk; + + if (!success) { + return Version(); + } + + return Version(major, minor, build, stage, stageNumber); +} + +Version::Stage Version::parseStage(QString const &stage, bool &ok) +{ + Stage result = stable; + ok = false; + if (stage.toLower() == "a" || stage.toLower() == "alpha") { + ok = true; + result = alpha; + } else if (stage.toLower() == "b" || stage.toLower() == "beta") { + ok = true; + result = beta; + } else if (stage.toLower() == "rc" || stage.toLower() == "releaseCandidate") { + ok = true; + result = releaseCandidate; + } + + return result; +} + +Version::Version() + : mMajor(-1) + , mMinor(-1) + , mBuild(-1) + , mStage(stable) + , mStageNumber(-1) +{ +} + +Version::Version(int major, int minor, int build, Version::Stage stage, int stageNumber) + : mMajor(major) + , mMinor(minor) + , mBuild(build) + , mStage(stage) + , mStageNumber(stageNumber) +{ +} + +bool Version::isValid() const +{ + return mMajor >= 0; +} + +int qReal::Version::major() const +{ + return mMajor; +} + +int qReal::Version::minor() const +{ + return mMinor; +} + +int Version::build() const +{ + return mBuild; +} + +Version::Stage Version::stage() const +{ + return mStage; +} + +int Version::stageNumber() const +{ + return mStageNumber; +} + +QString Version::toString() const +{ + return QString("%1.%2.%3").arg(QString::number(mMajor) + , QString::number(mMinor), QString::number(mBuild)) + suffixString(); +} + +QString Version::suffixString() const +{ + switch (mStage) { + case alpha: + return QString("-alpha%1").arg(QString::number(mStageNumber)); + case beta: + return QString("-beta%1").arg(QString::number(mStageNumber)); + case releaseCandidate: + return QString("-rc%1").arg(QString::number(mStageNumber)); + default: + return QString(); + } +} diff --git a/configurationServer/gui/qrkernel/version.h b/configurationServer/gui/qrkernel/version.h new file mode 100644 index 0000000..5d3bc9d --- /dev/null +++ b/configurationServer/gui/qrkernel/version.h @@ -0,0 +1,150 @@ +#pragma once + +#include +#include +#include +#include + +#include "kernelDeclSpec.h" + +namespace qReal { + +/// Represents a version of an editor. String representation is expected to consist +/// of four parts: . +/// Major, Minor, Build and Number parts are simply integer numbers. +/// Stage is one of "alpha" (or "a"), "beta" (or "b") or "rc" markers. +/// Stage part is also can be separated by spaces from the number part. +/// Minor, Build, Stage and Number parts are optional. +/// +/// Versions can be compared each to other. Version1 is less than Version2 +/// if Version1 was released earlier than Version2. Examples: +/// +/// 2.5.3 < 3.0.0 +/// 3.0.0-a < 3.0.0-rc1 +/// 3.0.0-rc1 < 3.0.0 +/// 3.0.0 == 3 +class QRKERNEL_EXPORT Version +{ +public: + /// Represents release stage. + enum Stage + { + /// Testing inside team. + alpha = 0 + /// Testing inside community. + , beta + /// Version that seems to be stable. + , releaseCandidate + /// Stable version, used when no suffix specified. + , stable + }; + + /// Constructs new Version instance from a given string. + /// Version() is returned when input string could not be parsed. + static Version fromString(QString const &version); + + /// Constructs invalid version instance. + Version(); + + /// Constructs a version object from a number parts. For constructing a version object from string + /// use fromString() method. + /// @see fromString() + Version(int major, int minor = 0, int build = 0, Stage stage = stable, int stageNumber = 0); + + /// Returns true if version string was accepted by versions parser. + bool isValid() const; + + /// Returns a major part of the version (first part) + int major() const; + + /// Returns a major part of the version (second part). 0 is returned when no minor version was specified. + int minor() const; + + /// Returns a build part of the version (third part). 0 is returned when no build version was specified. + int build() const; + + /// Returns a stage part of the version (suffix part). 'stable' is returned when no stage was specified. + Stage stage() const; + + /// Returns a stage number part of the version (optional number in stage suffix). + /// 0 is returned when no stage version was specified. + int stageNumber() const; + + /// Returns version in form. + /// @warning: returned by this method version string may differ form input one. + QString toString() const; + +private: + static Stage parseStage(QString const &stage, bool &ok); + QString suffixString() const; + + int mMajor; + int mMinor; + int mBuild; + Stage mStage; + int mStageNumber; +}; + +/// Versions equality operator. Versions are equal when all their parts are equal. +inline bool operator==(Version const &v1, Version const &v2) +{ + return v1.major() == v2.major() + && v1.minor() == v2.minor() + && v1.build() == v2.build() + && v1.stage() == v2.stage() + && v1.stageNumber() == v2.stageNumber(); +} + +/// Version inequality operator. +inline bool operator!=(Version const &v1, Version const &v2) +{ + return !(v1 == v2); +} + +/// Less comparison operator for Version class +inline bool operator<(Version const &v1, Version const &v2) +{ + return v1.major() != v2.major() ? v1.major() < v2.major() + : v1.minor() != v2.minor() ? v1.minor() < v2.minor() + : v1.build() != v2.build() ? v1.build() < v2.build() + : v1.stage() != v2.stage() ? v1.stage() < v2.stage() + : v1.stageNumber() < v2.stageNumber(); +} + +/// Greater comparison operator for Version class +inline bool operator>(Version const &v1, Version const &v2) +{ + return !(v1 == v2) && !(v1 < v2); +} + +/// Less or equal comparison operator for Version class +inline bool operator<=(Version const &v1, Version const &v2) +{ + return v1 == v2 || v1 < v2; +} + +/// Greater or equal comparison operator for Version class +inline bool operator>=(Version const &v1, Version const &v2) +{ + return !(v1 < v2); +} + +/// Version hash function for using it in QHash. +inline uint qHash(Version const &key) +{ + return qHash(key.toString()); +} + +/// Operator for printing Version into QDebug. +inline QDebug operator<<(QDebug &dbg, Version const &version) +{ + dbg << version.toString(); + return dbg.space(); +} + +} + +Q_DECLARE_METATYPE(qReal::Version) + +QRKERNEL_EXPORT QDataStream& operator<< (QDataStream &out, qReal::Version const &version); +QRKERNEL_EXPORT QDataStream& operator>> (QDataStream &in, qReal::Version &version); diff --git a/configurationServer/gui/qrutils/qRealDialog.cpp b/configurationServer/gui/qrutils/qRealDialog.cpp new file mode 100644 index 0000000..1227572 --- /dev/null +++ b/configurationServer/gui/qrutils/qRealDialog.cpp @@ -0,0 +1,58 @@ +#include "qRealDialog.h" + +#include + +using namespace utils; +using namespace qReal; + +QRealDialog::QRealDialog(QString const &id, QWidget *parent) + : QDialog(parent) + , mId(id) +{ +} + +void QRealDialog::showEvent(QShowEvent *event) +{ + QDialog::showEvent(event); + deserializeParameters(); +} + +void QRealDialog::closeEvent(QCloseEvent *event) +{ + serializeParameters(); + QDialog::closeEvent(event); +} + +void QRealDialog::serializeParameters() +{ + SettingsManager::setValue(maximizedKey(), isMaximized()); + SettingsManager::setValue(positionKey(), pos()); + SettingsManager::setValue(sizeKey(), size()); +} + +void QRealDialog::deserializeParameters() +{ + if (SettingsManager::value(maximizedKey()).toBool()) { + setWindowState(windowState() | Qt::WindowMaximized); + } else { + if (SettingsManager::value(sizeKey()).toSize().isValid()) { + move(SettingsManager::value(positionKey()).toPoint()); + resize(SettingsManager::value(sizeKey()).toSize()); + } + } +} + +QString QRealDialog::maximizedKey() const +{ + return mId + "WasMaximized"; +} + +QString QRealDialog::positionKey() const +{ + return mId + "LastPosition"; +} + +QString QRealDialog::sizeKey() const +{ + return mId + "LastSize"; +} diff --git a/configurationServer/gui/qrutils/qRealDialog.h b/configurationServer/gui/qrutils/qRealDialog.h new file mode 100644 index 0000000..0771c95 --- /dev/null +++ b/configurationServer/gui/qrutils/qRealDialog.h @@ -0,0 +1,40 @@ +#pragma once + +#include + +#include "utilsDeclSpec.h" + +namespace utils { + +/// A base class for all system dialogs. Provides such tools like automatic +/// serialization of dialog`s position and size +class QRealDialog : public QDialog +{ + Q_OBJECT + +public: + /// @param id The name of this dialog. Used for storing dialog`s parameters + ///in settings so should be unique. + explicit QRealDialog(QString const &id, QWidget *parent = 0); + +protected: + virtual void showEvent(QShowEvent *); + virtual void closeEvent(QCloseEvent *); + + void serializeParameters(); + void deserializeParameters(); + + /// Returns a key string used for storing maximized parameter in registry + virtual QString maximizedKey() const; + + /// Returns a key string used for storing position parameter in registry + virtual QString positionKey() const; + + /// Returns a key string used for storing size parameter in registry + virtual QString sizeKey() const; + +private: + QString const mId; +}; + +} diff --git a/configurationServer/gui/qrutils/qRealFileDialog.cpp b/configurationServer/gui/qrutils/qRealFileDialog.cpp new file mode 100644 index 0000000..66a6ef4 --- /dev/null +++ b/configurationServer/gui/qrutils/qRealFileDialog.cpp @@ -0,0 +1,88 @@ +#include "qRealFileDialog.h" + +#include + +using namespace utils; + +QString QRealFileDialog::getOpenFileName(QString const &id + , QWidget *parent + , QString const &caption + , QString const &dir + , QString const &filter + , QString *selectedFilter + , QFileDialog::Options options) +{ + QString const lastDir = lastSelectedDirectory(id, dir); + QString const result = QFileDialog::getOpenFileName(parent, caption, lastDir, filter, selectedFilter, options); + saveState(id, directoryOf(result)); + return result; +} + +QString QRealFileDialog::getSaveFileName(QString const &id + , QWidget *parent + , QString const &caption + , QString const &dir + , QString const &filter + , QString *selectedFilter + , QFileDialog::Options options) +{ + QString const lastDir = lastSelectedDirectory(id, dir); + QString const result = QFileDialog::getSaveFileName(parent, caption, lastDir, filter, selectedFilter, options); + saveState(id, directoryOf(result)); + return result; +} + +QString QRealFileDialog::getExistingDirectory(QString const &id + , QWidget *parent + , QString const &caption + , QString const &dir + , QFileDialog::Options options) +{ + QString const lastDir = lastSelectedDirectory(id, dir); + QString const result = QFileDialog::getExistingDirectory(parent, caption, lastDir, options); + saveState(id, result); + return result; +} + +QStringList QRealFileDialog::getOpenFileNames(QString const &id + , QWidget *parent + , QString const &caption + , QString const &dir + , QString const &filter + , QString *selectedFilter + , QFileDialog::Options options) +{ + QString const lastDir = lastSelectedDirectory(id, dir); + QStringList const result = QFileDialog::getOpenFileNames(parent, caption, lastDir, filter, selectedFilter, options); + if (!result.isEmpty()) { + saveState(id, directoryOf(result[0])); + } + + return result; +} + +QString QRealFileDialog::lastSelectedDirectory(QString const &id, QString const &defaultDirectory) +{ + return qReal::SettingsManager::value(lastDirectoryKey(id), defaultDirectory).toString(); +} + +QString QRealFileDialog::lastDirectoryKey(QString const &id) +{ + return id + "FileDialogLastDir"; +} + +QString QRealFileDialog::directoryOf(QString const &file) +{ + if (file.isEmpty()) { + return QString(); + } + + return QFileInfo(file).absoluteDir().absolutePath(); +} + +void QRealFileDialog::saveState(QString const &id, QString const &directory) +{ + if (!directory.isEmpty()) { + qReal::SettingsManager::setValue(lastDirectoryKey(id), directory); + } +} diff --git a/configurationServer/gui/qrutils/qRealFileDialog.h b/configurationServer/gui/qrutils/qRealFileDialog.h new file mode 100644 index 0000000..fe0728f --- /dev/null +++ b/configurationServer/gui/qrutils/qRealFileDialog.h @@ -0,0 +1,59 @@ +#pragma once + +#include + +#include "utilsDeclSpec.h" + +namespace utils { + +/// Provides a dialog that allow users to select files or directories +/// with saving in settings last selected diractory +class QRealFileDialog +{ +public: + /// Makes same as QFileDialog::getOpenFileName but with restoring selected + /// directory last time when promted dialog with the same id + static QString getOpenFileName(QString const &id + , QWidget *parent = 0 + , QString const &caption = QString() + , QString const &dir = QString() + , QString const &filter = QString() + , QString *selectedFilter = 0 + , QFileDialog::Options options = 0); + + /// Makes same as QFileDialog::getSaveFileName but with restoring selected + /// directory last time when promted dialog with the same id + static QString getSaveFileName(QString const &id + , QWidget *parent = 0 + , QString const &caption = QString() + , QString const &dir = QString() + , QString const &filter = QString() + , QString *selectedFilter = 0 + , QFileDialog::Options options = 0); + + /// Makes same as QFileDialog::getExistingDirectory but with restoring selected + /// directory last time when promted dialog with the same id + static QString getExistingDirectory(QString const &id + , QWidget *parent = 0 + , QString const &caption = QString() + , QString const &dir = QString() + , QFileDialog::Options options = QFileDialog::ShowDirsOnly); + + /// Makes same as QFileDialog::getOpenFileNames but with restoring selected + /// directory last time when promted dialog with the same id + static QStringList getOpenFileNames(QString const &id + , QWidget *parent = 0 + , QString const &caption = QString() + , QString const &dir = QString() + , QString const &filter = QString() + , QString *selectedFilter = 0 + , QFileDialog::Options options = 0); + +private: + static QString lastSelectedDirectory(QString const &id, QString const &defaultDirectory); + static QString lastDirectoryKey(QString const &id); + static QString directoryOf(QString const &file); + static void saveState(QString const &id, QString const &directory); +}; + +} diff --git a/configurationServer/gui/qrutils/utilsDeclSpec.h b/configurationServer/gui/qrutils/utilsDeclSpec.h new file mode 100644 index 0000000..79e03af --- /dev/null +++ b/configurationServer/gui/qrutils/utilsDeclSpec.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +#ifndef QRUTILS_EXPORT +# if defined(QRUTILS_LIBRARY) +# define QRUTILS_EXPORT Q_DECL_EXPORT +# else +# define QRUTILS_EXPORT Q_DECL_IMPORT +# endif +#endif diff --git a/configurationServer/gui/server/main.cpp b/configurationServer/gui/server/main.cpp new file mode 100644 index 0000000..f728958 --- /dev/null +++ b/configurationServer/gui/server/main.cpp @@ -0,0 +1,11 @@ +#include "server.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Server w; + w.show(); + + return a.exec(); +} diff --git a/configurationServer/gui/server/server.cpp b/configurationServer/gui/server/server.cpp new file mode 100644 index 0000000..6e27f6c --- /dev/null +++ b/configurationServer/gui/server/server.cpp @@ -0,0 +1,105 @@ +#include "server.h" + +Server::Server(QWidget *parent) : + QDialog(parent), + mTcpServer(0), + mNetworkSession(0) { + QNetworkConfigurationManager manager; + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { + // Get saved network configuration + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); + settings.endGroup(); + + // If the saved network configuration is not currently discovered use the system default + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if ((config.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { + config = manager.defaultConfiguration(); + } + + mNetworkSession = new QNetworkSession(config, this); + connect(mNetworkSession, SIGNAL(opened()), this, SLOT(sessionOpened())); + + mNetworkSession->open(); + } else { + sessionOpened(); + } + + mIPAddressMapper = new QSignalMapper; + connect(mTcpServer, SIGNAL(newConnection()), this, SLOT(acceptClientConnection())); + connect(mIPAddressMapper, SIGNAL(mapped(QString)), this, SIGNAL(clientDisconnected(QString))); +} + +void Server::sessionOpened() +{ + // Save the used configuration + if (mNetworkSession) { + QNetworkConfiguration config = mNetworkSession->configuration(); + QString id; + if (config.type() == QNetworkConfiguration::UserChoice) + id = mNetworkSession->sessionProperty(QLatin1String("UserChoiceConfiguration")).toString(); + else + id = config.identifier(); + + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("QtNetwork")); + settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id); + settings.endGroup(); + } + + mTcpServer = new QTcpServer(this); + if (!mTcpServer->listen(QHostAddress::AnyIPv4, 55555)) { + QMessageBox::critical(this, tr("qReal Server"), + tr("Unable to start the server: %1.") + .arg(mTcpServer->errorString())); + close(); + return; + } +} + +void Server::acceptClientConnection() +{ + QTcpSocket* clientSocket = mTcpServer->nextPendingConnection(); + emit newClient(clientSocket->peerAddress().toString()); + int idusersocs = clientSocket->socketDescriptor(); + mSClients[idusersocs] = clientSocket; + connect(mSClients[idusersocs], SIGNAL(disconnected()), mIPAddressMapper, SLOT(map())); + mIPAddressMapper->setMapping(mSClients[idusersocs], mSClients[idusersocs]->peerAddress().toString()); + connect(mSClients[idusersocs], SIGNAL(disconnected()), mSClients[idusersocs], SLOT(deleteLater())); + sendSettings(); +} + +void Server::sendSettings() +{ + if(!mSClients.isEmpty()) { + QByteArray block; + QDataStream out(&block, QIODevice::WriteOnly); + + out << (quint16)qReal::SettingsManager::instance()->convertToString().length(); + out << qReal::SettingsManager::instance()->convertToString(); + foreach(int i, mSClients.keys()) { + mSClients[i]->write(block); + } + } +} + +quint16 Server::getPort() +{ + return mTcpServer->serverPort(); +} + +QString Server::getIP() +{ + QList addressList = QNetworkInterface::allInterfaces(); + QString address; + for (int j = 0; j < addressList.size(); j++) { + QList addressEntry = addressList[j].addressEntries(); + for (int i = 0; i < addressEntry.size(); i++) + if (!addressEntry[i].ip().isLoopback() + && addressEntry[i].ip().toString().contains(".")) + address += addressEntry[i].ip().toString() + "\n"; + } + + return address; +} diff --git a/configurationServer/gui/server/server.h b/configurationServer/gui/server/server.h new file mode 100644 index 0000000..59fdc4a --- /dev/null +++ b/configurationServer/gui/server/server.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include + +#include "qrkernel/settingsManager.h" + +class Server : public QDialog { + Q_OBJECT + +public: + explicit Server(QWidget *parent = 0); + /// returns a string, including all IPv4 addresses of this computer + QString getIP(); + /// returns port to coonect this server + quint16 getPort(); + +protected: + /// sends his qReal settings to client + void sendSettings(); + +private slots: + void sessionOpened(); + void acceptClientConnection(); + +signals: + /// emits new client's IP, when connected + void newClient(QString clientIP); + /// emits IP of disconnected client + void clientDisconnected(QString clientsIP); + +private: + /// storage of all clients + QMap mSClients; + QTcpServer *mTcpServer; + QNetworkSession *mNetworkSession; + QSignalMapper *mIPAddressMapper; +}; + diff --git a/configurationServer/gui/server/server.pro b/configurationServer/gui/server/server.pro new file mode 100644 index 0000000..b485fe8 --- /dev/null +++ b/configurationServer/gui/server/server.pro @@ -0,0 +1,27 @@ +HEADERS = server.h \ + settingsManager.h \ + kernelDeclSpec.h + SOURCES = server.cpp \ + main.cpp \ + settingsManager.cpp + QT += network + QT += core gui widgets + CONFIG += c++11 + + # install + target.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver + sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS fortuneserver.pro + sources.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver + INSTALLS += target sources + + symbian { + TARGET.UID3 = 0xA000E406 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + TARGET.CAPABILITY = "NetworkServices ReadUserData" + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + } + maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + + symbian: warning(This example might not fully work on Symbian platform) + maemo5: warning(This example might not fully work on Maemo platform) + simulator: warning(This example might not fully work on Simulator platform) diff --git a/configurationServer/gui/ui_behaviourPage.h b/configurationServer/gui/ui_behaviourPage.h new file mode 100644 index 0000000..7165054 --- /dev/null +++ b/configurationServer/gui/ui_behaviourPage.h @@ -0,0 +1,219 @@ +/******************************************************************************** +** Form generated from reading UI file 'behaviourPage.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_BEHAVIOURPAGE_H +#define UI_BEHAVIOURPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_PreferencesBehaviourPage +{ +public: + QVBoxLayout *verticalLayout; + QLabel *label_2; + QFrame *frame_2; + QFormLayout *formLayout; + QLabel *label_3; + QComboBox *languageComboBox; + QLabel *label_7; + QFrame *frame_5; + QGridLayout *gridLayout; + QSpinBox *gestureDelaySpinBox; + QLabel *autoSaveLabel; + QLabel *gestureDelayTimeUnitLabel; + QLabel *gestureDelayLabel; + QCheckBox *paletteTabCheckBox; + QSpinBox *autoSaveSpinBox; + QCheckBox *autoSaveCheckBox; + QCheckBox *collectErgonomicValuesCheckBox; + QCheckBox *usabilityModeCheckBox; + QLabel *label; + QFrame *frame; + QVBoxLayout *verticalLayout_2; + QCheckBox *touchModeCheckBox; + QSpacerItem *verticalSpacer; + + void setupUi(QWidget *PreferencesBehaviourPage) + { + if (PreferencesBehaviourPage->objectName().isEmpty()) + PreferencesBehaviourPage->setObjectName(QStringLiteral("PreferencesBehaviourPage")); + PreferencesBehaviourPage->resize(500, 340); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(PreferencesBehaviourPage->sizePolicy().hasHeightForWidth()); + PreferencesBehaviourPage->setSizePolicy(sizePolicy); + verticalLayout = new QVBoxLayout(PreferencesBehaviourPage); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + label_2 = new QLabel(PreferencesBehaviourPage); + label_2->setObjectName(QStringLiteral("label_2")); + + verticalLayout->addWidget(label_2); + + frame_2 = new QFrame(PreferencesBehaviourPage); + frame_2->setObjectName(QStringLiteral("frame_2")); + frame_2->setFrameShape(QFrame::StyledPanel); + frame_2->setFrameShadow(QFrame::Raised); + formLayout = new QFormLayout(frame_2); + formLayout->setObjectName(QStringLiteral("formLayout")); + label_3 = new QLabel(frame_2); + label_3->setObjectName(QStringLiteral("label_3")); + + formLayout->setWidget(0, QFormLayout::LabelRole, label_3); + + languageComboBox = new QComboBox(frame_2); + languageComboBox->setObjectName(QStringLiteral("languageComboBox")); + + formLayout->setWidget(0, QFormLayout::FieldRole, languageComboBox); + + + verticalLayout->addWidget(frame_2); + + label_7 = new QLabel(PreferencesBehaviourPage); + label_7->setObjectName(QStringLiteral("label_7")); + + verticalLayout->addWidget(label_7); + + frame_5 = new QFrame(PreferencesBehaviourPage); + frame_5->setObjectName(QStringLiteral("frame_5")); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(frame_5->sizePolicy().hasHeightForWidth()); + frame_5->setSizePolicy(sizePolicy1); + frame_5->setFrameShape(QFrame::StyledPanel); + frame_5->setFrameShadow(QFrame::Raised); + gridLayout = new QGridLayout(frame_5); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + gestureDelaySpinBox = new QSpinBox(frame_5); + gestureDelaySpinBox->setObjectName(QStringLiteral("gestureDelaySpinBox")); + gestureDelaySpinBox->setMaximum(100000); + gestureDelaySpinBox->setSingleStep(10); + + gridLayout->addWidget(gestureDelaySpinBox, 2, 1, 1, 1); + + autoSaveLabel = new QLabel(frame_5); + autoSaveLabel->setObjectName(QStringLiteral("autoSaveLabel")); + + gridLayout->addWidget(autoSaveLabel, 1, 2, 1, 1); + + gestureDelayTimeUnitLabel = new QLabel(frame_5); + gestureDelayTimeUnitLabel->setObjectName(QStringLiteral("gestureDelayTimeUnitLabel")); + + gridLayout->addWidget(gestureDelayTimeUnitLabel, 2, 2, 1, 1); + + gestureDelayLabel = new QLabel(frame_5); + gestureDelayLabel->setObjectName(QStringLiteral("gestureDelayLabel")); + + gridLayout->addWidget(gestureDelayLabel, 2, 0, 1, 1); + + paletteTabCheckBox = new QCheckBox(frame_5); + paletteTabCheckBox->setObjectName(QStringLiteral("paletteTabCheckBox")); + + gridLayout->addWidget(paletteTabCheckBox, 0, 0, 1, 3); + + autoSaveSpinBox = new QSpinBox(frame_5); + autoSaveSpinBox->setObjectName(QStringLiteral("autoSaveSpinBox")); + autoSaveSpinBox->setMinimum(1); + autoSaveSpinBox->setMaximum(10000); + autoSaveSpinBox->setSingleStep(1); + autoSaveSpinBox->setValue(600); + + gridLayout->addWidget(autoSaveSpinBox, 1, 1, 1, 1); + + autoSaveCheckBox = new QCheckBox(frame_5); + autoSaveCheckBox->setObjectName(QStringLiteral("autoSaveCheckBox")); + autoSaveCheckBox->setChecked(true); + + gridLayout->addWidget(autoSaveCheckBox, 1, 0, 1, 1); + + collectErgonomicValuesCheckBox = new QCheckBox(frame_5); + collectErgonomicValuesCheckBox->setObjectName(QStringLiteral("collectErgonomicValuesCheckBox")); + collectErgonomicValuesCheckBox->setChecked(true); + + gridLayout->addWidget(collectErgonomicValuesCheckBox, 3, 0, 1, 1); + + usabilityModeCheckBox = new QCheckBox(frame_5); + usabilityModeCheckBox->setObjectName(QStringLiteral("usabilityModeCheckBox")); + + gridLayout->addWidget(usabilityModeCheckBox, 4, 0, 1, 1); + + + verticalLayout->addWidget(frame_5); + + label = new QLabel(PreferencesBehaviourPage); + label->setObjectName(QStringLiteral("label")); + + verticalLayout->addWidget(label); + + frame = new QFrame(PreferencesBehaviourPage); + frame->setObjectName(QStringLiteral("frame")); + frame->setFrameShape(QFrame::StyledPanel); + frame->setFrameShadow(QFrame::Raised); + verticalLayout_2 = new QVBoxLayout(frame); + verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); + touchModeCheckBox = new QCheckBox(frame); + touchModeCheckBox->setObjectName(QStringLiteral("touchModeCheckBox")); + + verticalLayout_2->addWidget(touchModeCheckBox); + + + verticalLayout->addWidget(frame); + + verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + verticalLayout->addItem(verticalSpacer); + + + retranslateUi(PreferencesBehaviourPage); + + QMetaObject::connectSlotsByName(PreferencesBehaviourPage); + } // setupUi + + void retranslateUi(QWidget *PreferencesBehaviourPage) + { + label_2->setText(QApplication::translate("PreferencesBehaviourPage", "User Interface", 0)); + label_3->setText(QApplication::translate("PreferencesBehaviourPage", "Language", 0)); + label_7->setText(QApplication::translate("PreferencesBehaviourPage", "Automatics", 0)); + autoSaveLabel->setText(QApplication::translate("PreferencesBehaviourPage", "sec", 0)); + gestureDelayTimeUnitLabel->setText(QApplication::translate("PreferencesBehaviourPage", "msec", 0)); + gestureDelayLabel->setText(QApplication::translate("PreferencesBehaviourPage", "Delay after gesture", 0)); + paletteTabCheckBox->setText(QApplication::translate("PreferencesBehaviourPage", "Palette tab switching", 0)); + autoSaveCheckBox->setText(QApplication::translate("PreferencesBehaviourPage", "Autosave", 0)); + collectErgonomicValuesCheckBox->setText(QApplication::translate("PreferencesBehaviourPage", "Collect ergonomic values", 0)); + usabilityModeCheckBox->setText(QApplication::translate("PreferencesBehaviourPage", "Usability testing mode", 0)); + label->setText(QApplication::translate("PreferencesBehaviourPage", "Touch", 0)); + touchModeCheckBox->setText(QApplication::translate("PreferencesBehaviourPage", "Touch Mode", 0)); + Q_UNUSED(PreferencesBehaviourPage); + } // retranslateUi + +}; + +namespace Ui { + class PreferencesBehaviourPage: public Ui_PreferencesBehaviourPage {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_BEHAVIOURPAGE_H diff --git a/configurationServer/gui/ui_debuggerPage.h b/configurationServer/gui/ui_debuggerPage.h new file mode 100644 index 0000000..6b11a08 --- /dev/null +++ b/configurationServer/gui/ui_debuggerPage.h @@ -0,0 +1,113 @@ +/******************************************************************************** +** Form generated from reading UI file 'debuggerPage.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_DEBUGGERPAGE_H +#define UI_DEBUGGERPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_PreferencesDebuggerPage +{ +public: + QVBoxLayout *verticalLayout; + QLabel *label_16; + QFrame *frame_7; + QGridLayout *gridLayout; + QLabel *label_14; + QLineEdit *timeoutLineEdit; + QLabel *label_15; + QComboBox *colorComboBox; + QSpacerItem *verticalSpacer; + + void setupUi(QWidget *PreferencesDebuggerPage) + { + if (PreferencesDebuggerPage->objectName().isEmpty()) + PreferencesDebuggerPage->setObjectName(QStringLiteral("PreferencesDebuggerPage")); + PreferencesDebuggerPage->resize(407, 122); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(PreferencesDebuggerPage->sizePolicy().hasHeightForWidth()); + PreferencesDebuggerPage->setSizePolicy(sizePolicy); + verticalLayout = new QVBoxLayout(PreferencesDebuggerPage); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + label_16 = new QLabel(PreferencesDebuggerPage); + label_16->setObjectName(QStringLiteral("label_16")); + + verticalLayout->addWidget(label_16); + + frame_7 = new QFrame(PreferencesDebuggerPage); + frame_7->setObjectName(QStringLiteral("frame_7")); + frame_7->setFrameShape(QFrame::StyledPanel); + frame_7->setFrameShadow(QFrame::Raised); + gridLayout = new QGridLayout(frame_7); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + label_14 = new QLabel(frame_7); + label_14->setObjectName(QStringLiteral("label_14")); + + gridLayout->addWidget(label_14, 0, 0, 1, 1); + + timeoutLineEdit = new QLineEdit(frame_7); + timeoutLineEdit->setObjectName(QStringLiteral("timeoutLineEdit")); + + gridLayout->addWidget(timeoutLineEdit, 0, 1, 1, 1); + + label_15 = new QLabel(frame_7); + label_15->setObjectName(QStringLiteral("label_15")); + + gridLayout->addWidget(label_15, 1, 0, 1, 1); + + colorComboBox = new QComboBox(frame_7); + colorComboBox->setObjectName(QStringLiteral("colorComboBox")); + + gridLayout->addWidget(colorComboBox, 1, 1, 1, 1); + + + verticalLayout->addWidget(frame_7); + + verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + verticalLayout->addItem(verticalSpacer); + + + retranslateUi(PreferencesDebuggerPage); + + QMetaObject::connectSlotsByName(PreferencesDebuggerPage); + } // setupUi + + void retranslateUi(QWidget *PreferencesDebuggerPage) + { + label_16->setText(QApplication::translate("PreferencesDebuggerPage", "Presentation", 0)); + label_14->setText(QApplication::translate("PreferencesDebuggerPage", "Debug timeout (ms):", 0)); + label_15->setText(QApplication::translate("PreferencesDebuggerPage", "Color of highlighting:", 0)); + Q_UNUSED(PreferencesDebuggerPage); + } // retranslateUi + +}; + +namespace Ui { + class PreferencesDebuggerPage: public Ui_PreferencesDebuggerPage {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_DEBUGGERPAGE_H diff --git a/configurationServer/gui/ui_editorPage.h b/configurationServer/gui/ui_editorPage.h new file mode 100644 index 0000000..bb04265 --- /dev/null +++ b/configurationServer/gui/ui_editorPage.h @@ -0,0 +1,529 @@ +/******************************************************************************** +** Form generated from reading UI file 'editorPage.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_EDITORPAGE_H +#define UI_EDITORPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_PreferencesEditorPage +{ +public: + QVBoxLayout *verticalLayout; + QScrollArea *scrollArea; + QWidget *scrollAreaWidgetContents; + QVBoxLayout *verticalLayout_2; + QLabel *label_5; + QFrame *frame_3; + QHBoxLayout *horizontalLayout; + QCheckBox *fontCheckBox; + QPushButton *fontSelectionButton; + QLabel *label; + QFrame *frame; + QGridLayout *gridLayout; + QSlider *gridWidthSlider; + QCheckBox *activateAlignmentCheckBox; + QLabel *label_20; + QCheckBox *activateGridCheckBox; + QLabel *label_13; + QCheckBox *showGridCheckBox; + QCheckBox *showAlignmentCheckBox; + QSlider *indexGridSlider; + QSpacerItem *horizontalSpacer_2; + QSpacerItem *horizontalSpacer_3; + QLabel *label_14; + QFrame *frame_7; + QGridLayout *gridLayout_3; + QSlider *dragAreaSizeSlider; + QLabel *label_15; + QFrame *frame_6; + QSlider *horizontalSlider; + QLabel *label_9; + QFrame *frame_4; + QGridLayout *gridLayout_5; + QSpacerItem *horizontalSpacer; + QComboBox *lineMode; + QLabel *label_10; + QLabel *label_11; + QSlider *loopEdgeBoundsIndent; + QLabel *label_2; + QFrame *frame_2; + QGridLayout *gridLayout_2; + QSlider *embeddedLinkerSizeSlider; + QSlider *embeddedLinkerIndentSlider; + QLabel *label_3; + QLabel *label_4; + QLabel *label_12; + QFrame *frame_5; + QVBoxLayout *verticalLayout_3; + QCheckBox *enableMoveLabelsCheckBox; + QCheckBox *enableResizeLabelsCheckBox; + QLabel *labelDistanceLabel; + QSlider *labelDistanceSlider; + QLabel *label_8; + QFrame *frame_9; + QGridLayout *gridLayout_7; + QLabel *label_6; + QLabel *label_7; + QComboBox *paletteComboBox; + QSpinBox *paletteSpinBox; + QSpacerItem *verticalSpacer_2; + + void setupUi(QWidget *PreferencesEditorPage) + { + if (PreferencesEditorPage->objectName().isEmpty()) + PreferencesEditorPage->setObjectName(QStringLiteral("PreferencesEditorPage")); + PreferencesEditorPage->resize(500, 638); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(PreferencesEditorPage->sizePolicy().hasHeightForWidth()); + PreferencesEditorPage->setSizePolicy(sizePolicy); + PreferencesEditorPage->setMinimumSize(QSize(50, 50)); + PreferencesEditorPage->setMaximumSize(QSize(16777215, 16777215)); + verticalLayout = new QVBoxLayout(PreferencesEditorPage); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + scrollArea = new QScrollArea(PreferencesEditorPage); + scrollArea->setObjectName(QStringLiteral("scrollArea")); + scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scrollArea->setWidgetResizable(true); + scrollAreaWidgetContents = new QWidget(); + scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents")); + scrollAreaWidgetContents->setGeometry(QRect(0, 0, 480, 782)); + verticalLayout_2 = new QVBoxLayout(scrollAreaWidgetContents); + verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); + label_5 = new QLabel(scrollAreaWidgetContents); + label_5->setObjectName(QStringLiteral("label_5")); + + verticalLayout_2->addWidget(label_5); + + frame_3 = new QFrame(scrollAreaWidgetContents); + frame_3->setObjectName(QStringLiteral("frame_3")); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(frame_3->sizePolicy().hasHeightForWidth()); + frame_3->setSizePolicy(sizePolicy1); + frame_3->setMinimumSize(QSize(0, 40)); + frame_3->setFrameShape(QFrame::StyledPanel); + frame_3->setFrameShadow(QFrame::Raised); + horizontalLayout = new QHBoxLayout(frame_3); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + fontCheckBox = new QCheckBox(frame_3); + fontCheckBox->setObjectName(QStringLiteral("fontCheckBox")); + fontCheckBox->setEnabled(true); + sizePolicy1.setHeightForWidth(fontCheckBox->sizePolicy().hasHeightForWidth()); + fontCheckBox->setSizePolicy(sizePolicy1); + + horizontalLayout->addWidget(fontCheckBox); + + fontSelectionButton = new QPushButton(frame_3); + fontSelectionButton->setObjectName(QStringLiteral("fontSelectionButton")); + sizePolicy1.setHeightForWidth(fontSelectionButton->sizePolicy().hasHeightForWidth()); + fontSelectionButton->setSizePolicy(sizePolicy1); + + horizontalLayout->addWidget(fontSelectionButton); + + + verticalLayout_2->addWidget(frame_3); + + label = new QLabel(scrollAreaWidgetContents); + label->setObjectName(QStringLiteral("label")); + + verticalLayout_2->addWidget(label); + + frame = new QFrame(scrollAreaWidgetContents); + frame->setObjectName(QStringLiteral("frame")); + sizePolicy1.setHeightForWidth(frame->sizePolicy().hasHeightForWidth()); + frame->setSizePolicy(sizePolicy1); + frame->setFrameShape(QFrame::StyledPanel); + frame->setFrameShadow(QFrame::Raised); + gridLayout = new QGridLayout(frame); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + gridWidthSlider = new QSlider(frame); + gridWidthSlider->setObjectName(QStringLiteral("gridWidthSlider")); + sizePolicy.setHeightForWidth(gridWidthSlider->sizePolicy().hasHeightForWidth()); + gridWidthSlider->setSizePolicy(sizePolicy); + gridWidthSlider->setMinimum(3); + gridWidthSlider->setMaximum(150); + gridWidthSlider->setSingleStep(1); + gridWidthSlider->setPageStep(10); + gridWidthSlider->setOrientation(Qt::Horizontal); + + gridLayout->addWidget(gridWidthSlider, 7, 1, 1, 2); + + activateAlignmentCheckBox = new QCheckBox(frame); + activateAlignmentCheckBox->setObjectName(QStringLiteral("activateAlignmentCheckBox")); + QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Fixed); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(activateAlignmentCheckBox->sizePolicy().hasHeightForWidth()); + activateAlignmentCheckBox->setSizePolicy(sizePolicy2); + activateAlignmentCheckBox->setChecked(true); + + gridLayout->addWidget(activateAlignmentCheckBox, 4, 0, 1, 1); + + label_20 = new QLabel(frame); + label_20->setObjectName(QStringLiteral("label_20")); + + gridLayout->addWidget(label_20, 8, 0, 1, 1); + + activateGridCheckBox = new QCheckBox(frame); + activateGridCheckBox->setObjectName(QStringLiteral("activateGridCheckBox")); + sizePolicy2.setHeightForWidth(activateGridCheckBox->sizePolicy().hasHeightForWidth()); + activateGridCheckBox->setSizePolicy(sizePolicy2); + activateGridCheckBox->setTristate(false); + + gridLayout->addWidget(activateGridCheckBox, 2, 0, 1, 1); + + label_13 = new QLabel(frame); + label_13->setObjectName(QStringLiteral("label_13")); + + gridLayout->addWidget(label_13, 7, 0, 1, 1); + + showGridCheckBox = new QCheckBox(frame); + showGridCheckBox->setObjectName(QStringLiteral("showGridCheckBox")); + showGridCheckBox->setChecked(true); + + gridLayout->addWidget(showGridCheckBox, 1, 0, 1, 1); + + showAlignmentCheckBox = new QCheckBox(frame); + showAlignmentCheckBox->setObjectName(QStringLiteral("showAlignmentCheckBox")); + showAlignmentCheckBox->setMinimumSize(QSize(130, 0)); + showAlignmentCheckBox->setChecked(true); + + gridLayout->addWidget(showAlignmentCheckBox, 3, 0, 1, 1); + + indexGridSlider = new QSlider(frame); + indexGridSlider->setObjectName(QStringLiteral("indexGridSlider")); + sizePolicy.setHeightForWidth(indexGridSlider->sizePolicy().hasHeightForWidth()); + indexGridSlider->setSizePolicy(sizePolicy); + indexGridSlider->setMinimum(5); + indexGridSlider->setMaximum(150); + indexGridSlider->setSingleStep(1); + indexGridSlider->setPageStep(10); + indexGridSlider->setValue(50); + indexGridSlider->setOrientation(Qt::Horizontal); + + gridLayout->addWidget(indexGridSlider, 8, 1, 1, 2); + + horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + gridLayout->addItem(horizontalSpacer_2, 3, 1, 1, 1); + + horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + gridLayout->addItem(horizontalSpacer_3, 4, 1, 1, 1); + + + verticalLayout_2->addWidget(frame); + + label_14 = new QLabel(scrollAreaWidgetContents); + label_14->setObjectName(QStringLiteral("label_14")); + + verticalLayout_2->addWidget(label_14); + + frame_7 = new QFrame(scrollAreaWidgetContents); + frame_7->setObjectName(QStringLiteral("frame_7")); + frame_7->setFrameShape(QFrame::StyledPanel); + frame_7->setFrameShadow(QFrame::Raised); + gridLayout_3 = new QGridLayout(frame_7); + gridLayout_3->setObjectName(QStringLiteral("gridLayout_3")); + dragAreaSizeSlider = new QSlider(frame_7); + dragAreaSizeSlider->setObjectName(QStringLiteral("dragAreaSizeSlider")); + dragAreaSizeSlider->setMinimum(4); + dragAreaSizeSlider->setMaximum(20); + dragAreaSizeSlider->setValue(12); + dragAreaSizeSlider->setOrientation(Qt::Horizontal); + + gridLayout_3->addWidget(dragAreaSizeSlider, 0, 1, 1, 1); + + label_15 = new QLabel(frame_7); + label_15->setObjectName(QStringLiteral("label_15")); + + gridLayout_3->addWidget(label_15, 0, 0, 1, 1); + + + verticalLayout_2->addWidget(frame_7); + + frame_6 = new QFrame(scrollAreaWidgetContents); + frame_6->setObjectName(QStringLiteral("frame_6")); + frame_6->setFrameShape(QFrame::StyledPanel); + frame_6->setFrameShadow(QFrame::Raised); + horizontalSlider = new QSlider(frame_6); + horizontalSlider->setObjectName(QStringLiteral("horizontalSlider")); + horizontalSlider->setGeometry(QRect(70, 0, 160, 21)); + horizontalSlider->setOrientation(Qt::Horizontal); + + verticalLayout_2->addWidget(frame_6, 0, Qt::AlignLeft); + + label_9 = new QLabel(scrollAreaWidgetContents); + label_9->setObjectName(QStringLiteral("label_9")); + + verticalLayout_2->addWidget(label_9); + + frame_4 = new QFrame(scrollAreaWidgetContents); + frame_4->setObjectName(QStringLiteral("frame_4")); + QSizePolicy sizePolicy3(QSizePolicy::Preferred, QSizePolicy::Expanding); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(30); + sizePolicy3.setHeightForWidth(frame_4->sizePolicy().hasHeightForWidth()); + frame_4->setSizePolicy(sizePolicy3); + frame_4->setMinimumSize(QSize(50, 60)); + frame_4->setFrameShape(QFrame::StyledPanel); + frame_4->setFrameShadow(QFrame::Raised); + gridLayout_5 = new QGridLayout(frame_4); + gridLayout_5->setObjectName(QStringLiteral("gridLayout_5")); + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + gridLayout_5->addItem(horizontalSpacer, 0, 2, 1, 1); + + lineMode = new QComboBox(frame_4); + lineMode->setObjectName(QStringLiteral("lineMode")); + QSizePolicy sizePolicy4(QSizePolicy::Preferred, QSizePolicy::Expanding); + sizePolicy4.setHorizontalStretch(0); + sizePolicy4.setVerticalStretch(0); + sizePolicy4.setHeightForWidth(lineMode->sizePolicy().hasHeightForWidth()); + lineMode->setSizePolicy(sizePolicy4); + lineMode->setMinimumSize(QSize(0, 20)); + + gridLayout_5->addWidget(lineMode, 0, 1, 1, 1); + + label_10 = new QLabel(frame_4); + label_10->setObjectName(QStringLiteral("label_10")); + + gridLayout_5->addWidget(label_10, 0, 0, 1, 1); + + label_11 = new QLabel(frame_4); + label_11->setObjectName(QStringLiteral("label_11")); + sizePolicy1.setHeightForWidth(label_11->sizePolicy().hasHeightForWidth()); + label_11->setSizePolicy(sizePolicy1); + + gridLayout_5->addWidget(label_11, 1, 0, 1, 1); + + loopEdgeBoundsIndent = new QSlider(frame_4); + loopEdgeBoundsIndent->setObjectName(QStringLiteral("loopEdgeBoundsIndent")); + sizePolicy.setHeightForWidth(loopEdgeBoundsIndent->sizePolicy().hasHeightForWidth()); + loopEdgeBoundsIndent->setSizePolicy(sizePolicy); + loopEdgeBoundsIndent->setMinimum(1); + loopEdgeBoundsIndent->setMaximum(15); + loopEdgeBoundsIndent->setSingleStep(2); + loopEdgeBoundsIndent->setPageStep(2); + loopEdgeBoundsIndent->setValue(2); + loopEdgeBoundsIndent->setOrientation(Qt::Horizontal); + + gridLayout_5->addWidget(loopEdgeBoundsIndent, 1, 1, 1, 2); + + + verticalLayout_2->addWidget(frame_4); + + label_2 = new QLabel(scrollAreaWidgetContents); + label_2->setObjectName(QStringLiteral("label_2")); + + verticalLayout_2->addWidget(label_2); + + frame_2 = new QFrame(scrollAreaWidgetContents); + frame_2->setObjectName(QStringLiteral("frame_2")); + frame_2->setFrameShape(QFrame::StyledPanel); + frame_2->setFrameShadow(QFrame::Raised); + gridLayout_2 = new QGridLayout(frame_2); + gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); + embeddedLinkerSizeSlider = new QSlider(frame_2); + embeddedLinkerSizeSlider->setObjectName(QStringLiteral("embeddedLinkerSizeSlider")); + embeddedLinkerSizeSlider->setMinimum(4); + embeddedLinkerSizeSlider->setMaximum(20); + embeddedLinkerSizeSlider->setOrientation(Qt::Horizontal); + + gridLayout_2->addWidget(embeddedLinkerSizeSlider, 0, 1, 1, 1); + + embeddedLinkerIndentSlider = new QSlider(frame_2); + embeddedLinkerIndentSlider->setObjectName(QStringLiteral("embeddedLinkerIndentSlider")); + embeddedLinkerIndentSlider->setMinimum(5); + embeddedLinkerIndentSlider->setMaximum(20); + embeddedLinkerIndentSlider->setOrientation(Qt::Horizontal); + + gridLayout_2->addWidget(embeddedLinkerIndentSlider, 1, 1, 1, 1); + + label_3 = new QLabel(frame_2); + label_3->setObjectName(QStringLiteral("label_3")); + + gridLayout_2->addWidget(label_3, 0, 0, 1, 1); + + label_4 = new QLabel(frame_2); + label_4->setObjectName(QStringLiteral("label_4")); + + gridLayout_2->addWidget(label_4, 1, 0, 1, 1); + + + verticalLayout_2->addWidget(frame_2); + + label_12 = new QLabel(scrollAreaWidgetContents); + label_12->setObjectName(QStringLiteral("label_12")); + + verticalLayout_2->addWidget(label_12); + + frame_5 = new QFrame(scrollAreaWidgetContents); + frame_5->setObjectName(QStringLiteral("frame_5")); + frame_5->setFrameShape(QFrame::StyledPanel); + frame_5->setFrameShadow(QFrame::Raised); + verticalLayout_3 = new QVBoxLayout(frame_5); + verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); + enableMoveLabelsCheckBox = new QCheckBox(frame_5); + enableMoveLabelsCheckBox->setObjectName(QStringLiteral("enableMoveLabelsCheckBox")); + enableMoveLabelsCheckBox->setChecked(true); + + verticalLayout_3->addWidget(enableMoveLabelsCheckBox); + + enableResizeLabelsCheckBox = new QCheckBox(frame_5); + enableResizeLabelsCheckBox->setObjectName(QStringLiteral("enableResizeLabelsCheckBox")); + enableResizeLabelsCheckBox->setChecked(true); + + verticalLayout_3->addWidget(enableResizeLabelsCheckBox); + + labelDistanceLabel = new QLabel(frame_5); + labelDistanceLabel->setObjectName(QStringLiteral("labelDistanceLabel")); + + verticalLayout_3->addWidget(labelDistanceLabel); + + labelDistanceSlider = new QSlider(frame_5); + labelDistanceSlider->setObjectName(QStringLiteral("labelDistanceSlider")); + labelDistanceSlider->setMaximum(500); + labelDistanceSlider->setOrientation(Qt::Horizontal); + + verticalLayout_3->addWidget(labelDistanceSlider); + + + verticalLayout_2->addWidget(frame_5); + + label_8 = new QLabel(scrollAreaWidgetContents); + label_8->setObjectName(QStringLiteral("label_8")); + + verticalLayout_2->addWidget(label_8); + + frame_9 = new QFrame(scrollAreaWidgetContents); + frame_9->setObjectName(QStringLiteral("frame_9")); + frame_9->setFrameShape(QFrame::StyledPanel); + frame_9->setFrameShadow(QFrame::Raised); + gridLayout_7 = new QGridLayout(frame_9); + gridLayout_7->setObjectName(QStringLiteral("gridLayout_7")); + label_6 = new QLabel(frame_9); + label_6->setObjectName(QStringLiteral("label_6")); + + gridLayout_7->addWidget(label_6, 0, 0, 1, 1); + + label_7 = new QLabel(frame_9); + label_7->setObjectName(QStringLiteral("label_7")); + + gridLayout_7->addWidget(label_7, 1, 0, 1, 1); + + paletteComboBox = new QComboBox(frame_9); + paletteComboBox->setObjectName(QStringLiteral("paletteComboBox")); + paletteComboBox->setLayoutDirection(Qt::LeftToRight); + paletteComboBox->setEditable(false); + paletteComboBox->setFrame(true); + + gridLayout_7->addWidget(paletteComboBox, 0, 1, 1, 1); + + paletteSpinBox = new QSpinBox(frame_9); + paletteSpinBox->setObjectName(QStringLiteral("paletteSpinBox")); + paletteSpinBox->setMinimum(1); + paletteSpinBox->setMaximum(5); + + gridLayout_7->addWidget(paletteSpinBox, 1, 1, 1, 1); + + + verticalLayout_2->addWidget(frame_9); + + verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + verticalLayout_2->addItem(verticalSpacer_2); + + scrollArea->setWidget(scrollAreaWidgetContents); + + verticalLayout->addWidget(scrollArea); + + + retranslateUi(PreferencesEditorPage); + + paletteComboBox->setCurrentIndex(1); + + + QMetaObject::connectSlotsByName(PreferencesEditorPage); + } // setupUi + + void retranslateUi(QWidget *PreferencesEditorPage) + { + label_5->setText(QApplication::translate("PreferencesEditorPage", "Font", 0)); + fontCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Use some of system fonts", 0)); + fontSelectionButton->setText(QApplication::translate("PreferencesEditorPage", "Choose Font", 0)); + label->setText(QApplication::translate("PreferencesEditorPage", "Grid", 0)); + activateAlignmentCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Activate alignment", 0)); + label_20->setText(QApplication::translate("PreferencesEditorPage", "Cell size", 0)); + activateGridCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Activate grid", 0)); + label_13->setText(QApplication::translate("PreferencesEditorPage", "Width", 0)); + showGridCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Show grid", 0)); + showAlignmentCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Show alignment", 0)); + label_14->setText(QApplication::translate("PreferencesEditorPage", "Node Elements", 0)); + label_15->setText(QApplication::translate("PreferencesEditorPage", "Drag area", 0)); + label_9->setText(QApplication::translate("PreferencesEditorPage", "Edge", 0)); + lineMode->clear(); + lineMode->insertItems(0, QStringList() + << QApplication::translate("PreferencesEditorPage", "unset", 0) + << QApplication::translate("PreferencesEditorPage", "broken", 0) + << QApplication::translate("PreferencesEditorPage", "square", 0) + << QApplication::translate("PreferencesEditorPage", "curve", 0) + ); + label_10->setText(QApplication::translate("PreferencesEditorPage", "Line mode", 0)); + label_11->setText(QApplication::translate("PreferencesEditorPage", "Loop edges indent", 0)); + label_2->setText(QApplication::translate("PreferencesEditorPage", "Embedded Linkers", 0)); + label_3->setText(QApplication::translate("PreferencesEditorPage", "Size", 0)); + label_4->setText(QApplication::translate("PreferencesEditorPage", "Indent", 0)); + label_12->setText(QApplication::translate("PreferencesEditorPage", "Labels", 0)); + enableMoveLabelsCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Enable move", 0)); + enableResizeLabelsCheckBox->setText(QApplication::translate("PreferencesEditorPage", "Enable resize", 0)); + labelDistanceLabel->setText(QApplication::translate("PreferencesEditorPage", "Label distance", 0)); + label_8->setText(QApplication::translate("PreferencesEditorPage", "Palette", 0)); + label_6->setText(QApplication::translate("PreferencesEditorPage", " Representation ", 0)); + label_7->setText(QApplication::translate("PreferencesEditorPage", " Count of items in a row ", 0)); + paletteComboBox->clear(); + paletteComboBox->insertItems(0, QStringList() + << QApplication::translate("PreferencesEditorPage", "Icons and names", 0) + << QApplication::translate("PreferencesEditorPage", "Icons", 0) + ); + Q_UNUSED(PreferencesEditorPage); + } // retranslateUi + +}; + +namespace Ui { + class PreferencesEditorPage: public Ui_PreferencesEditorPage {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_EDITORPAGE_H diff --git a/configurationServer/gui/ui_featuresPage.h b/configurationServer/gui/ui_featuresPage.h new file mode 100644 index 0000000..3dba063 --- /dev/null +++ b/configurationServer/gui/ui_featuresPage.h @@ -0,0 +1,128 @@ +/******************************************************************************** +** Form generated from reading UI file 'featuresPage.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_FEATURESPAGE_H +#define UI_FEATURESPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_PreferencesFeaturesPage +{ +public: + QVBoxLayout *verticalLayout; + QLabel *label_1; + QFrame *frame_1; + QGridLayout *gridLayout; + QCheckBox *gesturesCheckBox; + QLabel *label; + QLabel *label_2; + QCheckBox *embeddedLinkersCheckBox; + QLabel *label_3; + QCheckBox *embeddedControlsCheckBox; + QSpacerItem *verticalSpacer; + + void setupUi(QWidget *PreferencesFeaturesPage) + { + if (PreferencesFeaturesPage->objectName().isEmpty()) + PreferencesFeaturesPage->setObjectName(QStringLiteral("PreferencesFeaturesPage")); + PreferencesFeaturesPage->resize(500, 300); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(PreferencesFeaturesPage->sizePolicy().hasHeightForWidth()); + PreferencesFeaturesPage->setSizePolicy(sizePolicy); + verticalLayout = new QVBoxLayout(PreferencesFeaturesPage); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + label_1 = new QLabel(PreferencesFeaturesPage); + label_1->setObjectName(QStringLiteral("label_1")); + + verticalLayout->addWidget(label_1); + + frame_1 = new QFrame(PreferencesFeaturesPage); + frame_1->setObjectName(QStringLiteral("frame_1")); + frame_1->setFrameShape(QFrame::StyledPanel); + frame_1->setFrameShadow(QFrame::Raised); + gridLayout = new QGridLayout(frame_1); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + gesturesCheckBox = new QCheckBox(frame_1); + gesturesCheckBox->setObjectName(QStringLiteral("gesturesCheckBox")); + + gridLayout->addWidget(gesturesCheckBox, 0, 0, 1, 1); + + label = new QLabel(frame_1); + label->setObjectName(QStringLiteral("label")); + + gridLayout->addWidget(label, 0, 1, 1, 1); + + label_2 = new QLabel(frame_1); + label_2->setObjectName(QStringLiteral("label_2")); + + gridLayout->addWidget(label_2, 1, 1, 1, 1); + + embeddedLinkersCheckBox = new QCheckBox(frame_1); + embeddedLinkersCheckBox->setObjectName(QStringLiteral("embeddedLinkersCheckBox")); + + gridLayout->addWidget(embeddedLinkersCheckBox, 1, 0, 1, 1); + + label_3 = new QLabel(frame_1); + label_3->setObjectName(QStringLiteral("label_3")); + + gridLayout->addWidget(label_3, 2, 1, 1, 1); + + embeddedControlsCheckBox = new QCheckBox(frame_1); + embeddedControlsCheckBox->setObjectName(QStringLiteral("embeddedControlsCheckBox")); + + gridLayout->addWidget(embeddedControlsCheckBox, 2, 0, 1, 1); + + + verticalLayout->addWidget(frame_1); + + verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + verticalLayout->addItem(verticalSpacer); + + + retranslateUi(PreferencesFeaturesPage); + + QMetaObject::connectSlotsByName(PreferencesFeaturesPage); + } // setupUi + + void retranslateUi(QWidget *PreferencesFeaturesPage) + { + label_1->setText(QApplication::translate("PreferencesFeaturesPage", "Element controls", 0)); + gesturesCheckBox->setText(QApplication::translate("PreferencesFeaturesPage", "Gestures", 0)); + label->setText(QApplication::translate("PreferencesFeaturesPage", "fast linking with mouse", 0)); + label_2->setText(QApplication::translate("PreferencesFeaturesPage", "fast linking with mouse", 0)); + embeddedLinkersCheckBox->setText(QApplication::translate("PreferencesFeaturesPage", "Embedded Linkers", 0)); + label_3->setText(QApplication::translate("PreferencesFeaturesPage", "fast property editing", 0)); + embeddedControlsCheckBox->setText(QApplication::translate("PreferencesFeaturesPage", "Embedded Controls", 0)); + Q_UNUSED(PreferencesFeaturesPage); + } // retranslateUi + +}; + +namespace Ui { + class PreferencesFeaturesPage: public Ui_PreferencesFeaturesPage {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_FEATURESPAGE_H diff --git a/configurationServer/gui/ui_hotKeyManagerPage.h b/configurationServer/gui/ui_hotKeyManagerPage.h new file mode 100644 index 0000000..c13a13a --- /dev/null +++ b/configurationServer/gui/ui_hotKeyManagerPage.h @@ -0,0 +1,184 @@ +/******************************************************************************** +** Form generated from reading UI file 'hotKeyManagerPage.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_HOTKEYMANAGERPAGE_H +#define UI_HOTKEYMANAGERPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hotKeyManager/shortcutEdit.h" + +QT_BEGIN_NAMESPACE + +class Ui_hotKeyManagerPage +{ +public: + QVBoxLayout *verticalLayout_2; + QGroupBox *keyboardShortcutsGroupBox; + QGridLayout *gridLayout; + QSpacerItem *horizontalSpacer; + QPushButton *importPushButton; + QPushButton *exportPushButton; + QTableWidget *hotKeysTable; + QPushButton *resetAllPushButton; + QGroupBox *shortcutGroupBox; + QGridLayout *gridLayout_2; + QPushButton *resetShortcutPushButton; + QSpacerItem *horizontalSpacer_2; + QLabel *label; + ShortcutEdit *shortcutLineEdit; + QSpacerItem *horizontalSpacer_3; + + void setupUi(QWidget *hotKeyManagerPage) + { + if (hotKeyManagerPage->objectName().isEmpty()) + hotKeyManagerPage->setObjectName(QStringLiteral("hotKeyManagerPage")); + hotKeyManagerPage->resize(654, 350); + verticalLayout_2 = new QVBoxLayout(hotKeyManagerPage); + verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); + keyboardShortcutsGroupBox = new QGroupBox(hotKeyManagerPage); + keyboardShortcutsGroupBox->setObjectName(QStringLiteral("keyboardShortcutsGroupBox")); + gridLayout = new QGridLayout(keyboardShortcutsGroupBox); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + horizontalSpacer = new QSpacerItem(381, 38, QSizePolicy::Expanding, QSizePolicy::Minimum); + + gridLayout->addItem(horizontalSpacer, 1, 1, 1, 1); + + importPushButton = new QPushButton(keyboardShortcutsGroupBox); + importPushButton->setObjectName(QStringLiteral("importPushButton")); + + gridLayout->addWidget(importPushButton, 1, 2, 1, 1); + + exportPushButton = new QPushButton(keyboardShortcutsGroupBox); + exportPushButton->setObjectName(QStringLiteral("exportPushButton")); + + gridLayout->addWidget(exportPushButton, 1, 3, 1, 1); + + hotKeysTable = new QTableWidget(keyboardShortcutsGroupBox); + if (hotKeysTable->columnCount() < 5) + hotKeysTable->setColumnCount(5); + QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); + hotKeysTable->setHorizontalHeaderItem(0, __qtablewidgetitem); + QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); + hotKeysTable->setHorizontalHeaderItem(1, __qtablewidgetitem1); + QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem(); + hotKeysTable->setHorizontalHeaderItem(2, __qtablewidgetitem2); + QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem(); + hotKeysTable->setHorizontalHeaderItem(3, __qtablewidgetitem3); + QTableWidgetItem *__qtablewidgetitem4 = new QTableWidgetItem(); + hotKeysTable->setHorizontalHeaderItem(4, __qtablewidgetitem4); + hotKeysTable->setObjectName(QStringLiteral("hotKeysTable")); + hotKeysTable->setEnabled(true); + hotKeysTable->setMinimumSize(QSize(0, 0)); + hotKeysTable->setFocusPolicy(Qt::WheelFocus); + hotKeysTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + hotKeysTable->setProperty("showDropIndicator", QVariant(false)); + hotKeysTable->setSelectionMode(QAbstractItemView::SingleSelection); + hotKeysTable->setSelectionBehavior(QAbstractItemView::SelectItems); + hotKeysTable->setShowGrid(false); + hotKeysTable->setWordWrap(true); + hotKeysTable->setCornerButtonEnabled(true); + hotKeysTable->setRowCount(0); + hotKeysTable->setColumnCount(5); + hotKeysTable->horizontalHeader()->setDefaultSectionSize(100); + hotKeysTable->horizontalHeader()->setHighlightSections(true); + hotKeysTable->verticalHeader()->setCascadingSectionResizes(false); + hotKeysTable->verticalHeader()->setMinimumSectionSize(19); + hotKeysTable->verticalHeader()->setStretchLastSection(false); + + gridLayout->addWidget(hotKeysTable, 0, 0, 1, 4); + + resetAllPushButton = new QPushButton(keyboardShortcutsGroupBox); + resetAllPushButton->setObjectName(QStringLiteral("resetAllPushButton")); + + gridLayout->addWidget(resetAllPushButton, 1, 0, 1, 1); + + + verticalLayout_2->addWidget(keyboardShortcutsGroupBox); + + shortcutGroupBox = new QGroupBox(hotKeyManagerPage); + shortcutGroupBox->setObjectName(QStringLiteral("shortcutGroupBox")); + gridLayout_2 = new QGridLayout(shortcutGroupBox); + gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); + resetShortcutPushButton = new QPushButton(shortcutGroupBox); + resetShortcutPushButton->setObjectName(QStringLiteral("resetShortcutPushButton")); + + gridLayout_2->addWidget(resetShortcutPushButton, 0, 4, 1, 1); + + horizontalSpacer_2 = new QSpacerItem(10, 20, QSizePolicy::Minimum, QSizePolicy::Minimum); + + gridLayout_2->addItem(horizontalSpacer_2, 0, 3, 1, 1); + + label = new QLabel(shortcutGroupBox); + label->setObjectName(QStringLiteral("label")); + + gridLayout_2->addWidget(label, 0, 1, 1, 1); + + shortcutLineEdit = new ShortcutEdit(shortcutGroupBox); + shortcutLineEdit->setObjectName(QStringLiteral("shortcutLineEdit")); + shortcutLineEdit->setEnabled(false); + shortcutLineEdit->setDragEnabled(false); + shortcutLineEdit->setReadOnly(false); + + gridLayout_2->addWidget(shortcutLineEdit, 0, 2, 1, 1); + + horizontalSpacer_3 = new QSpacerItem(2, 20, QSizePolicy::Minimum, QSizePolicy::Minimum); + + gridLayout_2->addItem(horizontalSpacer_3, 0, 0, 1, 1); + + + verticalLayout_2->addWidget(shortcutGroupBox); + + + retranslateUi(hotKeyManagerPage); + + QMetaObject::connectSlotsByName(hotKeyManagerPage); + } // setupUi + + void retranslateUi(QWidget *hotKeyManagerPage) + { + hotKeyManagerPage->setWindowTitle(QApplication::translate("hotKeyManagerPage", "Form", 0)); + keyboardShortcutsGroupBox->setTitle(QApplication::translate("hotKeyManagerPage", "Keyboard Shortcuts", 0)); + importPushButton->setText(QApplication::translate("hotKeyManagerPage", "Import...", 0)); + exportPushButton->setText(QApplication::translate("hotKeyManagerPage", "Export...", 0)); + QTableWidgetItem *___qtablewidgetitem = hotKeysTable->horizontalHeaderItem(0); + ___qtablewidgetitem->setText(QApplication::translate("hotKeyManagerPage", "Command", 0)); + QTableWidgetItem *___qtablewidgetitem1 = hotKeysTable->horizontalHeaderItem(1); + ___qtablewidgetitem1->setText(QApplication::translate("hotKeyManagerPage", "Label", 0)); + QTableWidgetItem *___qtablewidgetitem2 = hotKeysTable->horizontalHeaderItem(2); + ___qtablewidgetitem2->setText(QApplication::translate("hotKeyManagerPage", "Shortcut 1", 0)); + QTableWidgetItem *___qtablewidgetitem3 = hotKeysTable->horizontalHeaderItem(3); + ___qtablewidgetitem3->setText(QApplication::translate("hotKeyManagerPage", "Shortcut 2", 0)); + QTableWidgetItem *___qtablewidgetitem4 = hotKeysTable->horizontalHeaderItem(4); + ___qtablewidgetitem4->setText(QApplication::translate("hotKeyManagerPage", "Shortcut 3", 0)); + resetAllPushButton->setText(QApplication::translate("hotKeyManagerPage", "Reset All", 0)); + shortcutGroupBox->setTitle(QApplication::translate("hotKeyManagerPage", "Shortcut", 0)); + resetShortcutPushButton->setText(QApplication::translate("hotKeyManagerPage", "Reset", 0)); + label->setText(QApplication::translate("hotKeyManagerPage", "Key sequence", 0)); + } // retranslateUi + +}; + +namespace Ui { + class hotKeyManagerPage: public Ui_hotKeyManagerPage {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_HOTKEYMANAGERPAGE_H diff --git a/configurationServer/gui/ui_miscellaniousPage.h b/configurationServer/gui/ui_miscellaniousPage.h new file mode 100644 index 0000000..5444432 --- /dev/null +++ b/configurationServer/gui/ui_miscellaniousPage.h @@ -0,0 +1,255 @@ +/******************************************************************************** +** Form generated from reading UI file 'miscellaniousPage.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_MISCELLANIOUSPAGE_H +#define UI_MISCELLANIOUSPAGE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_PreferencesMiscellaniousPage +{ +public: + QGridLayout *gridLayout_4; + QLabel *label_5; + QFrame *frame_3; + QGridLayout *gridLayout; + QCheckBox *antialiasingCheckBox; + QLabel *label_6; + QFrame *frame_4; + QGridLayout *gridLayout_2; + QCheckBox *splashScreenCheckBox; + QLabel *label_8; + QComboBox *colorComboBox; + QCheckBox *paintOldLineCheckBox; + QSpacerItem *horizontalSpacer; + QHBoxLayout *horizontalLayout_4; + QLabel *label_9; + QSpinBox *recentProjectsLimitSpinBox; + QSpacerItem *horizontalSpacer_2; + QLabel *label_7; + QFrame *frame_5; + QGridLayout *gridLayout_3; + QPushButton *imagesPathBrowseButton; + QLineEdit *imagesPathEdit; + QLabel *label; + QFrame *frame; + QHBoxLayout *horizontalLayout; + QLabel *label_2; + QSlider *toolbarSizeSlider; + QSpacerItem *verticalSpacer; + + void setupUi(QWidget *PreferencesMiscellaniousPage) + { + if (PreferencesMiscellaniousPage->objectName().isEmpty()) + PreferencesMiscellaniousPage->setObjectName(QStringLiteral("PreferencesMiscellaniousPage")); + PreferencesMiscellaniousPage->resize(561, 325); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(PreferencesMiscellaniousPage->sizePolicy().hasHeightForWidth()); + PreferencesMiscellaniousPage->setSizePolicy(sizePolicy); + gridLayout_4 = new QGridLayout(PreferencesMiscellaniousPage); + gridLayout_4->setObjectName(QStringLiteral("gridLayout_4")); + label_5 = new QLabel(PreferencesMiscellaniousPage); + label_5->setObjectName(QStringLiteral("label_5")); + + gridLayout_4->addWidget(label_5, 0, 0, 1, 1); + + frame_3 = new QFrame(PreferencesMiscellaniousPage); + frame_3->setObjectName(QStringLiteral("frame_3")); + frame_3->setFrameShape(QFrame::StyledPanel); + frame_3->setFrameShadow(QFrame::Raised); + gridLayout = new QGridLayout(frame_3); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + antialiasingCheckBox = new QCheckBox(frame_3); + antialiasingCheckBox->setObjectName(QStringLiteral("antialiasingCheckBox")); + + gridLayout->addWidget(antialiasingCheckBox, 0, 0, 1, 1); + + + gridLayout_4->addWidget(frame_3, 1, 0, 1, 1); + + label_6 = new QLabel(PreferencesMiscellaniousPage); + label_6->setObjectName(QStringLiteral("label_6")); + + gridLayout_4->addWidget(label_6, 2, 0, 1, 1); + + frame_4 = new QFrame(PreferencesMiscellaniousPage); + frame_4->setObjectName(QStringLiteral("frame_4")); + frame_4->setFrameShape(QFrame::StyledPanel); + frame_4->setFrameShadow(QFrame::Raised); + gridLayout_2 = new QGridLayout(frame_4); + gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); + splashScreenCheckBox = new QCheckBox(frame_4); + splashScreenCheckBox->setObjectName(QStringLiteral("splashScreenCheckBox")); + + gridLayout_2->addWidget(splashScreenCheckBox, 0, 0, 1, 1); + + label_8 = new QLabel(frame_4); + label_8->setObjectName(QStringLiteral("label_8")); + + gridLayout_2->addWidget(label_8, 3, 2, 1, 1); + + colorComboBox = new QComboBox(frame_4); + colorComboBox->setObjectName(QStringLiteral("colorComboBox")); + colorComboBox->setMinimumSize(QSize(170, 0)); + colorComboBox->setFrame(true); + + gridLayout_2->addWidget(colorComboBox, 3, 3, 1, 1); + + paintOldLineCheckBox = new QCheckBox(frame_4); + paintOldLineCheckBox->setObjectName(QStringLiteral("paintOldLineCheckBox")); + paintOldLineCheckBox->setEnabled(true); + + gridLayout_2->addWidget(paintOldLineCheckBox, 3, 0, 1, 1); + + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + gridLayout_2->addItem(horizontalSpacer, 3, 1, 1, 1); + + horizontalLayout_4 = new QHBoxLayout(); + horizontalLayout_4->setSpacing(5); + horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); + horizontalLayout_4->setSizeConstraint(QLayout::SetDefaultConstraint); + horizontalLayout_4->setContentsMargins(-1, 0, 0, -1); + label_9 = new QLabel(frame_4); + label_9->setObjectName(QStringLiteral("label_9")); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Maximum); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(label_9->sizePolicy().hasHeightForWidth()); + label_9->setSizePolicy(sizePolicy1); + label_9->setWordWrap(true); + + horizontalLayout_4->addWidget(label_9); + + recentProjectsLimitSpinBox = new QSpinBox(frame_4); + recentProjectsLimitSpinBox->setObjectName(QStringLiteral("recentProjectsLimitSpinBox")); + QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(recentProjectsLimitSpinBox->sizePolicy().hasHeightForWidth()); + recentProjectsLimitSpinBox->setSizePolicy(sizePolicy2); + recentProjectsLimitSpinBox->setMaximumSize(QSize(40, 16777215)); + + horizontalLayout_4->addWidget(recentProjectsLimitSpinBox); + + horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Maximum, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer_2); + + + gridLayout_2->addLayout(horizontalLayout_4, 0, 2, 1, 2); + + + gridLayout_4->addWidget(frame_4, 3, 0, 1, 1); + + label_7 = new QLabel(PreferencesMiscellaniousPage); + label_7->setObjectName(QStringLiteral("label_7")); + + gridLayout_4->addWidget(label_7, 4, 0, 1, 1); + + frame_5 = new QFrame(PreferencesMiscellaniousPage); + frame_5->setObjectName(QStringLiteral("frame_5")); + frame_5->setFrameShape(QFrame::StyledPanel); + frame_5->setFrameShadow(QFrame::Raised); + gridLayout_3 = new QGridLayout(frame_5); + gridLayout_3->setObjectName(QStringLiteral("gridLayout_3")); + imagesPathBrowseButton = new QPushButton(frame_5); + imagesPathBrowseButton->setObjectName(QStringLiteral("imagesPathBrowseButton")); + + gridLayout_3->addWidget(imagesPathBrowseButton, 0, 1, 1, 1); + + imagesPathEdit = new QLineEdit(frame_5); + imagesPathEdit->setObjectName(QStringLiteral("imagesPathEdit")); + + gridLayout_3->addWidget(imagesPathEdit, 0, 0, 1, 1); + + + gridLayout_4->addWidget(frame_5, 5, 0, 1, 1); + + label = new QLabel(PreferencesMiscellaniousPage); + label->setObjectName(QStringLiteral("label")); + + gridLayout_4->addWidget(label, 6, 0, 1, 1); + + frame = new QFrame(PreferencesMiscellaniousPage); + frame->setObjectName(QStringLiteral("frame")); + frame->setFrameShape(QFrame::StyledPanel); + frame->setFrameShadow(QFrame::Raised); + horizontalLayout = new QHBoxLayout(frame); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + label_2 = new QLabel(frame); + label_2->setObjectName(QStringLiteral("label_2")); + + horizontalLayout->addWidget(label_2); + + toolbarSizeSlider = new QSlider(frame); + toolbarSizeSlider->setObjectName(QStringLiteral("toolbarSizeSlider")); + toolbarSizeSlider->setMinimum(20); + toolbarSizeSlider->setMaximum(50); + toolbarSizeSlider->setOrientation(Qt::Horizontal); + + horizontalLayout->addWidget(toolbarSizeSlider); + + + gridLayout_4->addWidget(frame, 7, 0, 1, 1); + + verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + gridLayout_4->addItem(verticalSpacer, 8, 0, 1, 1); + + + retranslateUi(PreferencesMiscellaniousPage); + + QMetaObject::connectSlotsByName(PreferencesMiscellaniousPage); + } // setupUi + + void retranslateUi(QWidget *PreferencesMiscellaniousPage) + { + label_5->setText(QApplication::translate("PreferencesMiscellaniousPage", "Graphics", 0)); + antialiasingCheckBox->setText(QApplication::translate("PreferencesMiscellaniousPage", "Antialiasing", 0)); + label_6->setText(QApplication::translate("PreferencesMiscellaniousPage", "Other", 0)); + splashScreenCheckBox->setText(QApplication::translate("PreferencesMiscellaniousPage", "Show splashscreen", 0)); + label_8->setText(QApplication::translate("PreferencesMiscellaniousPage", "Color of old line:", 0)); + paintOldLineCheckBox->setText(QApplication::translate("PreferencesMiscellaniousPage", "Paint the old line", 0)); + label_9->setText(QApplication::translate("PreferencesMiscellaniousPage", "Limit recent projects list", 0)); + label_7->setText(QApplication::translate("PreferencesMiscellaniousPage", "Images", 0)); + imagesPathBrowseButton->setText(QApplication::translate("PreferencesMiscellaniousPage", "Browse", 0)); + label->setText(QApplication::translate("PreferencesMiscellaniousPage", "Toolbars", 0)); + label_2->setText(QApplication::translate("PreferencesMiscellaniousPage", "Size", 0)); + Q_UNUSED(PreferencesMiscellaniousPage); + } // retranslateUi + +}; + +namespace Ui { + class PreferencesMiscellaniousPage: public Ui_PreferencesMiscellaniousPage {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_MISCELLANIOUSPAGE_H diff --git a/configurationServer/gui/ui_preferencesDialog.h b/configurationServer/gui/ui_preferencesDialog.h new file mode 100644 index 0000000..af46118 --- /dev/null +++ b/configurationServer/gui/ui_preferencesDialog.h @@ -0,0 +1,160 @@ +/******************************************************************************** +** Form generated from reading UI file 'preferencesDialog.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_PREFERENCESDIALOG_H +#define UI_PREFERENCESDIALOG_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_PreferencesDialog +{ +public: + QGridLayout *gridLayout; + QPushButton *okButton; + QPushButton *cancelButton; + QPushButton *applyButton; + QListWidget *listWidget; + QScrollArea *scrollArea; + QWidget *scrollAreaWidgetContents; + QVBoxLayout *verticalLayout; + QStackedWidget *pageContentWigdet; + QWidget *pageContentWigdetPage1; + QPushButton *exportButton; + QPushButton *importButton; + QPushButton *saveButton; + + void setupUi(QDialog *PreferencesDialog) + { + if (PreferencesDialog->objectName().isEmpty()) + PreferencesDialog->setObjectName(QStringLiteral("PreferencesDialog")); + PreferencesDialog->resize(892, 593); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(PreferencesDialog->sizePolicy().hasHeightForWidth()); + PreferencesDialog->setSizePolicy(sizePolicy); + PreferencesDialog->setMinimumSize(QSize(0, 0)); + PreferencesDialog->setMaximumSize(QSize(16777215, 16777215)); + QIcon icon; + icon.addFile(QStringLiteral(":/icons/qreal.png"), QSize(), QIcon::Normal, QIcon::Off); + PreferencesDialog->setWindowIcon(icon); + gridLayout = new QGridLayout(PreferencesDialog); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + okButton = new QPushButton(PreferencesDialog); + okButton->setObjectName(QStringLiteral("okButton")); + + gridLayout->addWidget(okButton, 4, 1, 1, 1); + + cancelButton = new QPushButton(PreferencesDialog); + cancelButton->setObjectName(QStringLiteral("cancelButton")); + + gridLayout->addWidget(cancelButton, 4, 2, 1, 1); + + applyButton = new QPushButton(PreferencesDialog); + applyButton->setObjectName(QStringLiteral("applyButton")); + + gridLayout->addWidget(applyButton, 4, 3, 1, 1); + + saveButton = new QPushButton(PreferencesDialog); + saveButton->setObjectName(QStringLiteral("saveButton")); + + gridLayout->addWidget(saveButton, 3, 1, 1, 1); + + listWidget = new QListWidget(PreferencesDialog); + listWidget->setObjectName(QStringLiteral("listWidget")); + QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Expanding); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(listWidget->sizePolicy().hasHeightForWidth()); + listWidget->setSizePolicy(sizePolicy1); + listWidget->setMaximumSize(QSize(500, 16777215)); + listWidget->setFlow(QListView::TopToBottom); + listWidget->setViewMode(QListView::ListMode); + listWidget->setUniformItemSizes(true); + listWidget->setWordWrap(true); + + gridLayout->addWidget(listWidget, 1, 0, 2, 1); + + scrollArea = new QScrollArea(PreferencesDialog); + scrollArea->setObjectName(QStringLiteral("scrollArea")); + scrollArea->setMinimumSize(QSize(0, 0)); + scrollArea->setWidgetResizable(true); + scrollAreaWidgetContents = new QWidget(); + scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents")); + scrollAreaWidgetContents->setGeometry(QRect(0, 0, 610, 509)); + sizePolicy1.setHeightForWidth(scrollAreaWidgetContents->sizePolicy().hasHeightForWidth()); + scrollAreaWidgetContents->setSizePolicy(sizePolicy1); + verticalLayout = new QVBoxLayout(scrollAreaWidgetContents); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + pageContentWigdet = new QStackedWidget(scrollAreaWidgetContents); + pageContentWigdet->setObjectName(QStringLiteral("pageContentWigdet")); + sizePolicy1.setHeightForWidth(pageContentWigdet->sizePolicy().hasHeightForWidth()); + pageContentWigdet->setSizePolicy(sizePolicy1); + pageContentWigdetPage1 = new QWidget(); + pageContentWigdetPage1->setObjectName(QStringLiteral("pageContentWigdetPage1")); + pageContentWigdet->addWidget(pageContentWigdetPage1); + + verticalLayout->addWidget(pageContentWigdet); + + scrollArea->setWidget(scrollAreaWidgetContents); + + gridLayout->addWidget(scrollArea, 2, 1, 1, 3); + + exportButton = new QPushButton(PreferencesDialog); + exportButton->setObjectName(QStringLiteral("exportButton")); + + gridLayout->addWidget(exportButton, 3, 3, 1, 1); + + importButton = new QPushButton(PreferencesDialog); + importButton->setObjectName(QStringLiteral("importButton")); + + gridLayout->addWidget(importButton, 3, 2, 1, 1); + + + retranslateUi(PreferencesDialog); + + listWidget->setCurrentRow(-1); + + + QMetaObject::connectSlotsByName(PreferencesDialog); + } // setupUi + + void retranslateUi(QDialog *PreferencesDialog) + { + PreferencesDialog->setWindowTitle(QApplication::translate("PreferencesDialog", "Preferences", 0)); + okButton->setText(QApplication::translate("PreferencesDialog", "OK", 0)); + cancelButton->setText(QApplication::translate("PreferencesDialog", "Cancel", 0)); + applyButton->setText(QApplication::translate("PreferencesDialog", "Apply", 0)); + exportButton->setText(QApplication::translate("PreferencesDialog", "Export", 0)); + importButton->setText(QApplication::translate("PreferencesDialog", "Import", 0)); + saveButton->setText(QApplication::translate("PreferenceDialog", "Save", 0)); + } // retranslateUi + +}; + +namespace Ui { + class PreferencesDialog: public Ui_PreferencesDialog {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_PREFERENCESDIALOG_H diff --git a/configurationServer/gui/ui_widget.h b/configurationServer/gui/ui_widget.h new file mode 100644 index 0000000..c5078a2 --- /dev/null +++ b/configurationServer/gui/ui_widget.h @@ -0,0 +1,116 @@ +/******************************************************************************** +** Form generated from reading UI file 'widget.ui' +** +** Created by: Qt User Interface Compiler version 5.2.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_Widget +{ +public: + QHBoxLayout *horizontalLayout_2; + QListWidget *widgetListOfNames; + QWidget *widgetSettings; + QVBoxLayout *verticalLayout; + QListWidget *widgetListOfIP; + QVBoxLayout *verticalLeftLayout; + QLabel *widgetNameListOfIP; + QLabel *widgetNameListOfNames; + + void setupUi(QWidget *Widget) + { + if (Widget->objectName().isEmpty()) + Widget->setObjectName(QStringLiteral("Widget")); + Widget->resize(1003, 429); + horizontalLayout_2 = new QHBoxLayout(Widget); + horizontalLayout_2->setSpacing(0); + horizontalLayout_2->setContentsMargins(11, 11, 11, 11); + horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); + horizontalLayout_2->setContentsMargins(0, 0, 0, 0); + + verticalLeftLayout = new QVBoxLayout(Widget); + verticalLeftLayout->setSpacing(0); + verticalLeftLayout->setContentsMargins(11, 11, 11, 11); + verticalLeftLayout->setObjectName(QStringLiteral("verticalLeftLayout")); + verticalLeftLayout->setContentsMargins(0, 0, 0, 0); + + widgetNameListOfIP = new QLabel(Widget); + widgetNameListOfIP->setText("Your IP:"); + verticalLeftLayout->addWidget(widgetNameListOfIP); + + widgetListOfIP = new QListWidget(Widget); + widgetListOfIP->setObjectName(QStringLiteral("widgetListOfIP")); + QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Expanding); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(widgetListOfIP->sizePolicy().hasHeightForWidth()); + widgetListOfIP->setSizePolicy(sizePolicy1); + widgetListOfIP->setMinimumSize(QSize(200, 0)); + widgetListOfIP->setMaximumSize(QSize(200, 16777215)); + verticalLeftLayout->addWidget(widgetListOfIP); + + widgetNameListOfNames = new QLabel(Widget); + widgetNameListOfNames->setText("Client's IP-addresses:"); + verticalLeftLayout->addWidget(widgetNameListOfNames); + + widgetListOfNames = new QListWidget(Widget); + widgetListOfNames->setObjectName(QStringLiteral("widgetListOfNames")); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(widgetListOfNames->sizePolicy().hasHeightForWidth()); + widgetListOfNames->setSizePolicy(sizePolicy); + widgetListOfNames->setMinimumSize(QSize(200, 0)); + widgetListOfNames->setMaximumSize(QSize(200, 16777215)); + widgetListOfNames->setFlow(QListView::TopToBottom); + widgetListOfNames->setViewMode(QListView::ListMode); + widgetListOfNames->setUniformItemSizes(true); + widgetListOfNames->setWordWrap(true); + verticalLeftLayout->addWidget(widgetListOfNames); + + horizontalLayout_2->addItem(verticalLeftLayout); + + widgetSettings = new QWidget(Widget); + widgetSettings->setObjectName(QStringLiteral("widgetSettings")); + verticalLayout = new QVBoxLayout(widgetSettings); + verticalLayout->setSpacing(0); + verticalLayout->setContentsMargins(11, 11, 11, 11); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + verticalLayout->setContentsMargins(0, 0, 0, 0); + + horizontalLayout_2->addWidget(widgetSettings); + + + retranslateUi(Widget); + + widgetListOfNames->setCurrentRow(-1); + + + QMetaObject::connectSlotsByName(Widget); + } // setupUi + + void retranslateUi(QWidget *Widget) + { + Widget->setWindowTitle(QApplication::translate("Widget", "Widget", 0)); + } // retranslateUi + +}; + +namespace Ui { +class Widget: public Ui_Widget {}; +} // namespace Ui + +QT_END_NAMESPACE diff --git a/configurationServer/gui/widget.cpp b/configurationServer/gui/widget.cpp new file mode 100644 index 0000000..50be13a --- /dev/null +++ b/configurationServer/gui/widget.cpp @@ -0,0 +1,55 @@ +#include "widget.h" +#include "ui_widget.h" + +#include "preferencesDialog.h" + +Widget::Widget(QWidget *parent) : + QWidget(parent), + mUi(new Ui::Widget) +{ + mUi->setupUi(this); +} + +Widget::~Widget() +{ + delete mUi; +} + +void Widget::init() +{ + mServer = new Server; + PreferencesDialog * dialog = new PreferencesDialog(); + dialog->init(new QAction(dialog), new QAction(dialog), new QAction(dialog), new QAction(dialog)); + + mUi->widgetSettings->layout()->addWidget(dialog); + dialog->setParent(mUi->widgetSettings); + + connect(mServer, SIGNAL(newClient(QString)), this, SLOT(addNewClient(QString))); + connect(mServer, SIGNAL(clientDisconnected(QString)), this, SLOT(deleteClient(QString))); + + setWindowTitle("Port: " + QString::number(mServer->getPort())); + + QString allIP = mServer->getIP(); + for(int i = 0; i < allIP.count("\n"); i++) { + QString temp = allIP; + mUi->widgetListOfIP->addItem(temp.remove(temp.indexOf('\n'), temp.length() - temp.indexOf('\n'))); + allIP = allIP.remove(0, allIP.indexOf('\n') + 1); + } + + mUi->widgetListOfIP->addItem(allIP.remove(allIP.length() - 1, 1)); +} + +void Widget::addNewClient(const QString &newClient) +{ + mUi->widgetListOfNames->addItem(newClient); +} + +void Widget::deleteClient(const QString &clientsIP) +{ + for (int i = 0; i < mUi->widgetListOfNames->count(); i++) { + if (mUi->widgetListOfNames->item(i)->text() == clientsIP) { + delete mUi->widgetListOfNames->item(i); + return; + } + } +} diff --git a/configurationServer/gui/widget.h b/configurationServer/gui/widget.h new file mode 100644 index 0000000..ca39a39 --- /dev/null +++ b/configurationServer/gui/widget.h @@ -0,0 +1,33 @@ +#pragma once +#include "server/server.h" + +#include + +namespace Ui { +class Widget; +} + +/// Class of window configuration server. +class Widget : public QWidget +{ + Q_OBJECT + +public: + explicit Widget(QWidget *parent = 0); + ~Widget(); + + /// Initialize widget. + void init(); + +private slots: + /// Slot of connect new client. + void addNewClient(QString const &newClient); + + /// Slot of delete client. + void deleteClient(QString const &clientsIP); + +private: + Ui::Widget *mUi; + Server *mServer; +}; + diff --git a/configurationServer/gui/widget.ui b/configurationServer/gui/widget.ui new file mode 100644 index 0000000..a6bb566 --- /dev/null +++ b/configurationServer/gui/widget.ui @@ -0,0 +1,80 @@ + + + Widget + + + + 0 + 0 + 1003 + 437 + + + + Widget + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + QListView::TopToBottom + + + QListView::ListMode + + + true + + + true + + + -1 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + +