mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add dialog for suggesting remote replays for non-local captures
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "SuggestRemoteDialog.h"
|
||||
#include <QMenu>
|
||||
#include "ui_SuggestRemoteDialog.h"
|
||||
|
||||
SuggestRemoteDialog::SuggestRemoteDialog(const QString &driver, const QString &machineIdent,
|
||||
QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::SuggestRemoteDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_WarningStart = tr("This %1 capture was originally created on a\n '%2' machine.\n\n")
|
||||
.arg(driver)
|
||||
.arg(machineIdent.trimmed());
|
||||
|
||||
ui->warning->setText(m_WarningStart +
|
||||
tr("Currently you have no remote context selected or configured\n") +
|
||||
tr("to replay on. Would you like to load the capture locally or\n") +
|
||||
tr("back out to configure one in Tools > Manage Remote Servers?"));
|
||||
|
||||
m_Remotes = new QMenu(this);
|
||||
|
||||
ui->remote->setEnabled(false);
|
||||
ui->remote->setIcon(QIcon());
|
||||
ui->remote->setText("No Remote");
|
||||
|
||||
ui->remote->setMenu(m_Remotes);
|
||||
}
|
||||
|
||||
SuggestRemoteDialog::~SuggestRemoteDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SuggestRemoteDialog::remotesAdded()
|
||||
{
|
||||
if(m_Remotes->isEmpty())
|
||||
return;
|
||||
|
||||
// update text and buttons to reflect that remote hosts are configured
|
||||
ui->warning->setText(m_WarningStart +
|
||||
tr("Currently you have no remote context selected, would you like\n") +
|
||||
tr("to choose a remote context to replay on, or continue and load\n") +
|
||||
tr("the capture locally?"));
|
||||
|
||||
ui->remote->setEnabled(true);
|
||||
ui->remote->setIcon(QIcon(QPixmap(QString::fromUtf8(":/Resources/down_arrow.png"))));
|
||||
ui->remote->setText("Remote");
|
||||
}
|
||||
|
||||
bool SuggestRemoteDialog::alwaysReplayLocally()
|
||||
{
|
||||
return ui->alwaysLocal->isChecked();
|
||||
}
|
||||
|
||||
void SuggestRemoteDialog::on_alwaysLocal_toggled(bool checked)
|
||||
{
|
||||
ui->remote->setEnabled(!m_Remotes->isEmpty() && !checked);
|
||||
}
|
||||
|
||||
void SuggestRemoteDialog::on_remote_clicked()
|
||||
{
|
||||
}
|
||||
|
||||
void SuggestRemoteDialog::on_local_clicked()
|
||||
{
|
||||
m_Choice = Local;
|
||||
accept();
|
||||
}
|
||||
|
||||
void SuggestRemoteDialog::on_cancel_clicked()
|
||||
{
|
||||
m_Choice = Cancel;
|
||||
accept();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SuggestRemoteDialog;
|
||||
}
|
||||
|
||||
class QMenu;
|
||||
|
||||
class SuggestRemoteDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SuggestRemoteDialog(const QString &driver, const QString &machineIdent,
|
||||
QWidget *parent = 0);
|
||||
~SuggestRemoteDialog();
|
||||
|
||||
enum SuggestRemoteResult
|
||||
{
|
||||
Cancel,
|
||||
Local,
|
||||
Remote
|
||||
};
|
||||
|
||||
QMenu *remotesMenu() { return m_Remotes; }
|
||||
void remotesAdded();
|
||||
|
||||
bool alwaysReplayLocally();
|
||||
SuggestRemoteResult choice() { return m_Choice; }
|
||||
private slots:
|
||||
// automatic slots
|
||||
void on_alwaysLocal_toggled(bool checked);
|
||||
void on_remote_clicked();
|
||||
void on_local_clicked();
|
||||
void on_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::SuggestRemoteDialog *ui;
|
||||
QMenu *m_Remotes;
|
||||
|
||||
QString m_WarningStart;
|
||||
SuggestRemoteResult m_Choice = Cancel;
|
||||
};
|
||||
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SuggestRemoteDialog</class>
|
||||
<widget class="QDialog" name="SuggestRemoteDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>389</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="topFrame">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #fff;</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="warning">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Warning</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="bottomFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="alwaysLocal">
|
||||
<property name="text">
|
||||
<string>Don't prompt again,
|
||||
always replay locally.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>127</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remote">
|
||||
<property name="text">
|
||||
<string>Remote</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../resources.qrc">
|
||||
<normaloff>:/Resources/down_arrow.png</normaloff>:/Resources/down_arrow.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="local">
|
||||
<property name="text">
|
||||
<string>Local</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -137,7 +137,8 @@ SOURCES += Code/qrenderdoc.cpp \
|
||||
Windows/StatisticsViewer.cpp \
|
||||
Windows/Dialogs/SettingsDialog.cpp \
|
||||
Windows/Dialogs/OrderedListEditor.cpp \
|
||||
Widgets/Extended/RDTableWidget.cpp
|
||||
Widgets/Extended/RDTableWidget.cpp \
|
||||
Windows/Dialogs/SuggestRemoteDialog.cpp
|
||||
|
||||
HEADERS += Code/CaptureContext.h \
|
||||
Code/qprocessinfo.h \
|
||||
@@ -179,7 +180,8 @@ HEADERS += Code/CaptureContext.h \
|
||||
Windows/StatisticsViewer.h \
|
||||
Windows/Dialogs/SettingsDialog.h \
|
||||
Windows/Dialogs/OrderedListEditor.h \
|
||||
Widgets/Extended/RDTableWidget.h
|
||||
Widgets/Extended/RDTableWidget.h \
|
||||
Windows/Dialogs/SuggestRemoteDialog.h
|
||||
|
||||
FORMS += Windows/Dialogs/AboutDialog.ui \
|
||||
Windows/MainWindow.ui \
|
||||
@@ -203,7 +205,8 @@ FORMS += Windows/Dialogs/AboutDialog.ui \
|
||||
Windows/DebugMessageView.ui \
|
||||
Windows/StatisticsViewer.ui \
|
||||
Windows/Dialogs/SettingsDialog.ui \
|
||||
Windows/Dialogs/OrderedListEditor.ui
|
||||
Windows/Dialogs/OrderedListEditor.ui \
|
||||
Windows/Dialogs/SuggestRemoteDialog.ui
|
||||
|
||||
RESOURCES += resources.qrc
|
||||
|
||||
|
||||
@@ -525,6 +525,7 @@
|
||||
<ClCompile Include="generated\moc_SettingsDialog.cpp" />
|
||||
<ClCompile Include="generated\moc_ShaderViewer.cpp" />
|
||||
<ClCompile Include="generated\moc_StatisticsViewer.cpp" />
|
||||
<ClCompile Include="generated\moc_SuggestRemoteDialog.cpp" />
|
||||
<ClCompile Include="generated\moc_TextureGoto.cpp" />
|
||||
<ClCompile Include="generated\moc_TextureSaveDialog.cpp" />
|
||||
<ClCompile Include="generated\moc_TextureViewer.cpp" />
|
||||
@@ -557,6 +558,7 @@
|
||||
<ClCompile Include="Windows\Dialogs\LiveCapture.cpp" />
|
||||
<ClCompile Include="Windows\Dialogs\OrderedListEditor.cpp" />
|
||||
<ClCompile Include="Windows\Dialogs\SettingsDialog.cpp" />
|
||||
<ClCompile Include="Windows\Dialogs\SuggestRemoteDialog.cpp" />
|
||||
<ClCompile Include="Windows\Dialogs\TextureSaveDialog.cpp" />
|
||||
<ClCompile Include="Windows\EventBrowser.cpp" />
|
||||
<ClCompile Include="3rdparty\flowlayout\FlowLayout.cpp">
|
||||
@@ -673,6 +675,7 @@
|
||||
<ClInclude Include="generated\ui_SettingsDialog.h" />
|
||||
<ClInclude Include="generated\ui_ShaderViewer.h" />
|
||||
<ClInclude Include="generated\ui_StatisticsViewer.h" />
|
||||
<ClInclude Include="generated\ui_SuggestRemoteDialog.h" />
|
||||
<ClInclude Include="generated\ui_TextureSaveDialog.h" />
|
||||
<ClInclude Include="generated\ui_TextureViewer.h" />
|
||||
<ClInclude Include="generated\ui_ThumbnailStrip.h" />
|
||||
@@ -701,6 +704,7 @@
|
||||
<ClInclude Include="Windows\Dialogs\LiveCapture.h" />
|
||||
<ClInclude Include="Windows\Dialogs\OrderedListEditor.h" />
|
||||
<ClInclude Include="Windows\Dialogs\SettingsDialog.h" />
|
||||
<ClInclude Include="Windows\Dialogs\SuggestRemoteDialog.h" />
|
||||
<ClInclude Include="Windows\Dialogs\TextureSaveDialog.h" />
|
||||
<ClInclude Include="Windows\EventBrowser.h" />
|
||||
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h" />
|
||||
@@ -732,6 +736,7 @@
|
||||
<None Include="Windows\Dialogs\LiveCapture.ui" />
|
||||
<None Include="Windows\Dialogs\OrderedListEditor.ui" />
|
||||
<None Include="Windows\Dialogs\SettingsDialog.ui" />
|
||||
<None Include="Windows\Dialogs\SuggestRemoteDialog.ui" />
|
||||
<None Include="Windows\Dialogs\TextureSaveDialog.ui" />
|
||||
<None Include="Windows\EventBrowser.ui" />
|
||||
<None Include="Windows\MainWindow.ui" />
|
||||
|
||||
@@ -499,6 +499,12 @@
|
||||
<ClCompile Include="Code\RemoteHost.cpp">
|
||||
<Filter>Code</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Windows\Dialogs\SuggestRemoteDialog.cpp">
|
||||
<Filter>Windows\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="generated\moc_SuggestRemoteDialog.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h">
|
||||
@@ -888,6 +894,12 @@
|
||||
<ClInclude Include="Code\RemoteHost.h">
|
||||
<Filter>Code</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Windows\Dialogs\SuggestRemoteDialog.h">
|
||||
<Filter>Windows\Dialogs</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="generated\ui_SuggestRemoteDialog.h">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="resources.qrc">
|
||||
@@ -1132,6 +1144,9 @@
|
||||
<None Include="Windows\Dialogs\OrderedListEditor.ui">
|
||||
<Filter>Windows\Dialogs</Filter>
|
||||
</None>
|
||||
<None Include="Windows\Dialogs\SuggestRemoteDialog.ui">
|
||||
<Filter>Windows\Dialogs</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="generated\ui_AboutDialog.h">
|
||||
|
||||
Reference in New Issue
Block a user