Repository navigation
Improve "add space" wizard - #10079
Conversation
|
Results for GUI-tests https://drone.owncloud.com/owncloud/client/13007/6/1 💥 The GUI tests failed. DetailsScreenshots: |
6092644 to
9b81222
Compare
9b81222 to
8dcea2d
Compare
|
Please re-review. |
8dcea2d to
cee5c07
Compare
cee5c07 to
d4264cb
Compare
|
Kudos, SonarCloud Quality Gate passed! |
TheOneRing
left a comment
There was a problem hiding this comment.
Now that you removed the space model feel free to manually implement sorting, filtering and searhing.
| auto drive = new OCC::GraphApi::DrivesJob(accountPtr); | ||
|
|
||
| connect(drive, &OCC::GraphApi::DrivesJob::finishedSignal, [drive, accountPtr, this] { | ||
| QList<Spaces::Space> spaces; |
|
|
||
| namespace OCC::Spaces { | ||
|
|
||
| Space::Space(const QString &name, const QString &subtitle, const QUrl &webUrl, const QUrl &webDavUrl, const QUrl &imageUrl) |
There was a problem hiding this comment.
Any reason we need that constructor, can't we just own the Drive and operate on it?
There was a problem hiding this comment.
It gives us some flexibility with regards to (future) testing.
| _ui->setupUi(this); | ||
|
|
||
| static const QSize ImageSizeC(128, 128); | ||
| static const auto PlaceholderImageC = OCC::Utility::getCoreIcon(QStringLiteral("th-large")).pixmap(ImageSizeC); |
There was a problem hiding this comment.
Don't use a static if the value can be themed and it probably requires a dark and light theme
| QPixmap pixmap; | ||
| qDebug() << "loading pixmap from space image:" << pixmap.loadFromData(job->reply()->readAll()); | ||
| const auto scaledPixmap = pixmap.scaled(ImageSizeC, Qt::KeepAspectRatio); | ||
| _ui->imageLabel->setPixmap(scaledPixmap); |
| { | ||
| QUrl imageUrl = [special = drive.getSpecial()] { | ||
| const auto imageFolder = std::find_if(special.begin(), special.end(), [](const OpenAPI::OAIDriveItem &item) { | ||
| return item.getSpecialFolder().getName() == QStringLiteral("image"); |
There was a problem hiding this comment.
At the moment thiss lambda is the only value added by all those lines of code.
| _ui->imageLabel->setPixmap(PlaceholderImageC); | ||
|
|
||
| if (!space.imageUrl().isEmpty()) { | ||
| auto job = new OCC::SimpleNetworkJob(accountPtr, space.imageUrl(), {}, "GET", {}, {}, nullptr); |
There was a problem hiding this comment.
Shouldn't we move that code also to the space class, and also cache it in that class?
That's true, but I couldn't find a reasonable-effort way of rendering widgets with a delegate... Even when using rich text and falling back to some HTML links instead of buttons, some of the features provided by this PR would just not have worked without a custom delegate. |










Follow-up for #9575 and a few other PRs.
This PR rewrites a lot of spaces-related code, and should be reviewed carefully. The "open in browser" buttons are not working at the moment due to a server limitation (it does not send us URLs we could open in the browser as of yet). The placeholder is temporary, I hope in the future the server will just send us one.
Closes #10047.