styling QSlider

This commit is contained in:
stojce 2014-03-14 23:24:32 +01:00
parent 6d15fb548c
commit 4e2d3c9549
5 changed files with 154 additions and 155 deletions

View file

@ -113,22 +113,139 @@
<context>
<name>Menu</name>
<message>
<location filename="src/Menu.cpp" line="429"/>
<location filename="src/Menu.cpp" line="431"/>
<source>Open .ini config file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="431"/>
<location filename="src/Menu.cpp" line="443"/>
<location filename="src/Menu.cpp" line="433"/>
<location filename="src/Menu.cpp" line="445"/>
<source>Text files (*.ini)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="441"/>
<location filename="src/Menu.cpp" line="443"/>
<source>Save .ini config file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PreferencesDialog</name>
<message>
<location filename="ui/preferencesDialog.ui" line="34"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="406"/>
<source>Avatar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="53"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="407"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Avatar display name &lt;span style=&quot; color:#909090;&quot;&gt;(optional)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="81"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="408"/>
<source>Not showing a name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="91"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="409"/>
<source>Head</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="114"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="410"/>
<source>Body</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="135"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="411"/>
<source>Advanced Tuning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="142"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="412"/>
<source>It&apos;s not recomended that you play with these settings unless you&apos;ve looked into exactly what they do.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="165"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="413"/>
<source>&lt;p&gt;Avatar&lt;/p&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="174"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="414"/>
<source>Lean scale (applies to Faceshift users)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="204"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="415"/>
<source>Vertical field of view</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="241"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="416"/>
<source>Avatar scale (default is 1.0)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="271"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="417"/>
<source>Pupil dillation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="308"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="418"/>
<source>Audio Jitter Buffer Samples (0 for automatic)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="345"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="419"/>
<source>Faceshift eye detection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="393"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="420"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Voxels&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="402"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="421"/>
<source>Maximum voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="439"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="422"/>
<source>Max voxels sent each second</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="514"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="423"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="525"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="424"/>
<source>Save all changes</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>

View file

@ -33,18 +33,18 @@ QPushButton {
padding: 10px 15px;
}
QSpinBox {
padding: 5px;
border-width: 1;
}
QDoubleSpinBox::up-button,
QSpinBox::up-button {
width: 25px;
height: 18px;
background-image: url(resources/styles/up.svg);
background-image: url(styles/up.svg);
background-repeat: no-repeat;
border: 1px #ccc solid;
@ -52,14 +52,32 @@ QSpinBox::up-button {
border-top-right-radius: 2px;
}
QDoubleSpinBox::down-button,
QSpinBox::down-button {
width: 25px;
height: 18px;
background-image: url(resources/styles/down.svg);
background-image: url(styles/down.svg);
background-repeat: no-repeat;
border: 1px #ccc solid;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
QSlider {
width: 125px;
height: 18px;
}
QSlider::groove:horizontal {
border: none;
background-image: url(styles/slider-bg.svg);
background-repeat: no-repeat;
background-position: center center;
}
QSlider::handle:horizontal {
width: 18px;
height: 18px;
background-image: url(styles/slider-handle.svg);
background-repeat: no-repeat;
background-position: center center;
}

View file

@ -687,148 +687,8 @@ void Menu::loginForCurrentDomain() {
void Menu::editPreferences() {
if (! _preferencesDialog) {
_preferencesDialog = new PreferencesDialog(Application::getInstance()->getGLWidget());
_preferencesDialog->show();
}
_preferencesDialog->raise();
/*
Application* applicationInstance = Application::getInstance();
QDialog dialog(applicationInstance->getWindow());
dialog.setWindowTitle("Interface Preferences");
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
dialog.setLayout(layout);
QFormLayout* form = new QFormLayout();
layout->addLayout(form, 1);
QString faceURLString = applicationInstance->getAvatar()->getHead()->getFaceModel().getURL().toString();
QLineEdit* faceURLEdit = new QLineEdit(faceURLString);
faceURLEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH);
faceURLEdit->setPlaceholderText(DEFAULT_HEAD_MODEL_URL.toString());
form->addRow("Face URL:", faceURLEdit);
QString skeletonURLString = applicationInstance->getAvatar()->getSkeletonModel().getURL().toString();
QLineEdit* skeletonURLEdit = new QLineEdit(skeletonURLString);
skeletonURLEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH);
skeletonURLEdit->setPlaceholderText(DEFAULT_BODY_MODEL_URL.toString());
form->addRow("Skeleton URL:", skeletonURLEdit);
QString displayNameString = applicationInstance->getAvatar()->getDisplayName();
QLineEdit* displayNameEdit = new QLineEdit(displayNameString);
displayNameEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH);
form->addRow("Display name:", displayNameEdit);
QSlider* pupilDilation = new QSlider(Qt::Horizontal);
pupilDilation->setValue(applicationInstance->getAvatar()->getHead()->getPupilDilation() * pupilDilation->maximum());
form->addRow("Pupil Dilation:", pupilDilation);
QSlider* faceshiftEyeDeflection = new QSlider(Qt::Horizontal);
faceshiftEyeDeflection->setValue(_faceshiftEyeDeflection * faceshiftEyeDeflection->maximum());
form->addRow("Faceshift Eye Deflection:", faceshiftEyeDeflection);
QSpinBox* fieldOfView = new QSpinBox();
fieldOfView->setMaximum(180.f);
fieldOfView->setMinimum(1.f);
fieldOfView->setValue(_fieldOfView);
form->addRow("Vertical Field of View (Degrees):", fieldOfView);
QDoubleSpinBox* leanScale = new QDoubleSpinBox();
leanScale->setValue(applicationInstance->getAvatar()->getLeanScale());
form->addRow("Lean Scale:", leanScale);
QDoubleSpinBox* avatarScale = new QDoubleSpinBox();
avatarScale->setValue(applicationInstance->getAvatar()->getScale());
form->addRow("Avatar Scale:", avatarScale);
QSpinBox* audioJitterBufferSamples = new QSpinBox();
audioJitterBufferSamples->setMaximum(10000);
audioJitterBufferSamples->setMinimum(-10000);
audioJitterBufferSamples->setValue(_audioJitterBufferSamples);
form->addRow("Audio Jitter Buffer Samples (0 for automatic):", audioJitterBufferSamples);
QSpinBox* maxVoxels = new QSpinBox();
const int MAX_MAX_VOXELS = 5000000;
const int MIN_MAX_VOXELS = 0;
const int STEP_MAX_VOXELS = 50000;
maxVoxels->setMaximum(MAX_MAX_VOXELS);
maxVoxels->setMinimum(MIN_MAX_VOXELS);
maxVoxels->setSingleStep(STEP_MAX_VOXELS);
maxVoxels->setValue(_maxVoxels);
form->addRow("Maximum Voxels:", maxVoxels);
QSpinBox* maxVoxelsPPS = new QSpinBox();
const int MAX_MAX_VOXELS_PPS = 6000;
const int MIN_MAX_VOXELS_PPS = 60;
const int STEP_MAX_VOXELS_PPS = 10;
maxVoxelsPPS->setMaximum(MAX_MAX_VOXELS_PPS);
maxVoxelsPPS->setMinimum(MIN_MAX_VOXELS_PPS);
maxVoxelsPPS->setSingleStep(STEP_MAX_VOXELS_PPS);
maxVoxelsPPS->setValue(_maxVoxelPacketsPerSecond);
form->addRow("Maximum Voxels Packets Per Second:", maxVoxelsPPS);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog.connect(buttons, SIGNAL(accepted()), SLOT(accept()));
dialog.connect(buttons, SIGNAL(rejected()), SLOT(reject()));
layout->addWidget(buttons);
int ret = dialog.exec();
if (ret == QDialog::Accepted) {
QUrl faceModelURL(faceURLEdit->text());
bool shouldDispatchIdentityPacket = false;
if (faceModelURL.toString() != faceURLString) {
// change the faceModelURL in the profile, it will also update this user's BlendFace
applicationInstance->getAvatar()->setFaceModelURL(faceModelURL);
shouldDispatchIdentityPacket = true;
}
QUrl skeletonModelURL(skeletonURLEdit->text());
if (skeletonModelURL.toString() != skeletonURLString) {
// change the skeletonModelURL in the profile, it will also update this user's Body
applicationInstance->getAvatar()->setSkeletonModelURL(skeletonModelURL);
shouldDispatchIdentityPacket = true;
}
QString displayNameStr(displayNameEdit->text());
if (displayNameStr != displayNameString) {
applicationInstance->getAvatar()->setDisplayName(displayNameStr);
shouldDispatchIdentityPacket = true;
}
if (shouldDispatchIdentityPacket) {
applicationInstance->getAvatar()->sendIdentityPacket();
}
applicationInstance->getAvatar()->getHead()->setPupilDilation(pupilDilation->value() / (float)pupilDilation->maximum());
_maxVoxels = maxVoxels->value();
applicationInstance->getVoxels()->setMaxVoxels(_maxVoxels);
_maxVoxelPacketsPerSecond = maxVoxelsPPS->value();
applicationInstance->getAvatar()->setLeanScale(leanScale->value());
applicationInstance->getAvatar()->setClampedTargetScale(avatarScale->value());
_audioJitterBufferSamples = audioJitterBufferSamples->value();
if (_audioJitterBufferSamples != 0) {
applicationInstance->getAudio()->setJitterBufferSamples(_audioJitterBufferSamples);
}
_fieldOfView = fieldOfView->value();
applicationInstance->resizeGL(applicationInstance->getGLWidget()->width(), applicationInstance->getGLWidget()->height());
_faceshiftEyeDeflection = faceshiftEyeDeflection->value() / (float)faceshiftEyeDeflection->maximum();
}
QMetaObject::invokeMethod(applicationInstance->getAudio(), "reset", Qt::QueuedConnection);
*/
sendFakeEnterEvent();
_preferencesDialog->show();
}
void Menu::goToDomain(const QString newDomain) {

View file

@ -6,13 +6,17 @@
//
//
#include "FramelessDialog.h"
#include <QPushButton>
#include <QFile>
#include <QPushButton>
#include "Application.h"
#include "FramelessDialog.h"
FramelessDialog::FramelessDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags | Qt::FramelessWindowHint) {
QFile styleSheet("resources/styles/global.qss");
QFile styleSheet(Application::resourcesPath() + "styles/global.qss");
if (styleSheet.open(QIODevice::ReadOnly)) {
QDir::setCurrent(Application::resourcesPath());
setStyleSheet(styleSheet.readAll());
}
setWindowOpacity(0.95);

View file

@ -20,7 +20,7 @@ class FramelessDialog : public QDialog {
public:
FramelessDialog(QWidget* parent = 0, Qt::WindowFlags flags = 0);
~FramelessDialog();
virtual ~FramelessDialog();
};