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

Advanced account configuration for new wizard #9566

Merged
merged 3 commits into from
Apr 12, 2022
Merged

Conversation

fmoc
Copy link
Contributor

@fmoc fmoc commented Apr 5, 2022

Contributes to #9249.

This PR implements the remaining configuration options missing in the new wizard. It adds an hidden-by-default advanced options group box to the final wizard page.

I think we can just squash this PR entirely before merging it.

@fmoc fmoc requested a review from a team April 5, 2022 16:24
@TheOneRing
Copy link
Contributor

Please add this pr to the original changelog entry.

Please call toNativeSeperators on the path.
image

@fmoc
Copy link
Contributor Author

fmoc commented Apr 7, 2022

Also missing:

  • use a line edit instead of just a button for the local directory
  • theme option to hide advanced options completely
  • another confirmation dialog if VFS is an experimental feature

@TheOneRing
Copy link
Contributor

Please check that those are supported:

  • client/src/libsync/theme.h

    Lines 274 to 277 in 951432c

    /**
    * Skip the advanced page and create a sync with the default settings
    */
    virtual bool wizardSkipAdvancedPage() const;
  • client/src/libsync/theme.h

    Lines 407 to 411 in 951432c

    * @brief Whether to show the option to create folders using "virtual files".
    *
    * By default, this is the same as enableExperimentalFreatures()
    */
    virtual bool showVirtualFilesOption() const;
  • virtual bool forceVirtualFilesOption() const;
    Only active if non experimental

@fmoc
Copy link
Contributor Author

fmoc commented Apr 7, 2022

Can we rename those options easily, or should we rather keep the names and adjust the comments?

Copy link
Contributor

@dragotin dragotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few thoughts

@@ -1588,25 +1589,40 @@ Folder *FolderMan::addFolder(AccountStatePtr accountStatePtr, const QString &loc
folderDefinition.navigationPaneClsid = QUuid::createUuid();
#endif

auto f = addFolder(accountStatePtr, folderDefinition);
auto finalize = [this, accountStatePtr, syncMode, localFolder](const FolderDefinition &folderDefinition, const QStringList &blacklist = {}) {
auto f = addFolder(accountStatePtr, folderDefinition);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One char variable names, really?

@@ -1588,25 +1589,40 @@ Folder *FolderMan::addFolder(AccountStatePtr accountStatePtr, const QString &loc
folderDefinition.navigationPaneClsid = QUuid::createUuid();
#endif

auto f = addFolder(accountStatePtr, folderDefinition);
auto finalize = [this, accountStatePtr, syncMode, localFolder](const FolderDefinition &folderDefinition, const QStringList &blacklist = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know lambdas are cool.

But in this case (for example) it is just not needed imho. The reasons are:

  • The encapsulated code is just used once.
  • The code flow is cluttered because you just move code from the place where it is used to the beginning of the method. Why?

For me, this makes things just more confusing.

}

connect(_ui->chooseLocalDirectoryButton, &QPushButton::clicked, this, [=]() {
auto dialog = new QFileDialog(this, tr("Choose"), defaultSyncTargetDir);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that leaking? It is probably going to be removed with the parent class, but why not set Qt::WA_DeleteOnClose?

// ensure we are connected and fetch the capabilities
auto validator = new ConnectionValidator(account, account.data());
QObject::connect(validator, &ConnectionValidator::connectionResult, account.data(), [accountStatePtr](ConnectionValidator::Status status, const QStringList &errors) {

QObject::connect(validator, &ConnectionValidator::connectionResult, account.data(), [accountStatePtr, localFolder, syncMode](ConnectionValidator::Status status, const QStringList &errors) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my book this should be a proper slot method. Too big for a lambda: When you read the surrounding method, you loose context over this huge lambda.

// reenable sync, which is disabled while the wizard is shown
FolderMan::instance()->setSyncEnabled(true);
connect(_wizardController, &Wizard::SetupWizardController::finished, ocApp(),
[this](AccountPtr newAccount, const QString &localFolder, Wizard::SyncMode syncMode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. Separate slots are not forbidden ;-)

src/gui/newwizard/pages/accountconfiguredwizardpage.cpp Outdated Show resolved Hide resolved
src/gui/newwizard/pages/accountconfiguredwizardpage.h Outdated Show resolved Hide resolved
src/gui/newwizard/syncmode.h Outdated Show resolved Hide resolved
src/gui/folderman.cpp Show resolved Hide resolved
@TheOneRing
Copy link
Contributor

Is enabling vfs in this context meant to work already?
image

@fmoc
Copy link
Contributor Author

fmoc commented Apr 11, 2022

I quickly finished this and pushed the changes. I'll squash this PR soon.

@fmoc fmoc requested a review from TheOneRing April 11, 2022 12:55
@fmoc
Copy link
Contributor Author

fmoc commented Apr 11, 2022

Seems like I broke the automatic merge. Will rebase on master and squash the history.

@fmoc fmoc force-pushed the work/wizard-vfs branch 3 times, most recently from 8daba56 to d5f8d41 Compare April 11, 2022 19:07
@fmoc fmoc mentioned this pull request Apr 11, 2022
src/gui/newwizard/setupwizardcontroller.cpp Outdated Show resolved Hide resolved
src/gui/newwizard/syncmode.cpp Outdated Show resolved Hide resolved
// this may be overwritten by a branding option (see below)
_ui->useVfsRadioButton->setEnabled(vfsIsAvailable);

_ui->useVfsRadioButton->setText(tr("Use &virtual files instead of downloading content immediately"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong default on Windows.
image


namespace OCC {

AskExperimentalVirtualFilesFeatureMessageBox::AskExperimentalVirtualFilesFeatureMessageBox(QWidget *parent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't ask if vfs is non experimental.
image

@ownclouders
Copy link
Contributor

ownclouders commented Apr 12, 2022

Results for GUI-tests https://drone.owncloud.com/owncloud/client/11400/6/1
💥 The GUI tests failed.
GUI Logs: (https://cache.owncloud.com/public/owncloud/client/11400/guiReportUpload/index.html)
Server Logs: (https://cache.owncloud.com/public/owncloud/client/11400/guiReportUpload/serverlog.log)
Screenshots:

Fabian Müller added 3 commits April 12, 2022 14:15
The old confirmation dialog was located within the setup wizard, which
did not make a lot of sense. Therefore, the old code was restored, but
moved into a new dedicated class, which can be used from other places
easily, too.
@sonarcloud
Copy link

sonarcloud bot commented Apr 12, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@TheOneRing TheOneRing merged commit 6f21ab6 into master Apr 12, 2022
@delete-merged-branch delete-merged-branch bot deleted the work/wizard-vfs branch April 12, 2022 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants