Commit 8bf445ee authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq
Browse files

Night theming for OSX

parent 3f95d5bd
......@@ -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));
}
}
......
......@@ -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
}
......
......@@ -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" ) );
......
......@@ -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 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment