Skip to content
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

Nmc/style sheet changes #5776

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,7 @@
<file>src/gui/ConflictDelegate.qml</file>
<file>src/gui/ConflictItemFileInfo.qml</file>
</qresource>
<qresource prefix="/qss">
<file>theme/Style/style.qss</file>
</qresource>
</RCC>
18 changes: 0 additions & 18 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/gui/accountsettings.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/gui/accountsettings.cpp

File src/gui/accountsettings.cpp (lines 13, 21, 48, 64, 73, 84, 85, 86, 87, 126, 127, 128, 171, 173, 175, 179, 184, 195, 222, 270, 316, 326, 327, 347, 351, 359, 463, 479, 490, 513, 546, 549, 622, 626, 642, 666, 667, 668, 705, 716, 718, 730, 731, 763, 787, 788, 789, 790, 791, 792, 797, 904, 905, 906, 907, 908, 909, 910, 911, 912, 918, 1028, 1029, 1036, 1038, 1043, 1050, 1051, 1090, 1091, 1092, 1095, 1163, 1194, 1195, 1230, 1244, 1245, 1249, 1250, 1260, 1294, 1295, 1351, 1352, 1408, 1437, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1491, 1501, 1502, 1503, 1504, 1544, 1553, 1554, 1555, 1556, 1583, 1584): Code does not conform to Custom style guidelines.
* Copyright (C) by Daniel Molkentin <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -76,16 +76,6 @@

Q_LOGGING_CATEGORY(lcAccountSettings, "nextcloud.gui.account.settings", QtInfoMsg)

static const char progressBarStyleC[] =
"QProgressBar {"
"border: 1px solid grey;"
"border-radius: 5px;"
"text-align: center;"
"}"
"QProgressBar::chunk {"
"background-color: %1; width: 1px;"
"}";

void showEnableE2eeWithVirtualFilesWarningDialog(std::function<void(void)> onAccept)
{
const auto messageBox = new QMessageBox;
Expand Down Expand Up @@ -220,11 +210,6 @@
connect(FolderMan::instance(), &FolderMan::folderListChanged, _model, &FolderStatusModel::resetFolders);
connect(this, &AccountSettings::folderChanged, _model, &FolderStatusModel::resetFolders);


// quotaProgressBar style now set in customizeStyle()
/*QColor color = palette().highlight().color();
_ui->quotaProgressBar->setStyleSheet(QString::fromLatin1(progressBarStyleC).arg(color.name()));*/

// Connect E2E stuff
initializeE2eEncryption();
_ui->encryptionMessage->setCloseButtonVisible(false);
Expand Down Expand Up @@ -1552,9 +1537,6 @@
auto msg = _ui->connectLabel->text();
Theme::replaceLinkColorStringBackgroundAware(msg);
_ui->connectLabel->setText(msg);

const auto color = palette().highlight().color();
_ui->quotaProgressBar->setStyleSheet(QString::fromLatin1(progressBarStyleC).arg(color.name()));
}

void AccountSettings::initializeE2eEncryption()
Expand Down
17 changes: 17 additions & 0 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ Application::Application(int &argc, char **argv)
setApplicationName(_theme->appName());
setWindowIcon(_theme->applicationIcon());

addCustomStyleSheet();

if (!ConfigFile().exists()) {
// Migrate from version <= 2.4
setApplicationName(_theme->appNameGUI());
Expand Down Expand Up @@ -1013,4 +1015,19 @@ bool Application::event(QEvent *event)
return SharedTools::QtSingleApplication::event(event);
}

void Application::addCustomStyleSheet()
{
const auto wizardPalette = palette();
const auto highlightColor = wizardPalette.highlight().color().name();
const auto highlightTextColor = wizardPalette.highlightedText().color().name();
const auto dark = wizardPalette.dark().color().name();
const auto background = wizardPalette.base().color().name();

QFile file(QStringLiteral(":/qss/theme/Style/style.qss"));
if (file.open(QFile::ReadOnly)) {
const auto &styleSheet = QString::fromLatin1(file.readAll());
setStyleSheet(styleSheet.arg(background, dark, highlightColor, highlightTextColor));
}
}

} // namespace OCC
2 changes: 2 additions & 0 deletions src/gui/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ protected slots:
*/
bool configVersionMigration();

void addCustomStyleSheet();

QPointer<ownCloudGui> _gui;

Theme *_theme;
Expand Down
1 change: 1 addition & 0 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ FolderWizard::FolderWizard(AccountPtr account, QWidget *parent)
setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage);

setWindowTitle(tr("Add Folder Sync Connection"));
setObjectName("folderWizard");
setOptions(QWizard::CancelButtonOnLeft);
setButtonText(QWizard::FinishButton, tr("Add Sync Connection"));
}
Expand Down
14 changes: 0 additions & 14 deletions src/gui/settingsdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/gui/settingsdialog.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/gui/settingsdialog.cpp

File src/gui/settingsdialog.cpp (lines 18, 28, 43, 44, 67, 70, 96, 98, 99, 132, 161, 193, 242, 250, 349): Code does not conform to Custom style guidelines.
* Copyright (C) by Daniel Molkentin <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -41,14 +41,6 @@
#include <QPainterPath>

namespace {
const QString TOOLBAR_CSS()
{
return QStringLiteral("QToolBar { background: %1; margin: 0; padding: 0; border: none; border-bottom: 1px solid %2; spacing: 0; } "
"QToolBar QToolButton { background: %1; border: none; border-bottom: 1px solid %2; margin: 0; padding: 5px; } "
"QToolBar QToolBarExtension { padding:0; } "
"QToolBar QToolButton:checked { background: %3; color: %4; }");
}

const float buttonSizeRatio = 1.618f; // golden ratio


Expand Down Expand Up @@ -337,12 +329,6 @@

void SettingsDialog::customizeStyle()
{
QString highlightColor(palette().highlight().color().name());
QString highlightTextColor(palette().highlightedText().color().name());
QString dark(palette().dark().color().name());
QString background(palette().base().color().name());
_toolBar->setStyleSheet(TOOLBAR_CSS().arg(background, dark, highlightColor, highlightTextColor));

Q_FOREACH (QAction *a, _actionGroup->actions()) {
QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette());
a->setIcon(icon);
Expand Down
9 changes: 7 additions & 2 deletions src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,17 @@ void OwncloudWizard::slotCurrentPageChanged(int id)
qCDebug(lcWizard) << "Current Wizard page changed to " << id;

const auto setNextButtonAsDefault = [this]() {
auto nextButton = qobject_cast<QPushButton *>(button(QWizard::NextButton));
if (nextButton) {
if (auto nextButton = qobject_cast<QPushButton *>(button(QWizard::NextButton))) {
nextButton->setObjectName("nextButton");
mgallien marked this conversation as resolved.
Show resolved Hide resolved
nextButton->setDefault(true);
}
};

if (auto backButton = qobject_cast<QPushButton *>(button(QWizard::BackButton))) {
backButton->setObjectName("backButton");
mgallien marked this conversation as resolved.
Show resolved Hide resolved
backButton->setDefault(true);
camilasan marked this conversation as resolved.
Show resolved Hide resolved
}

if (id == WizardCommon::Page_Welcome) {
// Set next button to just hidden so it retains it's layout
button(QWizard::NextButton)->setHidden(true);
Expand Down
9 changes: 9 additions & 0 deletions theme/Style/style.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

QToolBar { background: %1; margin: 0; padding: 0; border: none; border-bottom: 1px solid %2; spacing: 0; }
QToolBar QToolButton { background: %1; border: none; border-bottom: 1px solid %2; margin: 0; padding: 5px; }
QToolBar QToolBarExtension { padding:0; }
QToolBar QToolButton:checked { background: %3; color: %4; }


QProgressBar { border: 1px solid grey; border-radius: 5px; text-align: center; }
QProgressBar::chunk { background-color: %3 ; width: 1px; }
Loading