-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add non-native dark theme #5076
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,7 @@ struct QBtCommandLineParameters | |
#endif | ||
#ifndef DISABLE_GUI | ||
bool noSplash; | ||
bool darkTheme; | ||
#else | ||
bool shouldDaemonize; | ||
#endif | ||
|
@@ -112,6 +113,7 @@ struct QBtCommandLineParameters | |
#endif | ||
#ifndef DISABLE_GUI | ||
, noSplash(Preferences::instance()->isSplashScreenDisabled()) | ||
, darkTheme(false) | ||
#else | ||
, shouldDaemonize(false) | ||
#endif | ||
|
@@ -187,6 +189,19 @@ int main(int argc, char *argv[]) | |
std::cerr << "Couldn't set environment variable...\n"; | ||
|
||
#ifndef DISABLE_GUI | ||
|
||
// Set dark theme | ||
if (params.darkTheme) { | ||
QFile file(":/qdarkstylesheet.qss"); | ||
if(file.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix coding style! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok) I'll look to coding style guide closely and properly and fix these mistakes. Thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a config for uncrustify which can help you at least partially. The config is not complete yet, and you are welcomed to extend it, of course. |
||
app->setStyleSheet(file.readAll()); | ||
file.close(); | ||
} | ||
QPalette palette = app->palette(); | ||
palette.setColor(QPalette::Active, QPalette::Base, QColor(100,100,100)); | ||
app->setPalette(palette); | ||
} | ||
|
||
if (!userAgreesWithLegalNotice()) | ||
return EXIT_SUCCESS; | ||
#else | ||
|
@@ -297,6 +312,9 @@ QBtCommandLineParameters parseCommandLine() | |
else if (arg == QLatin1String("--no-splash")) { | ||
result.noSplash = true; | ||
} | ||
else if (arg == QLatin1String("--dark-theme")) { | ||
result.darkTheme = true; | ||
} | ||
#else | ||
else if ((arg == QLatin1String("-d")) || (arg == QLatin1String("--daemon"))) { | ||
result.shouldDaemonize = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,6 +275,8 @@ MainWindow::MainWindow(QWidget *parent) | |
createKeyboardShortcuts(); | ||
// Create status bar | ||
status_bar = new StatusBar(QMainWindow::statusBar()); | ||
this->setStyleSheet("QStatusBar::item { border-width: 0; }"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is C++! this is implicit. No need to use it everywhere. |
||
|
||
connect(status_bar->connectionStatusButton(), SIGNAL(clicked()), SLOT(showConnectionSettings())); | ||
connect(actionUse_alternative_speed_limits, SIGNAL(triggered()), status_bar, SLOT(toggleAlternativeSpeeds())); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,6 @@ | |
StatusBar::StatusBar(QStatusBar *bar) | ||
: m_bar(bar) | ||
{ | ||
qApp->setStyleSheet("QStatusBar::item { border-width: 0; }"); | ||
|
||
Preferences* const pref = Preferences::instance(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just did the move in e35a7ef. Placing here is more intuitive IMO, or, this is blocking this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with you about intuitive, but it is blocking dark style sheets - I tested it several times with and without it) |
||
connect(BitTorrent::Session::instance(), SIGNAL(speedLimitModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool))); | ||
m_container = new QWidget(bar); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be more useful to put the stylesheet outside of the application binary to allow for possible user edits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It would be more useful, but we must guarantee that stylesheet will be deployed with application separately. Should it be in %Some_user_settings_path% or in app directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but I'm not familiar with Windows filesystem layout. Certainly application directory is a bad place, since in general user shall not be able to edit files there. It might have sense to keep the file in resources and copy it (without overwriting) into the user directory at start up.
Although the maintainer in one of the PRs told me that he objects colour customisation. Be ready ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does "to objecting" mean "to protesting"? So, when I finish stylesheet integration, may it won't be approved like a customization patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know :) I'm into customisations and support the idea that applications styles have to be controllable by a user. @sledgehammer999 ? Could you comment on this, please?