From b3fb053ccaeff9e93755fa9ead8b4907d1b87efa Mon Sep 17 00:00:00 2001
From: Srivats P
Date: Tue, 10 Oct 2017 21:36:06 +0530
Subject: [PATCH] Change all URLs to jump URLs
---
client/jumpurl.h | 38 ++++++++++++++++++++++++++++++++++++++
client/mainwindow.cpp | 17 +++++++++--------
client/portgroup.cpp | 4 ++--
client/portswindow.ui | 2 +-
4 files changed, 50 insertions(+), 11 deletions(-)
create mode 100644 client/jumpurl.h
diff --git a/client/jumpurl.h b/client/jumpurl.h
new file mode 100644
index 0000000..d91a3be
--- /dev/null
+++ b/client/jumpurl.h
@@ -0,0 +1,38 @@
+/*
+Copyright (C) 2017 Srivats P.
+
+This file is part of "Ostinato"
+
+This is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+#ifndef _JUMP_URL_H
+#define _JUMP_URL_H
+
+#include
+
+inline QString jumpUrl(
+ QString keyword,
+ QString source="app",
+ QString medium="hint",
+ QString name="help")
+{
+ return QString("http://jump.ostinato.org/" + keyword + "?"
+ + "utm_source=" + source + "&"
+ + "utm_medium=" + medium + "&"
+ + "utm_campaign=" + name);
+}
+
+#endif
+
diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp
index c437d28..5d8c93d 100644
--- a/client/mainwindow.cpp
+++ b/client/mainwindow.cpp
@@ -23,6 +23,7 @@ along with this program. If not, see
#include "dbgthread.h"
#endif
+#include "jumpurl.h"
#include "params.h"
#include "portgrouplist.h"
#include "portstatswindow.h"
@@ -313,8 +314,7 @@ void MainWindow::on_actionViewRestoreDefaults_triggered()
void MainWindow::on_actionHelpOnline_triggered()
{
- QDesktopServices::openUrl(
- QUrl("http://ostinato.org/docs/?utm_source=app&utm_medium=menu&utm_campaign=help"));
+ QDesktopServices::openUrl(QUrl(jumpUrl("help", "app", "menu")));
}
void MainWindow::on_actionHelpAbout_triggered()
@@ -376,28 +376,29 @@ void MainWindow::reportLocalServerError()
if (localServer_->exitCode() == STATUS_DLL_NOT_FOUND)
errorStr.append(tr("This is most likely because Packet.dll "
"was not found - make sure you have "
- "WinPcap "
- "installed.
"));
+ "WinPcap"
+ " installed.
")
+ .arg(jumpUrl("winpcap")));
#endif
msgBox.setText(errorStr);
msgBox.setInformativeText(tr("Try running drone directly."));
msgBox.exec();
- QString archUrl("https://userguide.ostinato.org/Architecture.html");
QMessageBox::information(this, QString(),
tr("If you have remote drone agents running, you can still add "
"and connect to them.
"
"If you don't want to start the local drone agent at startup, "
"provide the -s option to Ostinato on the command line.
"
"Learn about Ostinato's Controller-Agent "
- "architecture
").arg(archUrl));
+ "architecture").arg(jumpUrl("arch")));
}
void MainWindow::onNewVersion(QString newVersion)
{
QLabel *msg = new QLabel(tr("New Ostinato version %1 available. Visit "
- "ostinato.org to download")
- .arg(newVersion));
+ "ostinato.org to download")
+ .arg(newVersion)
+ .arg(jumpUrl("download", "app", "status", "update")));
msg->setOpenExternalLinks(true);
statusBar()->addPermanentWidget(msg);
}
diff --git a/client/portgroup.cpp b/client/portgroup.cpp
index 404e942..42620ae 100644
--- a/client/portgroup.cpp
+++ b/client/portgroup.cpp
@@ -19,6 +19,7 @@ along with this program. If not, see
#include "portgroup.h"
+#include "jumpurl.h"
#include "settings.h"
#include "emulproto.pb.h"
@@ -315,7 +316,6 @@ void PortGroup::on_rpcChannel_notification(int notifType,
void PortGroup::when_portListChanged(quint32 /*portGroupId*/)
{
- QString faq("http://ostinato.org/docs/faq#q-port-group-has-no-interfaces");
if (state() == QAbstractSocket::ConnectedState && numPorts() <= 0)
{
QMessageBox msgBox;
@@ -330,7 +330,7 @@ void PortGroup::when_portListChanged(quint32 /*portGroupId*/)
.arg(int(serverPort()));
msgBox.setText(msg);
msgBox.setInformativeText(tr("See the Ostinato FAQ "
- "for instructions to fix this problem").arg(faq));
+ "for instructions to fix this problem").arg(jumpUrl("noports")));
msgBox.exec();
}
}
diff --git a/client/portswindow.ui b/client/portswindow.ui
index f364eac..d6de594 100644
--- a/client/portswindow.ui
+++ b/client/portswindow.ui
@@ -57,7 +57,7 @@
<p>To generate packets, you need to create and configure packet streams. A stream is a sequence of one or more packets.</p>
<p>To create a stream, select the port on which you want to send packets.</p>
<hr/>
-<p>Don't see the port that you want (or any ports at all) inside the port group? <a href="http://ostinato.org/docs/faq">Get Help!</a></p>
+<p>Don't see the port that you want (or any ports at all) inside the port group? <a href="http://jump.ostinato.org/noports">Get Help!</a></p>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop