From 913783c0f121cd6763a2a76f3e4771a30d35eb2a Mon Sep 17 00:00:00 2001 From: stojce Date: Sun, 16 Mar 2014 22:47:03 +0100 Subject: [PATCH] resizing - fixed layout --- interface/interface_en.ts | 131 +- interface/resources/styles/global.qss | 4 +- interface/resources/styles/preferences.qss | 11 + interface/src/Menu.cpp | 3 +- interface/src/ui/FramelessDialog.cpp | 42 +- interface/src/ui/FramelessDialog.h | 13 +- interface/src/ui/PreferencesDialog.cpp | 1 + interface/ui/preferencesDialog.ui | 1615 ++++++++++++++------ 8 files changed, 1296 insertions(+), 524 deletions(-) create mode 100644 interface/resources/styles/preferences.qss diff --git a/interface/interface_en.ts b/interface/interface_en.ts index 75ada1910c..3c61d5f17a 100644 --- a/interface/interface_en.ts +++ b/interface/interface_en.ts @@ -113,22 +113,145 @@ Menu - + Open .ini config file - - + + Text files (*.ini) - + Save .ini config file + + PreferencesDialog + + + + Avatar + + + + + + <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> + + + + + + Not showing a name + + + + + + Head + + + + + + Body + + + + + + Advanced Tuning + + + + + + It's not recomended that you play with these settings unless you've looked into exactly what they do. + + + + + + <p>Avatar</p> + + + + + + Lean scale (applies to Faceshift users) + + + + + + Vertical field of view + + + + + + Avatar scale (default is 1.0) + + + + + + Pupil dillation + + + + + + Audio Jitter Buffer Samples (0 for automatic) + + + + + + Faceshift eye detection + + + + + + <html><head/><body><p>Voxels</p></body></html> + + + + + + Maximum voxels + + + + + + Max voxels sent each second + + + + + + PushButton + + + + + + Cancel + + + + + + Save all changes + + + QObject diff --git a/interface/resources/styles/global.qss b/interface/resources/styles/global.qss index 14929d39af..d302555463 100644 --- a/interface/resources/styles/global.qss +++ b/interface/resources/styles/global.qss @@ -4,7 +4,6 @@ } FramelessDialog { - background-color: rgb(255, 255, 255); font-family: Helvetica, Arial, sans-serif; font-size: 16px; } @@ -67,12 +66,15 @@ QSpinBox::down-button { QDoubleSpinBox::up-button, QSpinBox::up-button { + + margin-top:2px; border-top-left-radius: 4px; border-top-right-radius: 4px; } QDoubleSpinBox::down-button, QSpinBox::down-button { + margin-bottom:3px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; } diff --git a/interface/resources/styles/preferences.qss b/interface/resources/styles/preferences.qss new file mode 100644 index 0000000000..ee587b70da --- /dev/null +++ b/interface/resources/styles/preferences.qss @@ -0,0 +1,11 @@ +QLabel#avatarLabel { + background-image: url(styles/avatar.svg); + background-repeat: no-repeat; + background-position: left center; +} + +QLabel#advancedTuningLabel { + background-image: url(styles/wrench.svg); + background-repeat: no-repeat; + background-position: left center; +} diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index dd43e511bd..99e984c8cb 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -695,8 +695,9 @@ void Menu::loginForCurrentDomain() { void Menu::editPreferences() { if (! _preferencesDialog) { _preferencesDialog = new PreferencesDialog(Application::getInstance()->getGLWidget()); + _preferencesDialog->show(); } - _preferencesDialog->show(); + _preferencesDialog->raise(); } void Menu::goToDomain(const QString newDomain) { diff --git a/interface/src/ui/FramelessDialog.cpp b/interface/src/ui/FramelessDialog.cpp index 2216e61b91..9239deed90 100644 --- a/interface/src/ui/FramelessDialog.cpp +++ b/interface/src/ui/FramelessDialog.cpp @@ -8,20 +8,46 @@ #include #include +#include #include "Application.h" #include "FramelessDialog.h" FramelessDialog::FramelessDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags | Qt::FramelessWindowHint) { - - QFile styleSheet(Application::resourcesPath() + "styles/global.qss"); - if (styleSheet.open(QIODevice::ReadOnly)) { - QDir::setCurrent(Application::resourcesPath()); - setStyleSheet(styleSheet.readAll()); - } - - setWindowOpacity(0.95); + setWindowOpacity(0.9); setAttribute(Qt::WA_DeleteOnClose); + isResizing = false; +} + +void FramelessDialog::setStyleSheet(const QString& fileName) { + QFile globalStyleSheet(Application::resourcesPath() + "styles/global.qss"); + QFile styleSheet(Application::resourcesPath() + fileName); + if (styleSheet.open(QIODevice::ReadOnly) && globalStyleSheet.open(QIODevice::ReadOnly) ) { + QDir::setCurrent(Application::resourcesPath()); + QDialog::setStyleSheet(globalStyleSheet.readAll() + styleSheet.readAll()); + } +} +void FramelessDialog::mousePressEvent(QMouseEvent* mouseEvent) { + if (abs(mouseEvent->pos().x() - size().width()) < 2 && mouseEvent->button() == Qt::LeftButton) { + isResizing = true; + QApplication::setOverrideCursor(Qt::SizeHorCursor); + } + // propagate the event + QDialog::mousePressEvent(mouseEvent); +} + +void FramelessDialog::mouseReleaseEvent(QMouseEvent* mouseEvent) { + QApplication::restoreOverrideCursor(); + isResizing = false; + // propagate the event + QDialog::mouseReleaseEvent(mouseEvent); +} + +void FramelessDialog::mouseMoveEvent(QMouseEvent* mouseEvent) { + if (isResizing) { + resize(mouseEvent->pos().x(), size().height()); + } + QDialog::mouseMoveEvent(mouseEvent); } FramelessDialog::~FramelessDialog() { diff --git a/interface/src/ui/FramelessDialog.h b/interface/src/ui/FramelessDialog.h index fd2121ddad..4e18aff161 100644 --- a/interface/src/ui/FramelessDialog.h +++ b/interface/src/ui/FramelessDialog.h @@ -10,10 +10,10 @@ #define __hifi__FramelessDialog__ #include +#include +#include #include #include -#include -#include class FramelessDialog : public QDialog { Q_OBJECT @@ -21,6 +21,15 @@ class FramelessDialog : public QDialog { public: FramelessDialog(QWidget* parent = 0, Qt::WindowFlags flags = 0); virtual ~FramelessDialog(); + void setStyleSheet(const QString& fileName); + +protected: + void mouseMoveEvent(QMouseEvent* mouseEvent); + void mousePressEvent(QMouseEvent* mouseEvent); + void mouseReleaseEvent(QMouseEvent* mouseEvent); + +private: + bool isResizing; }; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index b82bcd7e68..318db54f2c 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -12,6 +12,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags flags) : FramelessDialog(parent, flags) { ui.setupUi(this); + setStyleSheet("styles/preferences.qss"); loadPreferences(); } diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index 8fed57c06b..0099838177 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -2,486 +2,43 @@ PreferencesDialog + + Qt::ApplicationModal + 0 0 - 611 - 805 + 640 + 752 - - - - 30 - 0 - 555 - 701 - - - - - - - - 23 - - - - color: #0e7077 - - - Avatar - - - faceURLEdit - - - - - - - - 0 - 0 - - - - color: #0e7077 - - - <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> - - - displayNameEdit - - - - - - - - 0 - 0 - - - - - 280 - 0 - - - - Qt::LeftToRight - - - - - - Not showing a name - - - - - - - color: #0e7077 - - - Head - - - faceURLEdit - - - - - - - - 0 - 0 - - - - - - - - color: #0e7077 - - - Body - - - faceURLEdit - - - - - - - - - - - 23 - - - - color: #0e7077 - - - Advanced Tuning - - - - - - - It's not recomended that you play with these settings unless you've looked into exactly what they do. - - - false - - - true - - - - - - - - 20 - 50 - false - - - - color: #0e7077 - - - <p>Avatar</p> - - - - - - - - - Lean scale (applies to Faceshift users) - - - leanScaleSpin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - Vertical field of view - - - fieldOfViewSpin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 1 - - - 180 - - - - - - - - - - - Avatar scale (default is 1.0) - - - avatarScaleSpin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - Pupil dillation - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - - - Audio Jitter Buffer Samples (0 for automatic) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - -10000 - - - 10000 - - - 1 - - - - - - - - - - - Faceshift eye detection - - - avatarScaleSpin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - - 20 - 50 - false - - - - color: #0e7077 - - - <html><head/><body><p>Voxels</p></body></html> - - - - - - - - - Maximum voxels - - - leanScaleSpin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 5000000 - - - 50000 - - - - - - - - - - - Max voxels sent each second - - - leanScaleSpin - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 60 - - - 6000 - - - 10 - - - - - - - + + + 0 + 0 + + + + + 610 + 0 + + 0 - 725 + 720 616 80 + + + Arial + + background-color: #0e7077 @@ -494,9 +51,22 @@ 41 + + + Arial + + + + 0 + + + + Arial + + Qt::Horizontal @@ -510,6 +80,11 @@ + + + Arial + + Cancel @@ -517,6 +92,11 @@ + + + Arial + + background-color: #fff; color: #0e7077 @@ -532,6 +112,1066 @@ color: #0e7077 + + + + 0 + 0 + 621 + 1000 + + + + + 0 + 0 + + + + true + + + + + 0 + 0 + 619 + 998 + + + + + + 0 + 50 + 621 + 783 + + + + + Arial + + + + + 0 + + + 30 + + + 0 + + + 30 + + + + + + 0 + 0 + + + + + Arial + 24 + + + + color: #0e7077 + + + Avatar + + + 25 + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + Arial + 16 + + + + color: #0e7077 + + + <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + displayNameEdit + + + + + + + + 0 + 0 + + + + + 280 + 0 + + + + + Arial + + + + Qt::LeftToRight + + + + + + Not showing a name + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + Arial + 16 + + + + color: #0e7077 + + + Head + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + faceURLEdit + + + + + + + + 0 + 0 + + + + + Arial + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + Arial + 16 + + + + color: #0e7077 + + + Body + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + skeletonURLEdit + + + + + + + + 0 + 0 + + + + + Arial + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Arial + 24 + + + + color: #0e7077 + + + Advanced Tuning + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 25 + + + + + + + + 0 + 0 + + + + + Arial + + + + color: rgb(51, 51, 51) + + + It's not recomended that you play with these settings unless you've looked into exactly what they do. + + + false + + + true + + + + + + + + 0 + 0 + + + + + 0 + 40 + + + + + Arial + 20 + 50 + false + + + + color: #0e7077 + + + <p>Avatar</p> + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + 0 + + + 10 + + + 10 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 25 + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Lean scale (applies to Faceshift users) + + + leanScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 10 + + + + + + + + + 0 + 0 + + + + + 95 + 36 + + + + + 70 + 16777215 + + + + + Arial + + + + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Vertical field of view + + + fieldOfViewSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 95 + 36 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 180 + + + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Avatar scale (default is 1.0) + + + avatarScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 95 + 36 + + + + + 70 + 16777215 + + + + + Arial + + + + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Pupil dillation + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 125 + 0 + + + + + Arial + + + + Qt::Horizontal + + + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Audio Jitter Buffer Samples (0 for automatic) + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 95 + 36 + + + + + 70 + 16777215 + + + + + Arial + + + + -10000 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Faceshift eye detection + + + avatarScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 125 + 0 + + + + + Arial + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + + 0 + 40 + + + + + Arial + 20 + 50 + false + + + + color: #0e7077 + + + <html><head/><body><p>Voxels</p></body></html> + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + color: rgb(51, 51, 51) + + + Maximum voxels + + + leanScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 125 + 36 + + + + + Arial + + + + 5000000 + + + 50000 + + + + + + + + + 0 + + + 10 + + + 0 + + + 10 + + + + + + Arial + + + + Max voxels sent each second + + + leanScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 95 + 36 + + + + + 70 + 16777215 + + + + + Arial + + + + 60 + + + 6000 + + + 10 + + + + + + + + + + + 540 + 40 + 114 + 32 + + + + PushButton + + + + @@ -539,47 +1179,6 @@ color: #0e7077 1 - - displayNameEdit - faceURLEdit - leanScaleSpin - fieldOfViewSpin - avatarScaleSpin - pupilDilationSlider - - - - cancelButton - clicked() - PreferencesDialog - close() - - - 372 - 700 - - - 528 - -9 - - - - - defaultButton - clicked() - PreferencesDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - +