Add dialog for both managing remote hosts (add/remove) and attaching

This commit is contained in:
baldurk
2017-02-09 15:42:54 +00:00
parent 47be248cad
commit e1d180246c
13 changed files with 1052 additions and 14 deletions
+24
View File
@@ -32,6 +32,7 @@
#include <QLabel>
#include <QMenu>
#include <QMetaMethod>
#include <QProcess>
#include <QProgressDialog>
#include <QTreeWidget>
#include <QtMath>
@@ -557,6 +558,16 @@ QTreeWidgetItem *makeTreeNode(const QVariantList &values)
return ret;
}
void deleteChildren(QTreeWidgetItem *item)
{
while(item->childCount() > 0)
{
QTreeWidgetItem *child = item->takeChild(0);
deleteChildren(child);
delete child;
}
}
int Formatter::m_minFigures = 2, Formatter::m_maxFigures = 5, Formatter::m_expNegCutoff = 5,
Formatter::m_expPosCutoff = 7;
double Formatter::m_expNegValue = 0.00001; // 10^(-5)
@@ -699,3 +710,16 @@ void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinis
tickerSemaphore.tryAcquire();
progressTickerThread.wait();
}
QString GetSystemUsername()
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString username = env.value("USER");
if(username == QString())
username = env.value("USERNAME");
if(username == QString())
username = "Unknown_User";
return username;
}
+11
View File
@@ -27,6 +27,7 @@
#include <QDebug>
#include <QFileDialog>
#include <QMessageBox>
#include <QProcess>
#include <QSemaphore>
#include <QSortFilterProxyModel>
#include "renderdoc_replay.h"
@@ -564,6 +565,13 @@ public:
bool isCurrentThread() { return QThread::currentThread() == m_Thread; }
};
class RDProcess : public QProcess
{
public:
RDProcess(QObject *parent = NULL) : QProcess(parent) {}
void detach() { setProcessState(QProcess::NotRunning); }
};
class QFileFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
@@ -671,6 +679,7 @@ class QTreeWidgetItem;
QTreeWidgetItem *makeTreeNode(const std::initializer_list<QVariant> &values);
QTreeWidgetItem *makeTreeNode(const QVariantList &values);
void deleteChildren(QTreeWidgetItem *item);
class QProgressDialog;
@@ -679,3 +688,5 @@ typedef std::function<bool()> ProgressFinishedMethod;
void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinishedMethod finished,
ProgressUpdateMethod update = ProgressUpdateMethod());
QString GetSystemUsername();
+3 -1
View File
@@ -25,6 +25,7 @@
#include "RemoteHost.h"
#include <QProcess>
#include <QThread>
#include "Code/QRDUtils.h"
#include "renderdoc_replay.h"
RemoteHost::RemoteHost()
@@ -102,7 +103,8 @@ void RemoteHost::CheckStatus()
void RemoteHost::Launch()
{
QProcess process;
RDProcess process;
process.start(RunCommand);
process.waitForFinished(2000);
process.detach();
}
+2 -1
View File
@@ -120,7 +120,8 @@ void RDTreeWidget::leaveEvent(QEvent *e)
void RDTreeWidget::focusOutEvent(QFocusEvent *event)
{
clearSelection();
if(m_clearSelectionOnFocusLoss)
clearSelection();
QTreeWidget::focusOutEvent(event);
}
+1 -9
View File
@@ -916,16 +916,8 @@ void LiveCapture::connectionClosed()
void LiveCapture::connectionThreadEntry()
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString username = env.value("USER");
if(username == QString())
username = env.value("USERNAME");
if(username == QString())
username = "Unknown_User";
m_Connection = RENDERDOC_CreateTargetControl(m_Hostname.toUtf8().data(), m_RemoteIdent,
username.toUtf8().data(), true);
GetSystemUsername().toUtf8().data(), true);
if(m_Connection == NULL || !m_Connection->Connected())
{
@@ -0,0 +1,676 @@
/******************************************************************************
* 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 "RemoteManager.h"
#include <QKeyEvent>
#include "3rdparty/flowlayout/FlowLayout.h"
#include "Code/RemoteHost.h"
#include "Windows/Dialogs/LiveCapture.h"
#include "Windows/MainWindow.h"
#include "ui_RemoteManager.h"
struct RemoteConnect
{
RemoteConnect() {}
RemoteConnect(const QString &h, uint32_t i) : host(h), ident(i) {}
QString host;
uint32_t ident = 0;
};
Q_DECLARE_METATYPE(RemoteConnect);
static void setRemoteConnect(QTreeWidgetItem *item, const RemoteConnect &connect)
{
if(!item)
return;
item->setData(0, Qt::UserRole, QVariant::fromValue(connect));
}
static RemoteConnect getRemoteConnect(QTreeWidgetItem *item)
{
if(!item)
return RemoteConnect();
return item->data(0, Qt::UserRole).value<RemoteConnect>();
}
static void setRemoteHost(QTreeWidgetItem *item, RemoteHost *host)
{
if(!item)
return;
item->setData(0, Qt::UserRole + 1, QVariant::fromValue((uintptr_t)host));
}
static RemoteHost *getRemoteHost(QTreeWidgetItem *item)
{
if(!item)
return NULL;
return (RemoteHost *)item->data(0, Qt::UserRole + 1).value<uintptr_t>();
}
static void setItalic(QTreeWidgetItem *node, bool italic)
{
QFont f = node->font(0);
f.setItalic(italic);
node->setFont(0, f);
node->setFont(1, f);
}
RemoteManager::RemoteManager(CaptureContext *ctx, MainWindow *main)
: QDialog(NULL), ui(new Ui::RemoteManager), m_Ctx(ctx), m_Main(main)
{
ui->setupUi(this);
ui->hosts->setClearSelectionOnFocusLoss(false);
ui->hosts->header()->setSectionResizeMode(0, QHeaderView::Stretch);
ui->hosts->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
lookupsProgressFlow = new QWidget(this);
FlowLayout *flow = new FlowLayout(lookupsProgressFlow, 0, 3, 3);
lookupsProgressFlow->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
flow->addWidget(ui->progressIcon);
flow->addWidget(ui->progressText);
flow->addWidget(ui->progressCount);
QVBoxLayout *vertical = new QVBoxLayout(this);
vertical->addWidget(ui->hosts);
vertical->addWidget(lookupsProgressFlow);
vertical->addWidget(ui->bottomLayout->parentWidget());
m_Ctx->Config.AddAndroidHosts();
for(RemoteHost *h : m_Ctx->Config.RemoteHosts)
addHost(h);
on_hosts_itemClicked(ui->hosts->topLevelItem(0), 0);
}
RemoteManager::~RemoteManager()
{
delete ui;
}
void RemoteManager::setRemoteServerLive(QTreeWidgetItem *node, bool live, bool busy)
{
RemoteHost *host = getRemoteHost(node);
if(!host)
return;
host->ServerRunning = live;
host->Busy = busy;
if(host->Hostname == "localhost")
{
node->setIcon(0, QIcon());
node->setText(1, "");
}
else
{
QString text = live ? tr("Remote server running") : tr("No remote server");
if(host->Connected)
text += tr(" (Active Context)");
else if(host->VersionMismatch)
text += tr(" (Version Mismatch)");
else if(host->Busy)
text += tr(" (Busy)");
node->setText(1, text);
node->setIcon(0,
QIcon(QPixmap(QString::fromUtf8(live ? ":/connect.png" : ":/disconnect.png"))));
}
}
bool RemoteManager::isRemoteServerLive(QTreeWidgetItem *node)
{
RemoteHost *host = getRemoteHost(node);
return host && host->ServerRunning;
}
void RemoteManager::addHost(RemoteHost *host)
{
QTreeWidgetItem *node = makeTreeNode({host->Hostname, "..."});
setItalic(node, true);
node->setIcon(0, QIcon(QPixmap(QString::fromUtf8(":/hourglass.png"))));
setRemoteHost(node, host);
ui->hosts->addTopLevelItem(node);
ui->hosts->clearSelection();
node->setSelected(true);
ui->refreshOne->setEnabled(false);
ui->refreshAll->setEnabled(false);
m_Lookups.release();
refreshHost(node);
updateLookupsStatus();
}
void RemoteManager::updateLookupsStatus()
{
lookupsProgressFlow->setVisible(!ui->refreshAll->isEnabled());
ui->progressCount->setText(tr("%1 lookups remaining").arg(m_Lookups.available()));
}
void RemoteManager::runRemoteServer(QTreeWidgetItem *node)
{
RemoteHost *host = getRemoteHost(node);
if(!host)
return;
host->Launch();
// now refresh this host
refreshHost(node);
}
void RemoteManager::refreshHost(QTreeWidgetItem *node)
{
RemoteHost *host = getRemoteHost(node);
if(!host)
return;
// this function looks up the remote connections and for each one open
// queries it for the API, target (usually executable name) and if any user is already connected
LambdaThread *th = new LambdaThread([this, node, host]() {
QString hostname = node->text(0);
QByteArray username = GetSystemUsername().toUtf8();
host->CheckStatus();
GUIInvoke::call(
[this, node, host]() { setRemoteServerLive(node, host->ServerRunning, host->Busy); });
QByteArray hostnameBytes = hostname.toUtf8();
uint32_t nextIdent = 0;
for(;;)
{
// just a sanity check to make sure we don't hit some unexpected case and infinite loop
uint32_t prevIdent = nextIdent;
nextIdent = RENDERDOC_EnumerateRemoteTargets(hostnameBytes.data(), nextIdent);
if(nextIdent == ~0U || prevIdent >= nextIdent)
break;
TargetControl *conn =
RENDERDOC_CreateTargetControl(hostnameBytes.data(), nextIdent, username.data(), false);
if(conn)
{
QString target = QString::fromUtf8(conn->GetTarget());
QString api = QString::fromUtf8(conn->GetAPI());
QString busy = QString::fromUtf8(conn->GetBusyClient());
QString running;
if(busy != "")
running = tr("Running %1, %2 is connected").arg(api).arg(busy);
else
running = tr("Running %1").arg(api);
RemoteConnect tag(hostname, nextIdent);
GUIInvoke::call([this, node, target, running, tag]() {
QTreeWidgetItem *child = makeTreeNode({target, running});
setRemoteConnect(child, tag);
node->addChild(child);
ui->hosts->expandItem(node);
});
conn->Shutdown();
}
}
GUIInvoke::call([node]() { setItalic(node, false); });
m_Lookups.acquire();
GUIInvoke::call([this]() { lookupComplete(); });
});
th->selfDelete(true);
th->start();
}
// don't allow the user to refresh until all pending connections have been checked
// (to stop flooding)
void RemoteManager::lookupComplete()
{
if(m_Lookups.available() == 0)
{
ui->refreshOne->setEnabled(true);
ui->refreshAll->setEnabled(true);
if(!isVisible())
{
delete this;
return;
}
}
updateConnectButton();
updateLookupsStatus();
}
void RemoteManager::connectToApp(QTreeWidgetItem *node)
{
if(node)
{
RemoteConnect connect = getRemoteConnect(node);
if(connect.ident > 0)
{
LiveCapture *live = new LiveCapture(m_Ctx, connect.host, connect.ident, m_Main, m_Main);
m_Main->ShowLiveCapture(live);
accept();
lookupComplete();
}
}
}
void RemoteManager::updateConnectButton()
{
if(!ui->hosts->selectedItems().isEmpty())
{
QTreeWidgetItem *item = ui->hosts->selectedItems()[0];
ui->connect->setEnabled(true);
ui->connect->setText(tr("Connect to App"));
RemoteHost *host = getRemoteHost(item);
if(host)
{
if(host->Hostname == "localhost")
{
ui->connect->setEnabled(false);
}
else if(host->ServerRunning)
{
ui->connect->setText(tr("Shutdown"));
if(host->Busy && !host->Connected)
ui->connect->setEnabled(false);
}
else
{
ui->connect->setText(tr("Run Server"));
if(host->RunCommand == "")
ui->connect->setEnabled(false);
}
}
}
else
{
ui->connect->setEnabled(false);
}
}
void RemoteManager::addNewHost()
{
QString host = ui->hostname->text().trimmed();
if(!host.isEmpty())
{
bool found = false;
for(int i = 0; i < m_Ctx->Config.RemoteHosts.count(); i++)
{
if(m_Ctx->Config.RemoteHosts[i]->Hostname.compare(host, Qt::CaseInsensitive) == 0)
{
found = true;
break;
}
}
if(!found)
{
RemoteHost *h = new RemoteHost();
h->Hostname = host;
h->RunCommand = ui->runCommand->text().trimmed();
m_Ctx->Config.RemoteHosts.push_back(h);
m_Ctx->Config.Save();
addHost(h);
}
}
ui->hostname->setText(host);
on_hostname_textEdited(host);
}
void RemoteManager::setRunCommand()
{
if(ui->hosts->selectedItems().isEmpty())
return;
RemoteHost *h = getRemoteHost(ui->hosts->selectedItems()[0]);
if(h)
{
h->RunCommand = ui->runCommand->text().trimmed();
m_Ctx->Config.Save();
}
}
void RemoteManager::on_hosts_itemActivated(QTreeWidgetItem *item, int column)
{
RemoteConnect connect = getRemoteConnect(item);
if(connect.ident > 0)
connectToApp(item);
}
void RemoteManager::on_hosts_itemClicked(QTreeWidgetItem *item, int column)
{
ui->addUpdateHost->setText(tr("Add"));
ui->addUpdateHost->setEnabled(true);
ui->deleteHost->setEnabled(false);
ui->refreshOne->setEnabled(false);
ui->hostname->setEnabled(true);
ui->addUpdateHost->setEnabled(true);
ui->runCommand->setEnabled(true);
ui->runCommand->setText("");
ui->hostname->setText("");
RemoteHost *host = getRemoteHost(item);
if(host)
{
if(ui->refreshAll->isEnabled())
ui->refreshOne->setEnabled(true);
if(host->Hostname == "localhost")
{
ui->runCommand->setText("");
ui->hostname->setText("");
}
else
{
ui->deleteHost->setEnabled(true);
ui->runCommand->setText(host->RunCommand);
ui->hostname->setText(host->Hostname);
ui->addUpdateHost->setText(tr("Update"));
}
}
updateConnectButton();
}
void RemoteManager::on_hostname_textEdited(const QString &text)
{
ui->addUpdateHost->setText(tr("Add"));
ui->addUpdateHost->setEnabled(true);
ui->deleteHost->setEnabled(false);
ui->refreshOne->setEnabled(false);
ui->hostname->setEnabled(true);
ui->addUpdateHost->setEnabled(true);
ui->runCommand->setEnabled(true);
QTreeWidgetItem *node = NULL;
for(int i = 0; i < ui->hosts->topLevelItemCount(); i++)
{
QTreeWidgetItem *n = ui->hosts->topLevelItem(i);
RemoteHost *host = getRemoteHost(n);
if(n->text(0) == text)
{
if(ui->refreshAll->isEnabled())
ui->refreshOne->setEnabled(true);
ui->addUpdateHost->setText(tr("Update"));
if(text == "localhost")
{
ui->hostname->setEnabled(false);
ui->addUpdateHost->setEnabled(false);
ui->runCommand->setEnabled(false);
}
else
{
ui->deleteHost->setEnabled(true);
ui->runCommand->setText(host->RunCommand);
}
node = n;
break;
}
}
ui->hosts->clearSelection();
if(node)
node->setSelected(true);
updateConnectButton();
}
void RemoteManager::on_hosts_keyPress(QKeyEvent *event)
{
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
{
if(ui->connect->isEnabled())
on_connect_clicked();
}
if(event->key() == Qt::Key_Delete)
on_deleteHost_clicked();
}
void RemoteManager::on_hostname_keyPress(QKeyEvent *event)
{
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
{
if(ui->addUpdateHost->isEnabled())
on_addUpdateHost_clicked();
}
}
void RemoteManager::on_runCommand_keyPress(QKeyEvent *event)
{
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
{
if(ui->addUpdateHost->isEnabled())
on_addUpdateHost_clicked();
}
}
void RemoteManager::on_addUpdateHost_clicked()
{
if(!ui->hosts->selectedItems().isEmpty() && getRemoteHost(ui->hosts->selectedItems()[0]))
setRunCommand();
else
addNewHost();
}
void RemoteManager::on_refreshAll_clicked()
{
if(m_Lookups.available())
return;
ui->refreshOne->setEnabled(false);
ui->refreshAll->setEnabled(false);
for(int i = 0; i < ui->hosts->topLevelItemCount(); i++)
{
QTreeWidgetItem *n = ui->hosts->topLevelItem(i);
deleteChildren(n);
setItalic(n, true);
n->setIcon(0, QIcon(QPixmap(QString::fromUtf8(":/hourglass.png"))));
refreshHost(n);
}
updateLookupsStatus();
}
void RemoteManager::on_refreshOne_clicked()
{
if(m_Lookups.available() || ui->hosts->selectedItems().isEmpty())
return;
ui->refreshOne->setEnabled(false);
ui->refreshAll->setEnabled(false);
QTreeWidgetItem *n = ui->hosts->selectedItems()[0];
{
deleteChildren(n);
setItalic(n, true);
n->setIcon(0, QIcon(QPixmap(QString::fromUtf8(":/hourglass.png"))));
refreshHost(n);
}
updateLookupsStatus();
}
void RemoteManager::on_connect_clicked()
{
if(ui->hosts->selectedItems().isEmpty())
return;
QTreeWidgetItem *node = ui->hosts->selectedItems()[0];
RemoteConnect connect = getRemoteConnect(node);
RemoteHost *host = getRemoteHost(node);
if(connect.ident > 0)
{
connectToApp(node);
}
else if(host)
{
if(host->ServerRunning)
{
QMessageBox::StandardButton res = RDDialog::question(
this, tr("Remote server shutdown"),
tr("Are you sure you wish to shut down running remote server on %1?").arg(host->Hostname),
RDDialog::YesNoCancel);
if(res == QMessageBox::Cancel || res == QMessageBox::No)
return;
// shut down
if(host->Connected)
{
m_Ctx->Renderer()->ShutdownServer();
setRemoteServerLive(node, false, false);
}
else
{
RemoteServer *server = NULL;
ReplayCreateStatus status =
RENDERDOC_CreateRemoteServerConnection(host->Hostname.toUtf8().data(), 0, &server);
if(server)
server->ShutdownServerAndConnection();
setRemoteServerLive(node, false, false);
if(status != eReplayCreate_Success)
RDDialog::critical(this, tr("Shutdown error"),
tr("Error shutting down remote server: %1").arg(ToQStr(status)));
}
updateConnectButton();
}
else
{
// try to run
ui->refreshOne->setEnabled(false);
ui->refreshAll->setEnabled(false);
m_Lookups.release();
LambdaThread *th = new LambdaThread([this, node]() { runRemoteServer(node); });
th->selfDelete(true);
th->start();
updateLookupsStatus();
}
}
}
void RemoteManager::on_deleteHost_clicked()
{
if(ui->hosts->selectedItems().isEmpty())
return;
QTreeWidgetItem *item = ui->hosts->selectedItems()[0];
RemoteHost *host = getRemoteHost(item);
// don't delete running instances on a host
if(item->parent() != NULL || !host)
return;
QString hostname = item->text(0);
if(hostname == "localhost")
return;
QMessageBox::StandardButton res = RDDialog::question(
this, tr("Deleting host"), tr("Are you sure you wish to delete %1?").arg(hostname),
RDDialog::YesNoCancel);
if(res == QMessageBox::Cancel || res == QMessageBox::No)
return;
if(res == QMessageBox::Yes)
{
int idx = m_Ctx->Config.RemoteHosts.indexOf(host);
delete m_Ctx->Config.RemoteHosts.takeAt(idx);
m_Ctx->Config.Save();
deleteChildren(item);
delete ui->hosts->takeTopLevelItem(ui->hosts->indexOfTopLevelItem(item));
ui->hosts->clearSelection();
ui->hostname->setText(hostname);
on_hostname_textEdited(hostname);
}
}
@@ -0,0 +1,84 @@
/******************************************************************************
* 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>
#include <QSemaphore>
namespace Ui
{
class RemoteManager;
}
class QTreeWidgetItem;
class CaptureContext;
class MainWindow;
class RemoteHost;
class RemoteManager : public QDialog
{
Q_OBJECT
public:
explicit RemoteManager(CaptureContext *ctx, MainWindow *main);
~RemoteManager();
private slots:
// automatic slots
void on_hosts_itemClicked(QTreeWidgetItem *item, int column);
void on_hosts_itemActivated(QTreeWidgetItem *item, int column);
void on_hostname_textEdited(const QString &text);
void on_hosts_keyPress(QKeyEvent *event);
void on_hostname_keyPress(QKeyEvent *event);
void on_runCommand_keyPress(QKeyEvent *event);
void on_refreshOne_clicked();
void on_addUpdateHost_clicked();
void on_refreshAll_clicked();
void on_connect_clicked();
void on_deleteHost_clicked();
private:
Ui::RemoteManager *ui;
CaptureContext *m_Ctx;
MainWindow *m_Main;
QWidget *lookupsProgressFlow;
QSemaphore m_Lookups;
bool isRemoteServerLive(QTreeWidgetItem *node);
void setRemoteServerLive(QTreeWidgetItem *node, bool live, bool busy);
void addHost(RemoteHost *host);
void updateLookupsStatus();
void runRemoteServer(QTreeWidgetItem *node);
void refreshHost(QTreeWidgetItem *node);
void lookupComplete();
void connectToApp(QTreeWidgetItem *node);
void updateConnectButton();
void addNewHost();
void setRunCommand();
};
+201
View File
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RemoteManager</class>
<widget class="QDialog" name="RemoteManager">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>783</width>
<height>545</height>
</rect>
</property>
<property name="windowTitle">
<string>Remote Host Manager</string>
</property>
<widget class="RDTreeWidget" name="hosts">
<property name="geometry">
<rect>
<x>180</x>
<y>20</y>
<width>256</width>
<height>192</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Hostname</string>
</property>
</column>
<column>
<property name="text">
<string>Running</string>
</property>
</column>
</widget>
<widget class="QLabel" name="progressIcon">
<property name="geometry">
<rect>
<x>180</x>
<y>300</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/hourglass.png</pixmap>
</property>
</widget>
<widget class="QLabel" name="progressText">
<property name="geometry">
<rect>
<x>260</x>
<y>300</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Remote connections in progress. Please wait...</string>
</property>
</widget>
<widget class="QLabel" name="progressCount">
<property name="geometry">
<rect>
<x>320</x>
<y>300</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>999 connections active</string>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>140</x>
<y>360</y>
<width>381</width>
<height>155</height>
</rect>
</property>
<layout class="QHBoxLayout" name="bottomLayout">
<item>
<widget class="QGroupBox" name="configGroup">
<property name="title">
<string>Host configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="hostnameLabel">
<property name="text">
<string>Hostname:</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="RDLineEdit" name="hostname"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="addUpdateHost">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="runCommandLabel">
<property name="text">
<string>Run Command: Configure a command to run that launches the remote server on this host.</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="RDLineEdit" name="runCommand"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="opsGroup">
<property name="title">
<string>Operations</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="refreshOne">
<property name="text">
<string>Refresh Selected</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refreshAll">
<property name="text">
<string>Refresh All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="connect">
<property name="text">
<string>Connect to App</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteHost">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>RDTreeWidget</class>
<extends>QTreeWidget</extends>
<header>Widgets/Extended/RDTreeWidget.h</header>
</customwidget>
<customwidget>
<class>RDLineEdit</class>
<extends>QLineEdit</extends>
<header>Widgets/Extended/RDLineEdit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../Resources/resources.qrc"/>
</resources>
<connections/>
</ui>
+12
View File
@@ -37,6 +37,7 @@
#include "Windows/Dialogs/AboutDialog.h"
#include "Windows/Dialogs/CaptureDialog.h"
#include "Windows/Dialogs/LiveCapture.h"
#include "Windows/Dialogs/RemoteManager.h"
#include "Windows/Dialogs/SettingsDialog.h"
#include "Windows/Dialogs/SuggestRemoteDialog.h"
#include "APIInspector.h"
@@ -1333,6 +1334,17 @@ void MainWindow::on_action_Resolve_Symbols_triggered()
m_Ctx->apiInspector()->on_apiEvents_itemSelectionChanged();
}
void MainWindow::on_action_Attach_to_Running_Instance_triggered()
{
on_action_Manage_Remote_Servers_triggered();
}
void MainWindow::on_action_Manage_Remote_Servers_triggered()
{
// the manager deletes itself when all lookups terminate
RDDialog::show(new RemoteManager(m_Ctx, this));
}
void MainWindow::on_action_Start_Android_Remote_Server_triggered()
{
RENDERDOC_StartAndroidRemoteServer();
+2
View File
@@ -98,6 +98,8 @@ private slots:
void on_action_Statistics_Viewer_triggered();
void on_action_Inject_into_Process_triggered();
void on_action_Resolve_Symbols_triggered();
void on_action_Attach_to_Running_Instance_triggered();
void on_action_Manage_Remote_Servers_triggered();
void on_action_Start_Android_Remote_Server_triggered();
void on_action_Settings_triggered();
+6 -3
View File
@@ -141,7 +141,8 @@ SOURCES += Code/qrenderdoc.cpp \
Windows/Dialogs/OrderedListEditor.cpp \
Widgets/Extended/RDTableWidget.cpp \
Windows/Dialogs/SuggestRemoteDialog.cpp \
Windows/Dialogs/VirtualFileDialog.cpp
Windows/Dialogs/VirtualFileDialog.cpp \
Windows/Dialogs/RemoteManager.cpp
HEADERS += Code/CaptureContext.h \
Code/qprocessinfo.h \
@@ -185,7 +186,8 @@ HEADERS += Code/CaptureContext.h \
Windows/Dialogs/OrderedListEditor.h \
Widgets/Extended/RDTableWidget.h \
Windows/Dialogs/SuggestRemoteDialog.h \
Windows/Dialogs/VirtualFileDialog.h
Windows/Dialogs/VirtualFileDialog.h \
Windows/Dialogs/RemoteManager.h
FORMS += Windows/Dialogs/AboutDialog.ui \
Windows/MainWindow.ui \
@@ -211,7 +213,8 @@ FORMS += Windows/Dialogs/AboutDialog.ui \
Windows/Dialogs/SettingsDialog.ui \
Windows/Dialogs/OrderedListEditor.ui \
Windows/Dialogs/SuggestRemoteDialog.ui \
Windows/Dialogs/VirtualFileDialog.ui
Windows/Dialogs/VirtualFileDialog.ui \
Windows/Dialogs/RemoteManager.ui
RESOURCES += Resources/resources.qrc
+15
View File
@@ -657,6 +657,7 @@
<ClCompile Include="generated\moc_GLPipelineStateViewer.cpp" />
<ClCompile Include="generated\moc_LiveCapture.cpp" />
<ClCompile Include="generated\moc_OrderedListEditor.cpp" />
<ClCompile Include="generated\moc_RemoteManager.cpp" />
<ClCompile Include="generated\moc_PipelineStateViewer.cpp" />
<ClCompile Include="generated\moc_QRDUtils.cpp" />
<ClCompile Include="generated\moc_RangeHistogram.cpp" />
@@ -718,6 +719,7 @@
<ClCompile Include="Windows\Dialogs\CaptureDialog.cpp" />
<ClCompile Include="Windows\Dialogs\LiveCapture.cpp" />
<ClCompile Include="Windows\Dialogs\OrderedListEditor.cpp" />
<ClCompile Include="Windows\Dialogs\RemoteManager.cpp" />
<ClCompile Include="Windows\Dialogs\SettingsDialog.cpp" />
<ClCompile Include="Windows\Dialogs\SuggestRemoteDialog.cpp" />
<ClCompile Include="Windows\Dialogs\TextureSaveDialog.cpp" />
@@ -865,6 +867,7 @@
<ClInclude Include="generated\ui_LiveCapture.h" />
<ClInclude Include="generated\ui_MainWindow.h" />
<ClInclude Include="generated\ui_OrderedListEditor.h" />
<ClInclude Include="generated\ui_RemoteManager.h" />
<ClInclude Include="generated\ui_PipelineStateViewer.h" />
<ClInclude Include="generated\ui_ResourcePreview.h" />
<ClInclude Include="generated\ui_SettingsDialog.h" />
@@ -1022,6 +1025,12 @@
<Message>MOC %(Filename).h</Message>
<Outputs>generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\RemoteManager.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I$(ProjectDir) -I$(SolutionDir)\renderdoc\api\replay -I$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015 -I$(ProjectDir)3rdparty\qt\$(Platform)\include -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore %(Fullpath) -o $(ProjectDir)generated\moc_%(Filename).cpp</Command>
<Message>MOC %(Filename).h</Message>
<Outputs>generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\SettingsDialog.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I$(ProjectDir) -I$(SolutionDir)\renderdoc\api\replay -I$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015 -I$(ProjectDir)3rdparty\qt\$(Platform)\include -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore %(Fullpath) -o $(ProjectDir)generated\moc_%(Filename).cpp</Command>
@@ -1175,6 +1184,12 @@
<Message>UIC %(Filename).ui</Message>
<Outputs>generated\ui_%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\RemoteManager.ui">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe %(Fullpath) -o $(ProjectDir)generated\ui_%(Filename).h</Command>
<Message>UIC %(Filename).ui</Message>
<Outputs>generated\ui_%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\SettingsDialog.ui">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe %(Fullpath) -o $(ProjectDir)generated\ui_%(Filename).h</Command>
@@ -504,6 +504,12 @@
<ClCompile Include="Code\PersistantConfig.cpp">
<Filter>Code</Filter>
</ClCompile>
<ClCompile Include="generated\moc_RemoteManager.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="Windows\Dialogs\RemoteManager.cpp">
<Filter>Windows\Dialogs</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h">
@@ -773,6 +779,9 @@
<ClInclude Include="Code\PersistantConfig.h">
<Filter>Code</Filter>
</ClInclude>
<ClInclude Include="generated\ui_RemoteManager.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Resources\128.png">
@@ -1180,5 +1189,11 @@
<CustomBuild Include="3rdparty\scintilla\qt\ScintillaEditBase\ScintillaQt.h">
<Filter>3rdparty\Scintilla\qt\ScintillaEditBase</Filter>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\RemoteManager.ui">
<Filter>Windows\Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\RemoteManager.h">
<Filter>Windows\Dialogs</Filter>
</CustomBuild>
</ItemGroup>
</Project>