mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 08:26:50 +00:00
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!
This commit is contained in:
@@ -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") \
|
||||
|
||||
@@ -109,6 +109,8 @@
|
||||
<file>time@2x.png</file>
|
||||
<file>timeline_marker.png</file>
|
||||
<file>timeline_marker@2x.png</file>
|
||||
<file>update.png</file>
|
||||
<file>update@2x.png</file>
|
||||
<file>upfolder.png</file>
|
||||
<file>upfolder@2x.png</file>
|
||||
<file>wand.png</file>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 814 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -51,6 +51,9 @@
|
||||
#include "ui_MainWindow.h"
|
||||
#include "version.h"
|
||||
|
||||
#undef RENDERDOC_OFFICIAL_BUILD
|
||||
#define RENDERDOC_OFFICIAL_BUILD 1
|
||||
|
||||
#define JSON_ID "rdocLayoutData"
|
||||
#define JSON_VER 1
|
||||
|
||||
@@ -183,23 +186,35 @@ MainWindow::MainWindow(ICaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::Mai
|
||||
|
||||
m_NetManager = new QNetworkAccessManager(this);
|
||||
|
||||
updateAction = new QAction(this);
|
||||
updateAction->setText(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<QAction *> 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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<string>QRenderDoc</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/logo.svg</normaloff>:/logo.svg</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
@@ -155,7 +155,6 @@
|
||||
<addaction name="menu_Reported_Bugs"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Check_for_Updates"/>
|
||||
<addaction name="action_Update_Available"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Source_on_GitHub"/>
|
||||
<addaction name="action_Build_Release_Downloads"/>
|
||||
@@ -254,11 +253,6 @@
|
||||
<string>T&imeline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLayout_1">
|
||||
<property name="text">
|
||||
<string>Layout 1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Save_Default_Layout">
|
||||
<property name="text">
|
||||
<string>&Default Layout</string>
|
||||
@@ -289,11 +283,6 @@
|
||||
<string>Layout &4</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLayout_t">
|
||||
<property name="text">
|
||||
<string>Layout &5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Save_Layout_5">
|
||||
<property name="text">
|
||||
<string>Layout &5</string>
|
||||
@@ -364,18 +353,6 @@
|
||||
<string>Send &Error Report</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Update_Available">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/hourglass.png</normaloff>:/hourglass.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No update available</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Source_on_GitHub">
|
||||
<property name="text">
|
||||
<string>Source on GitHub</string>
|
||||
@@ -465,8 +442,6 @@
|
||||
<header>3rdparty/toolwindowmanager/ToolWindowManager.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../Resources/resources.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1813,6 +1813,8 @@ IF %ERRORLEVEL% NEQ 0 (echo ====================================================
|
||||
<Image Include="Resources\time.png" />
|
||||
<Image Include="Resources\timeline_marker%402x.png" />
|
||||
<Image Include="Resources\timeline_marker.png" />
|
||||
<Image Include="Resources\update%402x.png" />
|
||||
<Image Include="Resources\update.png" />
|
||||
<Image Include="Resources\upfolder%402x.png" />
|
||||
<Image Include="Resources\upfolder.png" />
|
||||
<Image Include="Resources\wand%402x.png" />
|
||||
|
||||
@@ -1753,6 +1753,12 @@
|
||||
<Image Include="Resources\zoom%402x.png">
|
||||
<Filter>Resources\Files</Filter>
|
||||
</Image>
|
||||
<Image Include="Resources\update.png">
|
||||
<Filter>Resources\Files</Filter>
|
||||
</Image>
|
||||
<Image Include="Resources\update%402x.png">
|
||||
<Filter>Resources\Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="Resources\glsl.xml">
|
||||
|
||||
Reference in New Issue
Block a user