Skip to content

Commit

Permalink
Revert removed spacer and fix button sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugen Fischer authored and Eugen Fischer committed Nov 24, 2023
1 parent 94ddeaf commit 946b43d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
33 changes: 30 additions & 3 deletions src/gui/nmcgui/nmcsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ void NMCSettingsDialog::slotSwitchPage(QAction *action)

void NMCSettingsDialog::slotAccountAvatarChanged()
{
//Intercept the base class slot, so the round avatar is not set.
//Empty
//Intercept the base class slot, so the round avatar is not set. (so, dont pass to base class)

//Fix Account button size, for ech new created account
fixAccountButtonSzie();
}

void OCC::NMCSettingsDialog::setDefaultSettings()
Expand All @@ -61,18 +63,43 @@ void OCC::NMCSettingsDialog::setDefaultSettings()

void OCC::NMCSettingsDialog::setLayout()
{
//Fix network and general settings button size
const auto actions = _toolBar->actions();
for(auto *action : actions)
{
_toolBar->widgetForAction(action)->setFixedWidth(142);
if((action->text() == QCoreApplication::translate("OCC::SettingsDialog","General") || action->text() == QCoreApplication::tr("General")) ||
(action->text() == QCoreApplication::translate("OCC::SettingsDialog","Network") || action->text() == QCoreApplication::tr("Network")) ||
(action->text() == QCoreApplication::translate("OCC::SettingsDialog","Account") || action->text() == QCoreApplication::tr("Account")))
{
auto *widget = _toolBar->widgetForAction(action);
if(widget)
{
widget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
widget->setFixedWidth(142);
}
}
}

//Fix initial account btton size
fixAccountButtonSzie();
}

void OCC::NMCSettingsDialog::setLogic()
{
//Empty
}

void NMCSettingsDialog::fixAccountButtonSzie()
{
auto action = _toolBar->actions().at(0);
auto *widget = _toolBar->widgetForAction(action);
if(widget)
{
widget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
widget->setFixedWidth(142);
}
}



} // namespace OCC
3 changes: 3 additions & 0 deletions src/gui/nmcgui/nmcsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public slots:
void setDefaultSettings() override final;
void setLayout() override final;
void setLogic() override final;

private:
void fixAccountButtonSzie();
};


Expand Down
9 changes: 4 additions & 5 deletions src/gui/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,11 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
_actionGroup->setExclusive(true);
connect(_actionGroup, &QActionGroup::triggered, this, &SettingsDialog::slotSwitchPage);

//NMC Customization, remove the spacer, so the widgets are aligned on the left side.
// Adds space between users + activities and general + network actions
//auto *spacer = new QWidget();
//spacer->setMinimumWidth(10);
//spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
//_toolBar->addWidget(spacer);
auto *spacer = new QWidget();
spacer->setMinimumWidth(10);
spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
_toolBar->addWidget(spacer);

QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General"));
_actionGroup->addAction(generalAction);
Expand Down

0 comments on commit 946b43d

Please sign in to comment.