Access CaptureContext & RenderManager by reference, not pointer

* Neither of these can or should be NULL so enforce it explicitly.
This commit is contained in:
baldurk
2017-02-09 19:28:24 +00:00
parent 0d141b6d7e
commit 2285b209c3
44 changed files with 762 additions and 779 deletions
+12 -12
View File
@@ -80,7 +80,7 @@ static void setItalic(QTreeWidgetItem *node, bool italic)
node->setFont(1, f);
}
RemoteManager::RemoteManager(CaptureContext *ctx, MainWindow *main)
RemoteManager::RemoteManager(CaptureContext &ctx, MainWindow *main)
: QDialog(NULL), ui(new Ui::RemoteManager), m_Ctx(ctx), m_Main(main)
{
ui->setupUi(this);
@@ -108,9 +108,9 @@ RemoteManager::RemoteManager(CaptureContext *ctx, MainWindow *main)
vertical->addWidget(lookupsProgressFlow);
vertical->addWidget(ui->bottomLayout->parentWidget());
m_Ctx->Config.AddAndroidHosts();
m_Ctx.Config.AddAndroidHosts();
for(RemoteHost *h : m_Ctx->Config.RemoteHosts)
for(RemoteHost *h : m_Ctx.Config.RemoteHosts)
addHost(h);
on_hosts_itemClicked(ui->hosts->topLevelItem(0), 0);
@@ -355,9 +355,9 @@ void RemoteManager::addNewHost()
{
bool found = false;
for(int i = 0; i < m_Ctx->Config.RemoteHosts.count(); i++)
for(int i = 0; i < m_Ctx.Config.RemoteHosts.count(); i++)
{
if(m_Ctx->Config.RemoteHosts[i]->Hostname.compare(host, Qt::CaseInsensitive) == 0)
if(m_Ctx.Config.RemoteHosts[i]->Hostname.compare(host, Qt::CaseInsensitive) == 0)
{
found = true;
break;
@@ -370,8 +370,8 @@ void RemoteManager::addNewHost()
h->Hostname = host;
h->RunCommand = ui->runCommand->text().trimmed();
m_Ctx->Config.RemoteHosts.push_back(h);
m_Ctx->Config.Save();
m_Ctx.Config.RemoteHosts.push_back(h);
m_Ctx.Config.Save();
addHost(h);
}
@@ -390,7 +390,7 @@ void RemoteManager::setRunCommand()
if(h)
{
h->RunCommand = ui->runCommand->text().trimmed();
m_Ctx->Config.Save();
m_Ctx.Config.Save();
}
}
@@ -597,7 +597,7 @@ void RemoteManager::on_connect_clicked()
// shut down
if(host->Connected)
{
m_Ctx->Renderer()->ShutdownServer();
m_Ctx.Renderer().ShutdownServer();
setRemoteServerLive(node, false, false);
}
else
@@ -660,9 +660,9 @@ void RemoteManager::on_deleteHost_clicked()
if(res == QMessageBox::Yes)
{
int idx = m_Ctx->Config.RemoteHosts.indexOf(host);
delete m_Ctx->Config.RemoteHosts.takeAt(idx);
m_Ctx->Config.Save();
int idx = m_Ctx.Config.RemoteHosts.indexOf(host);
delete m_Ctx.Config.RemoteHosts.takeAt(idx);
m_Ctx.Config.Save();
deleteChildren(item);