summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Lancaster <rlancaste@kde.org>2016-11-12 10:04:10 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-11-12 10:04:10 (GMT)
commit8bf445ee4b10edcf488f88cd2b69699bb3165648 (patch)
treebbbf56e079cb214082b9fb8c9f1ffee81a169404
parent3f95d5bdc28e1d587a23727fd73cf94657bc7581 (diff)
Night theming for OSX
-rw-r--r--kstars/fitsviewer/fitsview.cpp2
-rw-r--r--kstars/indi/servermanager.cpp8
-rw-r--r--kstars/kstars.cpp34
-rw-r--r--kstars/kstarsdbus.cpp32
4 files changed, 72 insertions, 4 deletions
diff --git a/kstars/fitsviewer/fitsview.cpp b/kstars/fitsviewer/fitsview.cpp
index 84f8fd8..13c654a 100644
--- a/kstars/fitsviewer/fitsview.cpp
+++ b/kstars/fitsviewer/fitsview.cpp
@@ -107,7 +107,7 @@ void FITSView::updateMouseCursor(){
}
if(mouseMode==scopeMouse){
QPixmap scope_pix=QPixmap(":/icons/center_telescope.svg").scaled(32,32,Qt::KeepAspectRatio,Qt::FastTransformation);
- viewport()->setCursor(QCursor(scope_pix,0,0));
+ viewport()->setCursor(QCursor(scope_pix,10,10));
}
}
diff --git a/kstars/indi/servermanager.cpp b/kstars/indi/servermanager.cpp
index c9da9c6..142781f 100644
--- a/kstars/indi/servermanager.cpp
+++ b/kstars/indi/servermanager.cpp
@@ -34,6 +34,7 @@
#include "Options.h"
#include "kstars.h"
#include "kstarsdatetime.h"
+#include "kspaths.h"
const int INDI_MAX_TRIES=3;
@@ -83,9 +84,10 @@ bool ServerManager::start()
else if(indiServerDir.length()>10)
indiServerDir=Options::indiServer().mid(0,Options::indiServer().length()-10);
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- QStringList envlist = env.toStringList();
- envlist.replaceInStrings(QRegularExpression("^(?i)PATH=(.*)"), "PATH=/usr/bin:/usr/local/bin:" + driversDir + ":" + indiServerDir + ":\\1");
- serverProcess->setEnvironment(envlist);
+ env.insert("PATH", "/usr/local/bin:/usr/bin:" + driversDir + ":" + indiServerDir);
+ QString gscDirPath=KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "gsc";
+ env.insert("GSCDAT", gscDirPath);
+ serverProcess->setProcessEnvironment(env);
#endif
}
diff --git a/kstars/kstars.cpp b/kstars/kstars.cpp
index f6851c6..6fe8c31 100644
--- a/kstars/kstars.cpp
+++ b/kstars/kstars.cpp
@@ -255,6 +255,40 @@ void KStars::applyConfig( bool doApplyFocus ) {
m_KStarsData->colorScheme()->loadFromConfig();
QApplication::setPalette( Options::darkAppColors() ? DarkPalette : OriginalPalette );
+ //Note: This uses style sheets to set the dark colors, this should be cross platform. Palettes have a different behavior on OS X and Windows as opposed to Linux.
+ //It might be a good idea to use stylesheets in the future instead of palettes but this will work for now for OS X.
+ //This is also in KStarsDbus.cpp. If you change it, change it in BOTH places.
+ #ifdef Q_OS_OSX
+ if(Options::darkAppColors())
+ qApp->setStyleSheet("QWidget { background-color: black; color:red; selection-background-color:rgb(30,30,30);selection-color:white}" \
+ "QToolBar { border:none }" \
+ "QTabBar::tab:selected { background-color:rgb(50,50,50) }" \
+ "QTabBar::tab:!selected { background-color:rgb(30,30,30) }" \
+ "QPushButton { background-color:rgb(50,50,50);border-width:1px; border-style:solid;border-color:black}" \
+ "QPushButton::disabled { background-color:rgb(10,10,10);border-width:1px; border-style:solid;border-color:black }" \
+ "QToolButton:Checked { background-color:rgb(30,30,30); border:none }" \
+ "QComboBox { background-color:rgb(30,30,30); }" \
+ "QComboBox::disabled { background-color:rgb(10,10,10) }" \
+ "QScrollBar::handle { background: rgb(30,30,30) }" \
+ "QSpinBox { border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }" \
+ "QDoubleSpinBox { border-width:1px; border-style:solid; border-color:rgb(30,30,30) }" \
+ "QLineEdit { border-width: 1px; border-style: solid; border-color:rgb(30,30,30) }" \
+ "QCheckBox::indicator:unchecked { background-color:rgb(30,30,30);border-width:1px; border-style:solid;border-color:black }" \
+ "QCheckBox::indicator:checked { background-color:red;border-width:1px; border-style:solid;border-color:black }" \
+ "QRadioButton::indicator:unchecked { background-color:rgb(30,30,30) }" \
+ "QRadioButton::indicator:checked { background-color:red }" \
+ "QRoundProgressBar { alternate-background-color:black }" \
+ "QDateTimeEdit {background-color:rgb(30,30,30); border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }" \
+ "QHeaderView { color:red;background-color:black }" \
+ "QHeaderView::Section { background-color:rgb(30,30,30) }" \
+ "QTableCornerButton::section{ background-color:rgb(30,30,30) }" \
+ "");
+ else
+ qApp->setStyleSheet("QRoundProgressBar { background-color: rgb(208,208,208) }" \
+ "");
+ #endif
+
+
//Set toolbar options from config file
toolBar("kstarsToolBar")->applySettings( KSharedConfig::openConfig()->group( "MainToolBar" ) );
toolBar( "viewToolBar" )->applySettings( KSharedConfig::openConfig()->group( "ViewToolBar" ) );
diff --git a/kstars/kstarsdbus.cpp b/kstars/kstarsdbus.cpp
index 7f7e58d..5deab5a 100644
--- a/kstars/kstarsdbus.cpp
+++ b/kstars/kstarsdbus.cpp
@@ -408,11 +408,43 @@ void KStars::loadColorScheme( const QString &name ) {
Options::setDarkAppColors( true );
OriginalPalette = QApplication::palette();
QApplication::setPalette( DarkPalette );
+ //Note: This uses style sheets to set the dark colors, this is cross platform. Palettes have a different behavior on OS X and Windows as opposed to Linux.
+ //It might be a good idea to use stylesheets in the future instead of palettes but this will work for now for OS X.
+ //This is also in KStars.cpp. If you change it, change it in BOTH places.
+ #ifdef Q_OS_OSX
+ qApp->setStyleSheet("QWidget { background-color: black; color:red; selection-background-color:rgb(30,30,30);selection-color:white}" \
+ "QToolBar { border:none }" \
+ "QTabBar::tab:selected { background-color:rgb(50,50,50) }" \
+ "QTabBar::tab:!selected { background-color:rgb(30,30,30) }" \
+ "QPushButton { background-color:rgb(50,50,50);border-width:1px; border-style:solid;border-color:black}" \
+ "QPushButton::disabled { background-color:rgb(10,10,10);border-width:1px; border-style:solid;border-color:black }" \
+ "QToolButton:Checked { background-color:rgb(30,30,30); border:none }" \
+ "QComboBox { background-color:rgb(30,30,30); }" \
+ "QComboBox::disabled { background-color:rgb(10,10,10) }" \
+ "QScrollBar::handle { background: rgb(30,30,30) }" \
+ "QSpinBox { border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }" \
+ "QDoubleSpinBox { border-width:1px; border-style:solid; border-color:rgb(30,30,30) }" \
+ "QLineEdit { border-width: 1px; border-style: solid; border-color:rgb(30,30,30) }" \
+ "QCheckBox::indicator:unchecked { background-color:rgb(30,30,30);border-width:1px; border-style:solid;border-color:black }" \
+ "QCheckBox::indicator:checked { background-color:red;border-width:1px; border-style:solid;border-color:black }" \
+ "QRadioButton::indicator:unchecked { background-color:rgb(30,30,30) }" \
+ "QRadioButton::indicator:checked { background-color:red }" \
+ "QRoundProgressBar { alternate-background-color:black }" \
+ "QDateTimeEdit {background-color:rgb(30,30,30); border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }" \
+ "QHeaderView { color:red;background-color:black }" \
+ "QHeaderView::Section { background-color:rgb(30,30,30) }" \
+ "QTableCornerButton::section{ background-color:rgb(30,30,30) }" \
+ "");
+ #endif
}
if ( Options::darkAppColors() && filename != "night.colors" ) {
Options::setDarkAppColors( false );
QApplication::setPalette( OriginalPalette );
+ #ifdef Q_OS_OSX
+ qApp->setStyleSheet("QRoundProgressBar { background-color: rgb(208,208,208) }" \
+ "");
+ #endif
}
Options::setColorSchemeFile( name );