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

Implement progress spinner after wizard #11007

Merged
merged 2 commits into from
Jul 12, 2023
Merged
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
6 changes: 6 additions & 0 deletions changelog/unreleased/10751
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Display a progress spinner during the initial setup

We now display a progress spinner after the setup wizard, until
the client is done setting the account up.

https://github.com/owncloud/client/issues/10751
11 changes: 11 additions & 0 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ AccountSettings::AccountSettings(const AccountStatePtr &accountState, QWidget *p
connect(_model, &FolderStatusModel::dataChanged, [this]() {
ui->addButton->setVisible(!Theme::instance()->singleSyncFolder() || _model->rowCount() == 0);
});

connect(_accountState.get(), &AccountState::isSettingUpChanged, this, [this] {
if (_accountState->isSettingUp()) {
ui->spinner->startAnimation();
ui->stackedWidget->setCurrentWidget(ui->loadingPage);
} else {
ui->spinner->stopAnimation();
ui->stackedWidget->setCurrentWidget(ui->folderListPage);
}
});
ui->stackedWidget->setCurrentWidget(ui->folderListPage);
}


Expand Down
1 change: 0 additions & 1 deletion src/gui/accountsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

class QModelIndex;
class QNetworkReply;
class QListWidgetItem;
class QLabel;
class QSortFilterProxyModel;

Expand Down
96 changes: 81 additions & 15 deletions src/gui/accountsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,80 @@
</widget>
</item>
<item>
<widget class="QTreeView" name="_folderList">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="animated">
<bool>true</bool>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="loadingPage">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Preparing the account</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QProgressIndicator" name="spinner" native="true"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="folderListPage">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTreeView" name="_folderList">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="animated">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
Expand Down Expand Up @@ -243,6 +301,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QProgressIndicator</class>
<extends>QWidget</extends>
<header>QProgressIndicator.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
13 changes: 13 additions & 0 deletions src/gui/accountstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,17 @@ QuotaInfo *AccountState::quotaInfo()
return _quotaInfo;
}

bool AccountState::isSettingUp() const
{
return _settingUp;
}

void AccountState::setSettingUp(bool settingUp)
{
if (_settingUp != settingUp) {
_settingUp = settingUp;
Q_EMIT isSettingUpChanged();
}
}

} // namespace OCC
9 changes: 9 additions & 0 deletions src/gui/accountstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ class AccountState : public QObject
void tagLastSuccessfullETagRequest(const QDateTime &tp);
UpdateUrlDialog *updateUrlDialog(const QUrl &newUrl);

/***
* The account is setup for the first time, this may take some time
*/
bool isSettingUp() const;
void setSettingUp(bool settingUp);

public slots:
/// Triggers a ping to the server to update state and
/// connection status and errors.
Expand All @@ -161,6 +167,7 @@ public slots:
void stateChanged(State state);
void isConnectedChanged();
void urlUpdated();
void isSettingUpChanged();

protected Q_SLOTS:
void slotConnectionValidatorResult(ConnectionValidator::Status status, const QStringList &errors);
Expand All @@ -181,6 +188,8 @@ protected Q_SLOTS:
QPointer<TlsErrorDialog> _tlsDialog;
bool _supportsSpaces = true;

bool _settingUp = false;

/**
* Starts counting when the server starts being back up after 503 or
* maintenance mode. The account will only become connected once this
Expand Down
9 changes: 6 additions & 3 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ void ownCloudGui::runNewAccountWizard()
if (!newAccount.isNull()) {
// finally, call the slot that finalizes the setup
auto accountStatePtr = ocApp()->addNewAccount(newAccount);
accountStatePtr->setSettingUp(true);

// ensure we are connected and fetch the capabilities
auto validator = new ConnectionValidator(accountStatePtr->account(), accountStatePtr->account().data());
Expand All @@ -868,7 +869,7 @@ void ownCloudGui::runNewAccountWizard()
case Wizard::SyncMode::UseVfs: {
bool useVfs = syncMode == Wizard::SyncMode::UseVfs;
setUpInitialSyncFolder(accountStatePtr, useVfs);

accountStatePtr->setSettingUp(false);
break;
}
case Wizard::SyncMode::ConfigureUsingFolderWizard: {
Expand Down Expand Up @@ -897,19 +898,21 @@ void ownCloudGui::runNewAccountWizard()

folderMan->setSyncEnabled(true);
folderMan->scheduleAllFolders();
accountStatePtr->setSettingUp(false);
});

connect(folderWizard, &QDialog::rejected, []() {
connect(folderWizard, &QDialog::rejected, [accountStatePtr]() {
qCInfo(lcApplication) << "Folder wizard cancelled";
FolderMan::instance()->setSyncEnabled(true);
accountStatePtr->setSettingUp(false);
});

folderWizard->open();
ocApp()->gui()->raiseDialog(folderWizard);

break;
}
default:
case OCC::Wizard::SyncMode::Invalid:
Q_UNREACHABLE();
}
}
Expand Down