mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Moves the separator to between accounts.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
7e8b5f34d7
commit
9ad2a980ce
1 changed files with 22 additions and 17 deletions
|
@ -92,6 +92,21 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
|
||||||
_actionGroup = new QActionGroup(this);
|
_actionGroup = new QActionGroup(this);
|
||||||
_actionGroup->setExclusive(true);
|
_actionGroup->setExclusive(true);
|
||||||
|
|
||||||
|
connect(_actionGroup, &QActionGroup::triggered, this, &SettingsDialog::slotSwitchPage);
|
||||||
|
|
||||||
|
foreach(auto ai, AccountManager::instance()->accounts()) {
|
||||||
|
accountAdded(ai.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
_actionBefore = new QAction;
|
||||||
|
_toolBar->addAction(_actionBefore);
|
||||||
|
|
||||||
|
// Adds space
|
||||||
|
QWidget* spacer = new QWidget();
|
||||||
|
spacer->setMinimumWidth(30);
|
||||||
|
spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||||
|
_toolBar->addWidget(spacer);
|
||||||
|
|
||||||
QAction *generalAction = createColorAwareAction(QLatin1String(":/client/resources/settings.png"), tr("General"));
|
QAction *generalAction = createColorAwareAction(QLatin1String(":/client/resources/settings.png"), tr("General"));
|
||||||
_actionGroup->addAction(generalAction);
|
_actionGroup->addAction(generalAction);
|
||||||
_toolBar->addAction(generalAction);
|
_toolBar->addAction(generalAction);
|
||||||
|
@ -108,18 +123,6 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
|
||||||
_actionGroupWidgets.insert(generalAction, generalSettings);
|
_actionGroupWidgets.insert(generalAction, generalSettings);
|
||||||
_actionGroupWidgets.insert(networkAction, networkSettings);
|
_actionGroupWidgets.insert(networkAction, networkSettings);
|
||||||
|
|
||||||
// Adds space
|
|
||||||
QWidget* spacer = new QWidget();
|
|
||||||
spacer->setMinimumWidth(100);
|
|
||||||
spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
|
||||||
_toolBar->insertWidget(_actionBefore, spacer);
|
|
||||||
|
|
||||||
foreach (auto ai, AccountManager::instance()->accounts()) {
|
|
||||||
accountAdded(ai.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(_actionGroup, &QActionGroup::triggered, this, &SettingsDialog::slotSwitchPage);
|
|
||||||
|
|
||||||
QTimer::singleShot(1, this, &SettingsDialog::showFirstPage);
|
QTimer::singleShot(1, this, &SettingsDialog::showFirstPage);
|
||||||
|
|
||||||
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
|
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
|
||||||
|
@ -200,7 +203,6 @@ void SettingsDialog::showActivityPage()
|
||||||
//}
|
//}
|
||||||
|
|
||||||
void SettingsDialog::activityAdded(AccountState *s){
|
void SettingsDialog::activityAdded(AccountState *s){
|
||||||
_activitySettings[s] = new ActivitySettings(s, this);
|
|
||||||
_ui->stack->addWidget(_activitySettings[s]);
|
_ui->stack->addWidget(_activitySettings[s]);
|
||||||
connect(_activitySettings[s], &ActivitySettings::guiLog, _gui,
|
connect(_activitySettings[s], &ActivitySettings::guiLog, _gui,
|
||||||
&ownCloudGui::slotShowOptionalTrayMessage);
|
&ownCloudGui::slotShowOptionalTrayMessage);
|
||||||
|
@ -212,7 +214,6 @@ void SettingsDialog::activityAdded(AccountState *s){
|
||||||
// all buttons must have the same size in order to keep a good layout
|
// all buttons must have the same size in order to keep a good layout
|
||||||
QAction *action = createColorAwareAction(QLatin1String(":/client/resources/activity.png"), tr("Activity"));
|
QAction *action = createColorAwareAction(QLatin1String(":/client/resources/activity.png"), tr("Activity"));
|
||||||
action->setProperty("account", QVariant::fromValue(s));
|
action->setProperty("account", QVariant::fromValue(s));
|
||||||
_actionGroupWidgets.insert(_toolBar->insertSeparator(_actionBefore), _activitySettings[s]);
|
|
||||||
_toolBar->insertAction(_actionBefore, action);
|
_toolBar->insertAction(_actionBefore, action);
|
||||||
_actionGroup->addAction(action);
|
_actionGroup->addAction(action);
|
||||||
_actionGroupWidgets.insert(action, _activitySettings[s]);
|
_actionGroupWidgets.insert(action, _activitySettings[s]);
|
||||||
|
@ -222,9 +223,14 @@ void SettingsDialog::activityAdded(AccountState *s){
|
||||||
void SettingsDialog::accountAdded(AccountState *s)
|
void SettingsDialog::accountAdded(AccountState *s)
|
||||||
{
|
{
|
||||||
auto height = _toolBar->sizeHint().height();
|
auto height = _toolBar->sizeHint().height();
|
||||||
|
|
||||||
bool brandingSingleAccount = !Theme::instance()->multiAccount();
|
bool brandingSingleAccount = !Theme::instance()->multiAccount();
|
||||||
|
|
||||||
|
_activitySettings[s] = new ActivitySettings(s, this);
|
||||||
|
if(AccountManager::instance()->accounts().first().data() != s &&
|
||||||
|
AccountManager::instance()->accounts().size() >= 1){
|
||||||
|
_actionGroupWidgets.insert(_toolBar->insertSeparator(_actionBefore), _activitySettings[s]);
|
||||||
|
}
|
||||||
|
|
||||||
QAction *accountAction;
|
QAction *accountAction;
|
||||||
QImage avatar = s->account()->avatar();
|
QImage avatar = s->account()->avatar();
|
||||||
const QString actionText = brandingSingleAccount ? tr("Account") : s->account()->displayName();
|
const QString actionText = brandingSingleAccount ? tr("Account") : s->account()->displayName();
|
||||||
|
@ -362,9 +368,8 @@ void SettingsDialog::customizeStyle()
|
||||||
QIcon icon = createColorAwareIcon(a->property("iconPath").toString());
|
QIcon icon = createColorAwareIcon(a->property("iconPath").toString());
|
||||||
a->setIcon(icon);
|
a->setIcon(icon);
|
||||||
QToolButton *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
|
QToolButton *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
|
||||||
if (btn) {
|
if (btn)
|
||||||
btn->setIcon(icon);
|
btn->setIcon(icon);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue