refs #446, style sheet adjustments

* split up style sheets
* prepared stylesheet, also include placeholder for forthcoming data GUI
This commit is contained in:
Klaus Basan
2015-06-19 23:29:54 +02:00
committed by Mathew Sutcliffe
parent 9d0408138a
commit 091c61c909
11 changed files with 227 additions and 367 deletions

View File

@@ -67,72 +67,8 @@ BlackGui--CInfoArea {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
/** fix scroll areas **/
/** in flight plan **/
QAbstractScrollArea #qw_FlightPlanTabMain { background-color: black; background-image: url(:/textures/icons/textures/texture-inner.jpg); }
QAbstractScrollArea #qw_RemarksGenerator { background-color: transparent; background-image: url(:/textures/icons/textures/texture-inner.jpg); }
/** in log component **/
QAbstractScrollArea #pg_StatusPageMessages { background-color: black; }
QAbstractScrollArea #pg_StatusPageCons ole { background-color: black; }
/** main GUI parts **/
/** style when main window is frameless **/
#wi_CentralWidgetOutside[framelessMainWindow="true"] {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
margin: 0px;
border: 2px solid green;
border-radius: 20px;
}
/** dw_InfoBarStatus has its own style sheet **/
#fr_CentralFrameInside {
margin-right: 5px;
margin-left: 5px;
margin-top: 2px;
margin-bottom: 5px;
}
#gb_AtcStationsOnlineInfo {
border-style: none;
}
#sw_MainMiddle {
padding: 3px;
border: 1px solid green;
border-radius: 10px;
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
#sw_MainMiddle QPushButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
padding: 3px;
margin-right: 5px;
}
/** close button with frameless windows **/
#pb_FramelessCloseButton {
background: transparent;
padding: 0px 10px 0px 0px;
margin: 0px;
}
/** for FontDialog etc. **/
#comp_Settings QToolButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
}
#wi_MainKeypadArea QPushButton {
/** default for buttons **/
QPushButton {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
background: black;
@@ -145,53 +81,15 @@ QAbstractScrollArea #pg_StatusPageCons ole { background-color: black; }
min-height:20px;
}
#wi_MainKeypadArea QPushButton::checked {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
QPushButton::disabled {
background-color: grey;
border-style: solid;
border-color: yellow;
font: bold;
color: yellow;
}
/** cockpit needs to come after sw_MainMiddle **/
#comp_CockpitComComponent QPushButton {
background-color: transparent;
border-style: solid;
border-radius:3px;
border-width: 0px;
border-color: blue;
color: yellow;
padding: 1px;
margin: 2px;
}
/** fixes scroll area for audio setup and inner background **/
#sa_AudioSetup { background-color: black; }
#sa_AudioComponentInner {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
background-color: black;
}
/** volume buttons **/
#wi_AudioSoundButtons QPushButton {
background-color: transparent;
}
/** COM panel **/
#wip_CockpitComPanelShowHideBar QPushButton {
background-color: transparent;
border-style: solid;
border-radius:3px;
border-width: 0px;
border-color: blue;
}
#le_CommandLineInput {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
border-width: 1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
QProgressBar {

View File

@@ -1,217 +1,3 @@
/** Main window **/
QWidget {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
/** Main window **/
QMainWindow {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
/** separator between info areas and rest **/
/** this hides them **/
QMainWindow::separator {
background: transparent;
width: 0px; /* when vertical */
height: 0px; /* when horizontal */
}
QMainWindow::separator:hover {
background: transparent;
}
QPushButton {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
background: black;
border-style: solid;
border-width: 1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
QPushButton::disabled {
background-color: grey;
border-style: solid;
border-width: 1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
QTextEdit {
background: black; /** background is background color here **/
background-image: url(:/textures/icons/textures/texture-inner.jpg);
color: grey;
}
QRadioButton {
background: transparent;
}
QGroupBox {
border: 1px solid green;
margin-top: 2.5ex; /* leave space at the top for the title */
border-radius: 5px;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: middle center; /* position at the top center */
padding: 0 5px;
background: transparent;
}
QComboBox {
background-color: black;
border: 1px solid yellow;
}
QTabWidget::pane { /* The tab widget frame */
border: none;
}
QTabWidget::tab-bar {
left: 5px; /* move to the right by 5px */
}
QTabBar::tab {
border: 1px solid green;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
min-width: 30px;
padding: 2px;
padding-left: 4px;
padding-right: 4px;
margin-right: 3px;
}
QTabBar::tab::selected {
background-color: grey;
}
QTabBar::tear {
image: url(:/own/icons/own/transparent1px.png);
max-width: 1px;
}
QTabBar QToolButton { /* the scroll buttons are tool buttons */
background-color: rgba(0, 0, 255, 200);
border: 1px solid green;
}
QHeaderView::section {
border: 1px solid black;
background: transparent;
color: white; /** font **/
padding: 1px;
margin: 0px;
}
QTableView, QTreeView {
border: 1px solid green;
border-radius: 5px;
alternate-background-color: darkslategray;
selection-background-color: blue;
margin-left: 2px;
margin-right: 2px;
margin-top: 2px;
margin-bottom: 2px;
padding:0px;
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
QSizeGrip { }
QScrollArea {
border: 1px solid green;
border-radius: 5px;
}
QScrollBar:horizontal {
border: 2px solid gray;
background: slategray;
height: 10px;
margin: 0px 5px 0px 5px;
}
QScrollBar:vertical {
border: 2px solid gray;
background: slategray;
width: 10px;
margin: 5px 0px 5px 0;
}
QScrollBar::handle:horizontal {
background: black;
min-width: 15px;
}
QScrollBar::handle:vertical {
background: black;
min-height: 15px;
}
QScrollBar::add-line:horizontal {
border: 2px solid gray;
background: blue;
width: 5px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 2px solid gray;
background: blue;
width: 5px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar::add-line:vertical {
border: 2px solid gray;
background: blue;
height: 5px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 2px solid gray;
background: blue;
height: 5px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QSlider::groove:horizontal {
border: 1px solid gray;
height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: darkslategray;
}
QSlider::handle:horizontal {
background: lightgray;
border: 1px solid darkslategray;
width: 18px;
margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 3px;
}
QSizeGrip {
image: url(:/diagona/icons/diagona/icons/arrow-in-out.png);
padding: 0px 20px 0px 0px;
width: 16px;
height: 16px;
}
#le_CommandLineInput {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
margin-bottom: 5px;

View File

@@ -0,0 +1,20 @@
#le_CommandLineInput {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}
#comp_Log {
background: transparent; /** background is background color here **/
}
#gb_DBusMode {
background: transparent; /** background is background color here **/
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
#gb_Controls {
background: transparent; /** background is background color here **/
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}

View File

@@ -0,0 +1,141 @@
/**
Resources:
http://qt-project.org/doc/qt-5.3/stylesheet-examples.html
http://web.forret.com/tools/color.asp?RGB=2F4F4F&name=Dark+slate+gray
Remarks:
1) there is no opacity with background image, so we need semitransparent images
2) use -- instead of :: for namespaces
Used dynamic properties
framelessMainWindow (infobar.qss , here)
**/
/** fix scroll areas **/
/** in flight plan **/
QAbstractScrollArea #qw_FlightPlanTabMain { background-color: black; background-image: url(:/textures/icons/textures/texture-inner.jpg); }
QAbstractScrollArea #qw_RemarksGenerator { background-color: transparent; background-image: url(:/textures/icons/textures/texture-inner.jpg); }
/** in log component **/
QAbstractScrollArea #pg_StatusPageMessages { background-color: black; }
QAbstractScrollArea #pg_StatusPageCons ole { background-color: black; }
/** main GUI parts **/
/** style when main window is frameless **/
#wi_CentralWidgetOutside[framelessMainWindow="true"] {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
margin: 0px;
border: 2px solid green;
border-radius: 20px;
}
/** dw_InfoBarStatus has its own style sheet **/
#fr_CentralFrameInside {
margin-right: 5px;
margin-left: 5px;
margin-top: 2px;
margin-bottom: 5px;
}
#gb_AtcStationsOnlineInfo {
border-style: none;
}
#sw_MainMiddle {
padding: 3px;
border: 1px solid green;
border-radius: 10px;
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
#sw_MainMiddle QPushButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
padding: 0px;
margin-right: 5px;
}
/** close button with frameless windows **/
#pb_FramelessCloseButton {
background: transparent;
padding: 0px 0px 0px 0px;
image-position: right;
margin: 0px;
border: 0px;
}
/** for FontDialog etc. **/
#comp_Settings QToolButton {
background-color: rgba(0, 0, 255, 128);
border-style: none;
border-radius:3px;
color: yellow;
}
#wi_MainKeypadArea QPushButton {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
background: black;
border-style: solid;
border-width: 1px;
border-radius:6px;
border-color: green;
max-height:20px;
min-width:60px;
min-height:20px;
}
#wi_MainKeypadArea QPushButton::checked {
/** background-image: url(:/textures/icons/textures/texture-inner.jpg); **/
/** need to fix pressed button first **/
border-style: solid;
border-color: yellow;
font: bold;
color: yellow;
}
/** cockpit needs to come after sw_MainMiddle **/
#comp_CockpitComComponent QPushButton {
background-color: transparent;
border-style: solid;
border-radius:3px;
border-width: 0px;
border-color: blue;
color: yellow;
padding: 1px;
margin: 2px;
}
/** fixes scroll area for audio setup and inner background **/
#sa_AudioSetup { background-color: black; }
#sa_AudioComponentInner {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
background-color: black;
}
/** volume buttons **/
#wi_AudioSoundButtons QPushButton {
background-color: transparent;
}
/** COM panel **/
#wip_CockpitComPanelShowHideBar QPushButton {
background-color: transparent;
border-style: solid;
border-radius:3px;
border-width: 0px;
border-color: blue;
}
#le_CommandLineInput {
background-image: url(:/textures/icons/textures/texture-inner.jpg);
margin-bottom: 5px;
padding: 3px;
border-radius: 5px;
}

View File

@@ -134,7 +134,7 @@ namespace BlackGui
QString CStyleSheetUtility::styles(const QStringList &fileNames) const
{
QString style;
foreach(QString fileName, fileNames)
for (const QString &fileName : fileNames)
{
if (!this->containsStyle(fileName)) { continue; }
QString s = this->m_styleSheets[fileName.toLower()].trimmed();
@@ -232,9 +232,9 @@ namespace BlackGui
return f;
}
const QString &CStyleSheetUtility::fileNameMainWindow()
const QString &CStyleSheetUtility::fileNameSwiftStandardGui()
{
static const QString f("mainwindow.qss");
static const QString f("swiftstdgui.qss");
return f;
}
@@ -256,6 +256,12 @@ namespace BlackGui
return f;
}
const QString &CStyleSheetUtility::fileNameStandardWidget()
{
static const QString f("stdwidget.qss");
return f;
}
const QString &CStyleSheetUtility::fileNameInfoWindow()
{
static const QString f("stylesheetinfo.qss");
@@ -280,6 +286,12 @@ namespace BlackGui
return f;
}
const QString &CStyleSheetUtility::fileNameSwiftData()
{
static const QString f("swiftdata.qss");
return f;
}
const QString &CStyleSheetUtility::fileNameIniFile()
{
static const QString f("gui.ini");

View File

@@ -66,9 +66,6 @@ namespace BlackGui
//! File name fonts.qss
static const QString &fileNameFonts();
//! File name mainwindow.qss
static const QString &fileNameMainWindow();
//! File name infobar.qss
static const QString &fileNameInfoBar();
@@ -78,6 +75,9 @@ namespace BlackGui
//! File name dockwidgettab.qss
static const QString &fileNameDockWidgetTab();
//! File name for standard widgets
static const QString &fileNameStandardWidget();
//! File name maininfoarea.qss
static const QString &fileNameInfoWindow();
@@ -87,9 +87,15 @@ namespace BlackGui
//! File name maininfoarea.qss
static const QString &fileNameFilterDialog();
//! File name swift standard GUI
static const QString &fileNameSwiftStandardGui();
//! File name swiftcore.qss
static const QString &fileNameSwiftCore();
//! File name swiftcore.qss
static const QString &fileNameSwiftData();
//! File name ini file
static const QString &fileNameIniFile();

View File

@@ -40,10 +40,22 @@ CSwiftCore::CSwiftCore(const SetupInfo &info, QWidget *parent) :
setWindowIconText(name);
setupLogDisplay();
connectSlots();
ps_onStyleSheetsChanged();
initStyleSheet();
startCore(info);
}
void CSwiftCore::initStyleSheet()
{
const QString s = CStyleSheetUtility::instance().styles(
{
CStyleSheetUtility::fileNameFonts(),
CStyleSheetUtility::fileNameStandardWidget(),
CStyleSheetUtility::fileNameSwiftCore()
}
);
this->setStyleSheet(s);
}
CSwiftCore::~CSwiftCore()
{ }
@@ -79,13 +91,7 @@ void CSwiftCore::ps_p2pModeToggled(bool checked)
void CSwiftCore::ps_onStyleSheetsChanged()
{
const QString s = CStyleSheetUtility::instance().styles(
{
CStyleSheetUtility::fileNameFonts(),
CStyleSheetUtility::fileNameSwiftCore()
}
);
setStyleSheet(s);
this->initStyleSheet();
}
void CSwiftCore::connectSlots()

View File

@@ -63,6 +63,7 @@ private:
void startCore(const SetupInfo &setup);
void stopCore();
QString getDBusAddress() const;
void initStyleSheet();
QScopedPointer<Ui::CSwiftCore> ui;
};

View File

@@ -397,16 +397,9 @@ void SwiftGuiStd::ps_registerHotkeyFunctions()
void SwiftGuiStd::ps_onStyleSheetsChanged()
{
const QString s = CStyleSheetUtility::instance().styles(
{
CStyleSheetUtility::fileNameFonts(),
CStyleSheetUtility::fileNameMainWindow()
}
);
this->setStyleSheet(s);
this->initStyleSheet();
}
void SwiftGuiStd::ps_onCurrentMainWidgetChanged(int currentIndex)
{
emit currentMainInfoAreaChanged(this->ui->sw_MainMiddle->currentWidget());

View File

@@ -53,7 +53,6 @@ class SwiftGuiStd :
Q_OBJECT
public:
//! Main page indexes
//! \remarks keep the values in sync with the real tab indexes
enum MainPageIndex
@@ -133,6 +132,9 @@ private:
//! GUI status update
void updateGuiStatusInformation();
//! Set style sheet
void initStyleSheet();
//! 1st data reads
void initialDataReads();

View File

@@ -31,9 +31,6 @@ using namespace BlackMisc::Hardware;
using namespace BlackGui;
using namespace BlackGui::Components;
/*
* Init data
*/
void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
{
// POST(!) GUI init
@@ -45,6 +42,7 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
this->setWindowIcon(CIcons::swift24());
this->setWindowTitle(CProject::systemNameAndVersion());
this->setObjectName("SwiftGuiStd");
this->initStyleSheet();
QPoint pos = CGuiUtility::introWindowPosition();
this->move(pos);
@@ -141,9 +139,18 @@ void SwiftGuiStd::init(const CRuntimeConfig &runtimeConfig)
this->m_init = true;
}
/*
* GUI signals
*/
void SwiftGuiStd::initStyleSheet()
{
const QString s = CStyleSheetUtility::instance().styles(
{
CStyleSheetUtility::fileNameFonts(),
CStyleSheetUtility::fileNameStandardWidget(),
CStyleSheetUtility::fileNameSwiftStandardGui()
}
);
this->setStyleSheet(s);
}
void SwiftGuiStd::initGuiSignals()
{
// Remark: With new style, only methods of same signature can be connected
@@ -209,9 +216,6 @@ void SwiftGuiStd::initGuiSignals()
connect(this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::changedWholeInfoAreaFloating, this, &SwiftGuiStd::ps_onChangedMainInfoAreaFloating);
}
/*
* Init data when started
*/
void SwiftGuiStd::initialDataReads()
{
this->setContextAvailability();
@@ -226,9 +230,6 @@ void SwiftGuiStd::initialDataReads()
CLogMessage(this).info("Initial data read");
}
/*
* Start update timers
*/
void SwiftGuiStd::startUpdateTimersWhenConnected()
{
this->ui->comp_MainInfoArea->getAtcStationComponent()->setUpdateIntervalSeconds(this->ui->comp_MainInfoArea->getSettingsComponent()->getAtcUpdateIntervalSeconds());
@@ -236,9 +237,6 @@ void SwiftGuiStd::startUpdateTimersWhenConnected()
this->ui->comp_MainInfoArea->getUserComponent()->setUpdateIntervalSeconds(this->ui->comp_MainInfoArea->getSettingsComponent()->getUsersUpdateIntervalSeconds());
}
/*
* Stop udate timers
*/
void SwiftGuiStd::stopUpdateTimersWhenDisconnected()
{
this->ui->comp_MainInfoArea->getAtcStationComponent()->stopTimer();
@@ -246,9 +244,6 @@ void SwiftGuiStd::stopUpdateTimersWhenDisconnected()
this->ui->comp_MainInfoArea->getUserComponent()->stopTimer();
}
/*
* Stop all timers
*/
void SwiftGuiStd::stopAllTimers(bool disconnectSignalSlots)
{
this->m_timerContextWatchdog->stop();