From 9c7e46c6fce36c1f76a5166694e18d7c924b7e51 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 22 Dec 2017 14:40:12 +0000 Subject: [PATCH] Tweak update menus and alerts * We split the "update available" off to a top-level menu item, instead of a sub-item under Help. This gives explicit text saying an update is available. * Change the icon from an hourglass to a slightly more 'updatey' image. * We now re-cehck every week even if an update is marked available. That way people who delay for longer than it takes to release a new version will get the latest when they do update. It also gives them a reminder every week so that hopefully those delayers will be less common! --- qrenderdoc/Code/Resources.h | 1 + qrenderdoc/Resources/resources.qrc | 2 + qrenderdoc/Resources/update.png | Bin 0 -> 814 bytes qrenderdoc/Resources/update@2x.png | Bin 0 -> 2096 bytes qrenderdoc/Windows/MainWindow.cpp | 82 ++++++++++++-------- qrenderdoc/Windows/MainWindow.h | 4 +- qrenderdoc/Windows/MainWindow.ui | 29 +------ qrenderdoc/qrenderdoc_local.vcxproj | 2 + qrenderdoc/qrenderdoc_local.vcxproj.filters | 6 ++ 9 files changed, 67 insertions(+), 59 deletions(-) create mode 100644 qrenderdoc/Resources/update.png create mode 100644 qrenderdoc/Resources/update@2x.png diff --git a/qrenderdoc/Code/Resources.h b/qrenderdoc/Code/Resources.h index 7f43df255..ebf18cd13 100644 --- a/qrenderdoc/Code/Resources.h +++ b/qrenderdoc/Code/Resources.h @@ -76,6 +76,7 @@ RESOURCE_DEF(time, "time.png") \ RESOURCE_DEF(timeline_marker, "timeline_marker.png") \ RESOURCE_DEF(upfolder, "upfolder.png") \ + RESOURCE_DEF(update, "update.png") \ RESOURCE_DEF(wand, "wand.png") \ RESOURCE_DEF(wireframe_mesh, "wireframe_mesh.png") \ RESOURCE_DEF(wrench, "wrench.png") \ diff --git a/qrenderdoc/Resources/resources.qrc b/qrenderdoc/Resources/resources.qrc index 222300347..9abe31949 100644 --- a/qrenderdoc/Resources/resources.qrc +++ b/qrenderdoc/Resources/resources.qrc @@ -109,6 +109,8 @@ time@2x.png timeline_marker.png timeline_marker@2x.png + update.png + update@2x.png upfolder.png upfolder@2x.png wand.png diff --git a/qrenderdoc/Resources/update.png b/qrenderdoc/Resources/update.png new file mode 100644 index 0000000000000000000000000000000000000000..b7639f15582efa20b1019a4973f60b72b4399ba6 GIT binary patch literal 814 zcmV+}1JV46P)l0X9KYi)B`pkZS64i$=K zYreF6+52|y?!BFRbv8ph++ndIkJn&wHiVa-16YWpdi&cPCuJKWPu{Ec z+KSSG@P%VlXrYcRC-x#OimNw}fe(lL_??t+#$E|aiJ{5X>AAZKpyOR&A!_t}4Wi3E zhPOW!0qLIvh7v-d7+y~-qI-B64g1Ss(5lbZyF5D-0Hw9pR+x~23OX$dbD>^2lo{Wj z-EU0JO!hF*2%?;Tfr$|6s>&dw#hc4F5XCEbMm^@DJXkJ?9^c0?CM&R0gHPQ9w@$al zgZ>`EarhbLq1EYV1WD5}fDmnnBgkPj^y(r;?lqsH=TljUkk|hAkFPmJE`=Pe24R5# zp*j_S{I8{?fV^A{_(T%nz}SaZuBJoTsdRMpsbWF@R4N`v9tAAXfRaoQ<;9;QP@Jzt zSxG+4yGO;vLZjILn(nZz!<}Q^QlR)ncmi4FiUfHfBEkV%3yly2@dno90iZRa+g4-< zSxYxzJ^}DNPodxx03TcOCSx%WMh$DZ2?d7SOSbFo+jf`NngP&4L!)gEYc`vp(WsG# zMiHO?^+*8(MxJ-hPtSs7Rq#iFqjlA&t~58(L*rQ*@F^(39|KJ`5S*FC(4DjG3SivV zJ)Bsa>z(}a4Y9O@K!U;UT~=B5nqmU0MT*hDT%?D^v^h+-r%6^bZLe#6@<3l$Twi9{ zi7lpLyy+jri?+jx(eCm{vJ6RX7V6J1j0{ba|GLpqapc@VQ;q#1n`<~A@Ao+!8RNcn s8dW0ev@9aiWq^euq+Tl5+Edw?bwceeeHYgyK_F@Yi#30thIFFT>JaZ`F+3hJLi1n;Oo82 z>wEg+YBB{W4M0mJ{|!my?U--uujdcF9KIh1+}8x)e5$)I@T;BQ00JQ=k}y6!3&VFp zaAnkcSqV>fo_*~{Be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7(8n+~C>4)D`5g-?2&4)+o_rKY`E;i=sz#U(0NVJ~>kzs<{O;|49luO5v+n~` zT7k2FcwzsoYr}p;PT;jlWP&j|m`O-mFs@;a6&RS1(-%cUm>T4Cy?i4OtqpGAEOwjT z*wkzQnvQ7lRCnjrp^KM%34QS7h*D39(Ndwn)od=Ka;&VWh7B9qw?DDx$XiBiK5IW| zVFqpNxA%EQwwG>F^G$X-Vi8(7T18QLO;z*epKU9tZC-D(mOQ{(ES}__2X}aq3E8jz zQnKFX?@djgs1kP{KVD5b5TdLUtxONb>zcWtzkj9I|MTlu(3_4`rsetText(tr("Update Available!")); + updateAction->setIcon(Icons::update()); + + QObject::connect(updateAction, &QAction::triggered, this, &MainWindow::updateAvailable_triggered); + #if !defined(Q_OS_WIN32) // update checks only happen on windows { QList actions = ui->menu_Help->actions(); - int idx = actions.indexOf(ui->action_Update_Available); + int idx = actions.indexOf(ui->action_Check_for_Updates); idx++; if(idx < actions.count() && actions[idx]->isSeparator()) delete actions[idx]; - delete ui->action_Update_Available; - ui->action_Update_Available = NULL; - delete ui->action_Check_for_Updates; ui->action_Check_for_Updates = NULL; + + delete updateAction; + updateAction = NULL; } #endif + if(updateAction) + { + ui->menuBar->addAction(updateAction); + updateAction->setVisible(false); + } + PopulateRecentCaptureFiles(); PopulateRecentCaptureSettings(); PopulateReportedBugs(); @@ -1027,7 +1042,7 @@ void MainWindow::PopulateReportedBugs() void MainWindow::CheckUpdates(bool forceCheck, UpdateResultMethod callback) { - if(!ui->action_Update_Available) + if(!updateAction) return; bool mismatch = HandleMismatchedVersions(); @@ -1036,33 +1051,46 @@ void MainWindow::CheckUpdates(bool forceCheck, UpdateResultMethod callback) if(!forceCheck && !m_Ctx.Config().CheckUpdate_AllowChecks) { - ui->action_Update_Available->setText(tr("Update checks disabled")); - ui->action_Update_Available->setEnabled(false); + updateAction->setVisible(false); if(callback) callback(UpdateResult::Disabled); return; } #if RENDERDOC_OFFICIAL_BUILD + QDateTime today = QDateTime::currentDateTime(); + + // check by default every 2 days + QDateTime compare = today.addDays(-2); + + // if there's already an update available, go down to checking every week. + if(m_Ctx.Config().CheckUpdate_UpdateAvailable) + compare = today.addDays(-7); + + bool checkDue = compare.secsTo(m_Ctx.Config().CheckUpdate_LastUpdate) < 0; + if(m_Ctx.Config().CheckUpdate_UpdateAvailable) { - if(m_Ctx.Config().CheckUpdate_UpdateResponse.isEmpty()) + // Mark an update available + SetUpdateAvailable(); + + // If we don't have a proper update response, or we're overdue for a check, then do it again. + // The reason for this is twofold: first, if someone has been delaying their updates for a long + // time then there might be a newer update available that we should refresh to, so we should + // find out and refresh the update status. The other reason is that when we get a positive + // response from the server we force-display the popup which means the user will get reminded + // every week or so that an update is pending. + if(m_Ctx.Config().CheckUpdate_UpdateResponse.isEmpty() || checkDue) { forceCheck = true; } - else if(!forceCheck) - { - SetUpdateAvailable(); + + // If we're not forcing a recheck, we're done. + if(!forceCheck) return; - } } - QDateTime today = QDateTime::currentDateTime(); - QDateTime compare = today.addDays(-2); - - qint64 diff = compare.secsTo(m_Ctx.Config().CheckUpdate_LastUpdate); - - if(!forceCheck && diff > 0) + if(!forceCheck && checkDue) { if(callback) callback(UpdateResult::Toosoon); @@ -1132,22 +1160,14 @@ void MainWindow::CheckUpdates(bool forceCheck, UpdateResultMethod callback) void MainWindow::SetUpdateAvailable() { - if(!ui->action_Update_Available) - return; - - ui->menu_Help->setIcon(Icons::hourglass()); - ui->action_Update_Available->setEnabled(true); - ui->action_Update_Available->setText(tr("An update is available")); + if(updateAction) + updateAction->setVisible(true); } void MainWindow::SetNoUpdate() { - if(!ui->action_Update_Available) - return; - - ui->menu_Help->setIcon(QIcon()); - ui->action_Update_Available->setEnabled(false); - ui->action_Update_Available->setText(tr("No update available")); + if(updateAction) + updateAction->setVisible(false); } void MainWindow::UpdatePopup() @@ -2215,7 +2235,7 @@ void MainWindow::on_action_Check_for_Updates_triggered() }); } -void MainWindow::on_action_Update_Available_triggered() +void MainWindow::updateAvailable_triggered() { bool mismatch = HandleMismatchedVersions(); if(mismatch) diff --git a/qrenderdoc/Windows/MainWindow.h b/qrenderdoc/Windows/MainWindow.h index a25d34b7f..5c4048e67 100644 --- a/qrenderdoc/Windows/MainWindow.h +++ b/qrenderdoc/Windows/MainWindow.h @@ -139,11 +139,11 @@ private slots: void on_action_Resource_Inspector_triggered(); void on_action_Send_Error_Report_triggered(); void on_action_Check_for_Updates_triggered(); - void on_action_Update_Available_triggered(); // manual slots void saveLayout_triggered(); void loadLayout_triggered(); + void updateAvailable_triggered(); void messageCheck(); void remoteProbe(); void statusDoubleClicked(QMouseEvent *event); @@ -189,6 +189,8 @@ private: QMenu *contextChooserMenu; QToolButton *contextChooser; + QAction *updateAction = NULL; + QTimer m_MessageTick; QSemaphore m_RemoteProbeSemaphore; LambdaThread *m_RemoteProbe; diff --git a/qrenderdoc/Windows/MainWindow.ui b/qrenderdoc/Windows/MainWindow.ui index ada8d5a89..702fc350f 100644 --- a/qrenderdoc/Windows/MainWindow.ui +++ b/qrenderdoc/Windows/MainWindow.ui @@ -14,7 +14,7 @@ QRenderDoc - + :/logo.svg:/logo.svg @@ -155,7 +155,6 @@ - @@ -254,11 +253,6 @@ T&imeline - - - Layout 1 - - &Default Layout @@ -289,11 +283,6 @@ Layout &4 - - - Layout &5 - - Layout &5 @@ -364,18 +353,6 @@ Send &Error Report - - - false - - - - :/hourglass.png:/hourglass.png - - - No update available - - Source on GitHub @@ -465,8 +442,6 @@
3rdparty/toolwindowmanager/ToolWindowManager.h
- - - + diff --git a/qrenderdoc/qrenderdoc_local.vcxproj b/qrenderdoc/qrenderdoc_local.vcxproj index 7eb64bd6e..d5d3ab6e0 100644 --- a/qrenderdoc/qrenderdoc_local.vcxproj +++ b/qrenderdoc/qrenderdoc_local.vcxproj @@ -1813,6 +1813,8 @@ IF %ERRORLEVEL% NEQ 0 (echo ==================================================== + + diff --git a/qrenderdoc/qrenderdoc_local.vcxproj.filters b/qrenderdoc/qrenderdoc_local.vcxproj.filters index eadccba05..6c414817e 100644 --- a/qrenderdoc/qrenderdoc_local.vcxproj.filters +++ b/qrenderdoc/qrenderdoc_local.vcxproj.filters @@ -1753,6 +1753,12 @@ Resources\Files + + Resources\Files + + + Resources\Files +