Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/gui/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

[[nodiscard]] QSize sizeHint() const override
{
if (const auto *widget = currentWidget()) {

Check warning on line 53 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "widget" of type "const class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbO&open=AZ0phKB-J_U2KSmzHsbO&pullRequest=9702
return widget->sizeHint();
}
return QStackedWidget::sizeHint();
Expand All @@ -58,7 +58,7 @@

[[nodiscard]] QSize minimumSizeHint() const override
{
if (const auto *widget = currentWidget()) {

Check warning on line 61 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "widget" of type "const class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbP&open=AZ0phKB-J_U2KSmzHsbP&pullRequest=9702
return widget->minimumSizeHint();
}
return QStackedWidget::minimumSizeHint();
Expand All @@ -66,15 +66,15 @@

[[nodiscard]] bool hasHeightForWidth() const override
{
if (const auto *widget = currentWidget()) {

Check warning on line 69 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "widget" of type "const class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbQ&open=AZ0phKB-J_U2KSmzHsbQ&pullRequest=9702
return widget->hasHeightForWidth();
}
return QStackedWidget::hasHeightForWidth();
}

[[nodiscard]] int heightForWidth(int width) const override

Check warning on line 75 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "width" of type "int" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbR&open=AZ0phKB-J_U2KSmzHsbR&pullRequest=9702
{
if (const auto *widget = currentWidget()) {

Check warning on line 77 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "widget" of type "const class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbS&open=AZ0phKB-J_U2KSmzHsbS&pullRequest=9702
return widget->hasHeightForWidth() ? widget->heightForWidth(width) : widget->sizeHint().height();
}
return QStackedWidget::heightForWidth(width);
Expand All @@ -89,7 +89,7 @@
"QToolBar QToolButton:checked { background: palette(highlight); color: palette(highlighted-text); }"
);

const float buttonSizeRatio = 1.618f; // golden ratio

Check warning on line 92 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace constant with "std::numbers::phi_v<float>".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbT&open=AZ0phKB-J_U2KSmzHsbT&pullRequest=9702


/** display name with two lines that is displayed in the settings
Expand Down Expand Up @@ -123,10 +123,10 @@
using QWidget::QWidget;

protected:
void mousePressEvent(QMouseEvent *event) override

Check warning on line 126 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "event" of type "class QMouseEvent *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbU&open=AZ0phKB-J_U2KSmzHsbU&pullRequest=9702
{
if (event->button() == Qt::LeftButton) {
if (const auto *window = this->window(); window && window->windowHandle()) {

Check warning on line 129 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "window" of type "const class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbV&open=AZ0phKB-J_U2KSmzHsbV&pullRequest=9702
window->windowHandle()->startSystemMove();
event->accept();
return;
Expand All @@ -153,7 +153,7 @@
// People perceive this as a Window, so also make Ctrl+W work
auto *closeWindowAction = new QAction(this);
closeWindowAction->setShortcut(QKeySequence("Ctrl+W"));
connect(closeWindowAction, &QAction::triggered, this, &SettingsDialog::accept);
connect(closeWindowAction, &QAction::triggered, this, &SettingsDialog::close);
addAction(closeWindowAction);

setObjectName("Settings"); // required as group for saveGeometry call
Expand All @@ -174,7 +174,7 @@
QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General"));
_actionGroup->addAction(generalAction);
_toolBar->addAction(generalAction);
auto *accountSpacer = new QWidget(this);

Check warning on line 177 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "accountSpacer" of type "class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbW&open=AZ0phKB-J_U2KSmzHsbW&pullRequest=9702

Check failure on line 177 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbX&open=AZ0phKB-J_U2KSmzHsbX&pullRequest=9702
accountSpacer->setFixedHeight(16);
_toolBar->addWidget(accountSpacer);
_toolBar->addSeparator();
Expand Down Expand Up @@ -219,7 +219,7 @@
cfg.restoreGeometry(this);
}

SettingsDialog::~SettingsDialog()

Check failure on line 222 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use "=default" instead of the default implementation of this special member functions.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbY&open=AZ0phKB-J_U2KSmzHsbY&pullRequest=9702
{
}

Expand All @@ -229,7 +229,7 @@
}

// close event is not being called here
void SettingsDialog::resizeEvent(QResizeEvent *event)

Check warning on line 232 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this method "resizeEvent" to simply inherit it.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbZ&open=AZ0phKB-J_U2KSmzHsbZ&pullRequest=9702

Check warning on line 232 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "event" of type "class QResizeEvent *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsba&open=AZ0phKB-J_U2KSmzHsba&pullRequest=9702
{
QDialog::resizeEvent(event);

Expand Down Expand Up @@ -281,7 +281,7 @@
{
_stack->setCurrentWidget(_actionGroupWidgets.value(action));
_stack->updateGeometry();
if (auto *contentContainer = _stack->parentWidget()) {

Check warning on line 284 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "contentContainer" of type "class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbb&open=AZ0phKB-J_U2KSmzHsbb&pullRequest=9702
contentContainer->updateGeometry();
}
}
Expand Down Expand Up @@ -350,14 +350,14 @@

void SettingsDialog::slotAccountAvatarChanged()
{
auto *account = dynamic_cast<Account *>(sender());

Check warning on line 353 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this variable a pointer-to-const. The current type of "account" is "class OCC::Account *".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbc&open=AZ0phKB-J_U2KSmzHsbc&pullRequest=9702
if (!account) {
return;
}
updateAccountAvatar(account);
}

void SettingsDialog::updateAccountAvatar(const Account *account)

Check warning on line 360 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "account" of type "const class OCC::Account *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbd&open=AZ0phKB-J_U2KSmzHsbd&pullRequest=9702
{
if (!account || !_actionForAccount.contains(account)) {
return;
Expand Down Expand Up @@ -427,19 +427,19 @@
return;
}

const QScopedValueRollback<bool> updatingStyle(_updatingStyle, true);

Check warning on line 430 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Avoid explicitly specifying the template arguments by relying on the class template argument deduction.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbe&open=AZ0phKB-J_U2KSmzHsbe&pullRequest=9702
_toolBar->setStyleSheet(TOOLBAR_CSS);

setStyleSheet(QStringLiteral(
"#Settings { background: palette(window); border-radius: 0; }"

/* Navigation */

Check warning on line 436 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Edit this comment to use the C++ format, i.e. "//".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbL&open=AZ0phKB-J_U2KSmzHsbL&pullRequest=9702
"#settings_navigation, #settings_navigation_scroll { background: palette(alternate-base); border-radius: 12px; padding: 4px; }"

/* Content area */

Check warning on line 439 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Edit this comment to use the C++ format, i.e. "//".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbM&open=AZ0phKB-J_U2KSmzHsbM&pullRequest=9702
"#settings_content, #settings_content_scroll { background: palette(window); border-radius: 12px; }"

/* Panels */

Check warning on line 442 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Edit this comment to use the C++ format, i.e. "//".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbN&open=AZ0phKB-J_U2KSmzHsbN&pullRequest=9702
"#generalGroupBox, #advancedGroupBox, #aboutAndUpdatesGroupBox,"
"#accountStatusPanel, #connectionSettingsPanel, #fileProviderPanel, #syncFoldersPanel {"
" background: palette(alternate-base);"
Expand Down Expand Up @@ -515,7 +515,7 @@
setWindowTitle(tr("Settings"));
setGeometry(0, 0, 950, 500);

auto *mainLayout = new QHBoxLayout(this);

Check warning on line 518 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "mainLayout" of type "class QHBoxLayout *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbf&open=AZ0phKB-J_U2KSmzHsbf&pullRequest=9702

Check failure on line 518 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbg&open=AZ0phKB-J_U2KSmzHsbg&pullRequest=9702
mainLayout->setContentsMargins(12, 12, 12, 12);
mainLayout->setSpacing(12);
setLayout(mainLayout);
Expand All @@ -528,17 +528,17 @@
_toolBar->setMinimumWidth(220);
_toolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);

auto *navigationContainer = new QWidget(this);

Check failure on line 531 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbi&open=AZ0phKB-J_U2KSmzHsbi&pullRequest=9702

Check warning on line 531 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "navigationContainer" of type "class QWidget *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbh&open=AZ0phKB-J_U2KSmzHsbh&pullRequest=9702
navigationContainer->setObjectName("settings_navigation"_L1);
navigationContainer->setAttribute(Qt::WA_StyledBackground);

auto *navigationLayout = new QVBoxLayout(navigationContainer);

Check warning on line 535 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "navigationLayout" of type "class QVBoxLayout *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbj&open=AZ0phKB-J_U2KSmzHsbj&pullRequest=9702

Check failure on line 535 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbk&open=AZ0phKB-J_U2KSmzHsbk&pullRequest=9702
navigationLayout->setContentsMargins(0, 0, 0, 0);
navigationLayout->setSpacing(0);
navigationLayout->addWidget(_toolBar);
navigationLayout->addStretch(1);

auto *navigationScroll = new QScrollArea(this);

Check warning on line 541 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "navigationScroll" of type "class QScrollArea *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbl&open=AZ0phKB-J_U2KSmzHsbl&pullRequest=9702

Check failure on line 541 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbm&open=AZ0phKB-J_U2KSmzHsbm&pullRequest=9702
navigationScroll->setObjectName("settings_navigation_scroll"_L1);
navigationScroll->setWidgetResizable(true);
navigationScroll->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Expand All @@ -548,10 +548,10 @@
navigationScroll->viewport()->setAutoFillBackground(false);
navigationScroll->setWidget(navigationContainer);

_stack = new CurrentPageSizeStackedWidget(this);

Check failure on line 551 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbn&open=AZ0phKB-J_U2KSmzHsbn&pullRequest=9702
_stack->setObjectName(u"settings_content"_s);

auto *contentScroll = new QScrollArea(this);

Check warning on line 554 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "contentScroll" of type "class QScrollArea *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbo&open=AZ0phKB-J_U2KSmzHsbo&pullRequest=9702

Check failure on line 554 in src/gui/settingsdialog.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ0phKB-J_U2KSmzHsbp&open=AZ0phKB-J_U2KSmzHsbp&pullRequest=9702
contentScroll->setObjectName("settings_content_scroll"_L1);
contentScroll->setWidgetResizable(true);
contentScroll->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Expand Down
Loading