1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-857 OP-869 fixed style sheet issues:

- removed wide style sheets
- added style sheet common to all platforms
- fixed broken styles for QTabWidget and QGroupBox on Windows
- fixed broken style for QTabWidget on Linux
This commit is contained in:
Philippe Renon 2013-03-12 22:04:03 +01:00
parent 96a1e1d8c9
commit 9b495b4d5e
10 changed files with 189 additions and 653 deletions

View File

@ -11,7 +11,7 @@
<UDPMirror>false</UDPMirror>
<Description>Wide configuration</Description>
<Details>Default configuration built for wide screens (17"up)</Details>
<StyleSheet>wide</StyleSheet>
<StyleSheet>default</StyleSheet>
</General>
<KeyBindings>
<size>0</size>

View File

@ -0,0 +1,84 @@
/* Default styles */
MyListWidget {
font-size: 11px;
}
Utils--StyledBar {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));
}
QSlider::groove:horizontal {
border: 1px solid rgb(196, 196, 196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249, 117, 76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196, 196, 196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196, 196, 196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249, 117, 76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196, 196, 196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

View File

@ -1,105 +1,19 @@
MyListWidget {font-size: 11px;}
MixerCurveWidget {font-size: 12px;}
Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));}
/* Linux styles */
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex;
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
padding: 0 3px;
}
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top center */
padding: 0 3px;
}
QTabWidget::pane { /* The tab widget frame */
margin: 1px,1px,1px,1px;
border: 2px solid rgb(196,196,196);
border-radius: 5px;
padding: 0px;
}
QSlider::groove:horizontal {
border: 1px solid rgb(196,196,196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249,117,76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196,196,196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196,196,196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249,117,76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196,196,196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
MixerCurveWidget {
font-size: 12px;
}

View File

@ -1,104 +1,22 @@
MyListWidget {font-size: 11px;}
Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));}
/* MacOS styles */
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex;
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
padding: 0 3px;
}
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top center */
padding: 0 3px;
}
QTabWidget::pane { /* The tab widget frame */
margin: 1px,1px,1px,1px;
border: 2px solid rgb(196,196,196);
border-radius: 5px;
padding: 0px;
}
QSlider::groove:horizontal {
border: 1px solid rgb(196,196,196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249,117,76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196,196,196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196,196,196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249,117,76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196,196,196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QTabWidget::pane {
margin: 1px, 1px, 1px, 1px;
border: 2px solid rgb(196, 196, 196);
border-radius: 5px;
padding: 0px;
}

View File

@ -1,104 +1,18 @@
MyListWidget {font-size: 11px;}
Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));}
/* Windows styles */
QGroupBox {
border: 1px solid gray;
border-radius: 3px;
margin-top: 1ex;
padding: 1ex 0px 0px 0px;
font-size: 11px;
font-weight: bold;
}
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top center */
padding: 0 3px;
}
QTabWidget::pane { /* The tab widget frame */
margin: 1px,1px,1px,1px;
border: 2px solid rgb(196,196,196);
border-radius: 5px;
padding: 0px;
}
QSlider::groove:horizontal {
border: 1px solid rgb(196,196,196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249,117,76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196,196,196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196,196,196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249,117,76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196,196,196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
left: 7px;
top: -1ex;
padding: 0px 3px;
}

View File

@ -1,105 +0,0 @@
MyListWidget {font-size: 11px;}
MixerCurveWidget {font-size: 12px;}
Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));}
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top center */
padding: 0 3px;
}
QTabWidget::pane { /* The tab widget frame */
margin: 1px,1px,1px,1px;
border: 2px solid rgb(196,196,196);
border-radius: 5px;
padding: 0px;
}
QSlider::groove:horizontal {
border: 1px solid rgb(196,196,196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249,117,76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196,196,196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196,196,196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249,117,76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196,196,196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

View File

@ -1,104 +0,0 @@
MyListWidget {font-size: 11px;}
Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));}
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top center */
padding: 0 3px;
}
QTabWidget::pane { /* The tab widget frame */
margin: 1px,1px,1px,1px;
border: 2px solid rgb(196,196,196);
border-radius: 5px;
padding: 0px;
}
QSlider::groove:horizontal {
border: 1px solid rgb(196,196,196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249,117,76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196,196,196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196,196,196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249,117,76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196,196,196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

View File

@ -1,104 +0,0 @@
MyListWidget {font-size: 11px;}
Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));}
QGroupBox {
border: 1px solid gray;
border-radius: 5px;
margin-top: 1ex; /* leave space at the top for the title */
font-size: 11px;
font-weight: bold;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left; /* position at the top center */
padding: 0 3px;
}
QTabWidget::pane { /* The tab widget frame */
margin: 1px,1px,1px,1px;
border: 2px solid rgb(196,196,196);
border-radius: 5px;
padding: 0px;
}
QSlider::groove:horizontal {
border: 1px solid rgb(196,196,196);
background: white;
height: 6px;
border-radius: 2px;
margin 10px 10px;
}
QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(249,117,76);
border: 1px solid #777;
height: 1px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: rgb(196,196,196);
width: 18px;
height: 28px;
margin: -2px 0;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::groove:vertical {
border: 1px solid rgb(196,196,196);
background: white;
width: 6px;
border-radius: 2px;
margin 0px -10px;
margin-top: 5px;
margin-bottom: 5px;
}
QSlider::sub-page:vertical {
background: #fff;
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::add-page:vertical {
background: rgb(249,117,76);
border: 1px solid #777;
width: 1px;
border-radius: 4px;
}
QSlider::handle:vertical {
background: rgb(196,196,196);
width: 18px;
margin: -6 -6;
border-radius: 3px;
border: 1px solid #777;
}
QSlider::handle:vertical:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}
QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

View File

@ -310,11 +310,37 @@ void MainWindow::extensionsInitialized()
qs = settings;
qDebug() << "Load default config from resource " << filename;
}
qs->beginGroup("General");
m_config_description=qs->value("Description", "none").toString();
m_config_details=qs->value("Details", "none").toString();
m_config_stylesheet=qs->value("StyleSheet", "none").toString();
loadStyleSheet(m_config_stylesheet);
m_config_description = qs->value("Description", "none").toString();
m_config_details = qs->value("Details", "none").toString();
m_config_stylesheet = qs->value("StyleSheet", "none").toString();
qDebug() << "Configured style sheet:" << m_config_stylesheet;
if (m_config_stylesheet == "wide") {
// OP-869 just in case some user configuration still references the now obsolete "wide" style sheet
m_config_stylesheet = "default";
}
// Load common style sheet
QString style = loadStyleSheet(m_config_stylesheet + ".qss");
// Load and concatenate platform specific style sheet
QString fileName = m_config_stylesheet;
#ifdef Q_OS_MAC
fileName += "_macos.qss";
#elif defined(Q_OS_LINUX)
fileName += "_linux.qss";
#else
fileName += "_windows.qss";
#endif
style += loadStyleSheet(fileName);
// We'll use qApp macro to get the QApplication pointer
// and set the style sheet application wide.
qDebug() << "Setting application style sheet to:" << style;
qApp->setStyleSheet(style);
qs->endGroup();
m_uavGadgetInstanceManager = new UAVGadgetInstanceManager(this);
m_uavGadgetInstanceManager->readSettings(qs);
@ -329,40 +355,33 @@ void MainWindow::extensionsInitialized()
emit m_coreImpl->coreOpened();
}
void MainWindow::loadStyleSheet(QString name) {
/* Let's use QFile and point to a resource... */
QDir directory(QCoreApplication::applicationDirPath());
QString MainWindow::loadStyleSheet(QString fileName) {
// Let's use QFile and point to a resource...
QDir dir(QCoreApplication::applicationDirPath());
#ifdef Q_OS_MAC
directory.cdUp();
directory.cd("Resources");
dir.cdUp();
dir.cd("Resources");
#else
directory.cdUp();
directory.cd("share");
directory.cd("openpilotgcs");
#endif
directory.cd("stylesheets");
#ifdef Q_OS_MAC
QFile data(directory.absolutePath()+QDir::separator()+name+"_macos.qss");
#elif defined(Q_OS_LINUX)
QFile data(directory.absolutePath()+QDir::separator()+name+"_linux.qss");
#else
QFile data(directory.absolutePath()+QDir::separator()+name+"_windows.qss");
dir.cdUp();
dir.cd("share");
dir.cd("openpilotgcs");
#endif
dir.cd("stylesheets");
QString style;
/* ...to open the file */
if(data.open(QFile::ReadOnly)) {
/* QTextStream... */
QTextStream styleIn(&data);
/* ...read file to a string. */
style = styleIn.readAll();
data.close();
/* We'll use qApp macro to get the QApplication pointer
* and set the style sheet application wide. */
qApp->setStyleSheet(style);
qDebug()<<"Loaded stylesheet:"<<style;
// ...to open the file
QFile file(dir.absolutePath() + QDir::separator() + fileName);
qDebug() << "Loading style sheet file" << file.fileName();
if (file.open(QFile::ReadOnly)) {
// QTextStream...
QTextStream textStream(&file);
// ...read file to a string.
style = textStream.readAll();
file.close();
}
else
qDebug()<<"Failed to openstylesheet file"<<directory.absolutePath()<<name;
else {
qDebug() << "Failed to open style sheet file" << file.fileName();
}
return style;
}
void MainWindow::closeEvent(QCloseEvent *event)

View File

@ -170,7 +170,7 @@ private:
void registerDefaultContainers();
void registerDefaultActions();
void createWorkspaces(QSettings* qs, bool diffOnly = false);
void loadStyleSheet(QString name);
QString loadStyleSheet(QString name);
CoreImpl *m_coreImpl;
UniqueIDManager *m_uniqueIDManager;