Change all URLs to jump URLs

This commit is contained in:
Srivats P 2017-10-10 21:36:06 +05:30
parent f9b83763bd
commit b3fb053cca
4 changed files with 50 additions and 11 deletions

38
client/jumpurl.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>
*/
#ifndef _JUMP_URL_H
#define _JUMP_URL_H
#include <QString>
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

View File

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#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("<p>This is most likely because Packet.dll "
"was not found - make sure you have "
"<a href='http://www.winpcap.org'>WinPcap</a> "
"installed.</p>"));
"<a href='%1'>WinPcap"
"</a> installed.</p>")
.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("<p>If you have remote drone agents running, you can still add "
"and connect to them.</p>"
"<p>If you don't want to start the local drone agent at startup, "
"provide the <b>-s</b> option to Ostinato on the command line.</p>"
"<p>Learn about Ostinato's <a href='%1'>Controller-Agent "
"architecture</a></p>").arg(archUrl));
"architecture</a></p>").arg(jumpUrl("arch")));
}
void MainWindow::onNewVersion(QString newVersion)
{
QLabel *msg = new QLabel(tr("New Ostinato version %1 available. Visit "
"<a href='http://ostinato.org'>ostinato.org</a> to download")
.arg(newVersion));
"<a href='%2'>ostinato.org</a> to download")
.arg(newVersion)
.arg(jumpUrl("download", "app", "status", "update")));
msg->setOpenExternalLinks(true);
statusBar()->addPermanentWidget(msg);
}

View File

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#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 <a href='%1'>Ostinato FAQ</a> "
"for instructions to fix this problem").arg(faq));
"for instructions to fix this problem").arg(jumpUrl("noports")));
msgBox.exec();
}
}

View File

@ -57,7 +57,7 @@
&lt;p&gt;To generate packets, you need to create and configure packet streams. A stream is a sequence of one or more packets.&lt;/p&gt;
&lt;p&gt;To create a stream, select the port on which you want to send packets.&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;Don't see the port that you want (or any ports at all) inside the port group? &lt;a href=&quot;http://ostinato.org/docs/faq&quot;&gt;Get Help!&lt;/a&gt;&lt;/p&gt;</string>
&lt;p&gt;Don't see the port that you want (or any ports at all) inside the port group? &lt;a href=&quot;http://jump.ostinato.org/noports&quot;&gt;Get Help!&lt;/a&gt;&lt;/p&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>