diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index a019acaf..d491e8a0 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -341,7 +341,7 @@ namespace http {
s << "
" << std::endl;
}
- static void ShowLocalDestination (std::stringstream& s, const std::string& b32)
+ void ShowLocalDestination (std::stringstream& s, const std::string& b32)
{
s << "Local Destination:
\r\n
\r\n";
i2p::data::IdentHash ident;
diff --git a/daemon/HTTPServer.h b/daemon/HTTPServer.h
index b65c9094..ec718532 100644
--- a/daemon/HTTPServer.h
+++ b/daemon/HTTPServer.h
@@ -86,6 +86,7 @@ namespace http
void ShowTransports (std::stringstream& s);
void ShowSAMSessions (std::stringstream& s);
void ShowI2PTunnels (std::stringstream& s);
+ void ShowLocalDestination (std::stringstream& s, const std::string& b32);
} // http
} // i2p
diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro
index c1ce8c5c..06760bb7 100644
--- a/qt/i2pd_qt/i2pd_qt.pro
+++ b/qt/i2pd_qt/i2pd_qt.pro
@@ -88,7 +88,8 @@ SOURCES += DaemonQT.cpp mainwindow.cpp \
../../daemon/I2PControl.cpp \
../../daemon/UnixDaemon.cpp \
../../daemon/UPnP.cpp \
- textbrowsertweaked1.cpp
+ textbrowsertweaked1.cpp \
+ pagewithbackbutton.cpp
#qt creator does not handle this well
#SOURCES += $$files(../../libi2pd/*.cpp)
@@ -168,7 +169,8 @@ HEADERS += DaemonQT.h mainwindow.h \
../../daemon/HTTPServer.h \
../../daemon/I2PControl.h \
../../daemon/UPnP.h \
- textbrowsertweaked1.h
+ textbrowsertweaked1.h \
+ pagewithbackbutton.h
INCLUDEPATH += ../../libi2pd
INCLUDEPATH += ../../libi2pd_client
diff --git a/qt/i2pd_qt/mainwindow.cpp b/qt/i2pd_qt/mainwindow.cpp
index b342efe1..79516206 100644
--- a/qt/i2pd_qt/mainwindow.cpp
+++ b/qt/i2pd_qt/mainwindow.cpp
@@ -15,6 +15,7 @@
#include "FS.h"
#include "Log.h"
#include "RouterContext.h"
+#include "Transports.h"
#include "HTTPServer.h"
@@ -60,7 +61,7 @@ MainWindow::MainWindow(QWidget *parent) :
setWindowTitle(QApplication::translate("AppTitle","I2PD"));
//TODO handle resizes and change the below into resize() call
- setFixedSize(width(), 550);
+ setFixedHeight(550);
ui->centralWidget->setFixedHeight(550);
onResize();
@@ -88,8 +89,21 @@ MainWindow::MainWindow(QWidget *parent) :
createTrayIcon();
#endif
- textBrowser = new TextBrowserTweaked1();
+ textBrowser = new TextBrowserTweaked1(this);
+ //textBrowser->setOpenExternalLinks(false);
+ textBrowser->setOpenLinks(false);
+ /*textBrowser->setTextInteractionFlags(textBrowser->textInteractionFlags()|
+ Qt::LinksAccessibleByMouse|Qt::LinksAccessibleByKeyboard|
+ Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);*/
ui->verticalLayout_2->addWidget(textBrowser);
+ childTextBrowser = new TextBrowserTweaked1(this);
+ //childTextBrowser->setOpenExternalLinks(false);
+ childTextBrowser->setOpenLinks(false);
+ connect(textBrowser, SIGNAL(anchorClicked(const QUrl&)), this, SLOT(anchorClickedHandler(const QUrl&)));
+ pageWithBackButton = new PageWithBackButton(this, childTextBrowser);
+ ui->verticalLayout_2->addWidget(pageWithBackButton);
+ pageWithBackButton->hide();
+ connect(pageWithBackButton, SIGNAL(backReleased()), this, SLOT(backClickedFromChild()));
scheduleStatusPageUpdates();
QObject::connect(ui->statusPagePushButton, SIGNAL(released()), this, SLOT(showStatusMainPage()));
@@ -107,6 +121,9 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(textBrowser, SIGNAL(mouseReleased()), this, SLOT(statusHtmlPageMouseReleased()));
QObject::connect(textBrowser, SIGNAL(selectionChanged()), this, SLOT(statusHtmlPageSelectionChanged()));
+ QObject::connect(routerCommandsUI->runPeerTestPushButton, SIGNAL(released()), this, SLOT(runPeerTest()));
+ QObject::connect(routerCommandsUI->acceptTransitTunnelsPushButton, SIGNAL(released()), this, SLOT(enableTransit()));
+ QObject::connect(routerCommandsUI->declineTransitTunnelsPushButton, SIGNAL(released()), this, SLOT(disableTransit()));
QObject::connect(ui->settingsPagePushButton, SIGNAL(released()), this, SLOT(showSettingsPage()));
@@ -279,9 +296,11 @@ void MainWindow::showStatusPage(StatusPage newStatusPage){
textBrowser->setHtml(getStatusPageHtml(false));
textBrowser->show();
routerCommandsParent->hide();
+ pageWithBackButton->hide();
}else{
routerCommandsParent->show();
textBrowser->hide();
+ pageWithBackButton->hide();
updateRouterCommandsButtons();
}
wasSelectingAtStatusMainPage=false;
@@ -299,6 +318,8 @@ void MainWindow::setStatusButtonsVisible(bool visible) {
QString MainWindow::getStatusPageHtml(bool showHiddenInfo) {
std::stringstream s;
+ s << "";
+
switch (statusPage) {
case main_page: i2p::http::ShowStatus(s, showHiddenInfo);break;
case commands: break;
@@ -753,3 +774,40 @@ void MainWindow::setI2PController(i2p::qt::Controller* controller_) {
this->i2pController = controller_;
}
+void MainWindow::runPeerTest() {
+ i2p::transport::transports.PeerTest();
+}
+
+void MainWindow::enableTransit() {
+ i2p::context.SetAcceptsTunnels(true);
+ updateRouterCommandsButtons();
+}
+
+void MainWindow::disableTransit() {
+ i2p::context.SetAcceptsTunnels(false);
+ updateRouterCommandsButtons();
+}
+
+void MainWindow::anchorClickedHandler(const QUrl & link) {
+ QString debugStr=QString()+"anchorClicked: "+"\""+link.toString()+"\"";
+ qDebug()<show();
+ textBrowser->hide();
+ std::stringstream s;
+ i2p::http::ShowLocalDestination(s,str.toStdString());
+ childTextBrowser->setHtml(QString::fromStdString(s.str()));
+ }
+}
+
+void MainWindow::backClickedFromChild() {
+ showStatusPage(statusPage);
+}
diff --git a/qt/i2pd_qt/mainwindow.h b/qt/i2pd_qt/mainwindow.h
index 2a1e7d64..829cac37 100644
--- a/qt/i2pd_qt/mainwindow.h
+++ b/qt/i2pd_qt/mainwindow.h
@@ -24,6 +24,7 @@
#include
#include
#include "QVBoxLayout"
+#include "QUrl"
#ifndef ANDROID
# include
@@ -54,6 +55,7 @@
#include "DaemonQT.h"
#include "SignatureTypeComboboxFactory.h"
+#include "pagewithbackbutton.h"
template
bool isType(boost::any& a) {
@@ -357,6 +359,10 @@ private slots:
void showStatusMainPage();
void showStatus_commands_Page();
+ void runPeerTest();
+ void enableTransit();
+ void disableTransit();
+
void showStatus_local_destinations_Page();
void showStatus_leasesets_Page();
void showStatus_tunnels_Page();
@@ -392,6 +398,8 @@ private:
TextBrowserTweaked1 * textBrowser;
QWidget * routerCommandsParent;
+ PageWithBackButton * pageWithBackButton;
+ TextBrowserTweaked1 * childTextBrowser;
i2p::qt::Controller* i2pController;
@@ -442,6 +450,9 @@ public slots:
void addServerTunnelPushButtonReleased();
void addClientTunnelPushButtonReleased();
+ void anchorClickedHandler(const QUrl & link);
+ void backClickedFromChild();
+
private:
QString datadir;
QString confpath;
diff --git a/qt/i2pd_qt/pagewithbackbutton.cpp b/qt/i2pd_qt/pagewithbackbutton.cpp
index c1692552..bc297ac2 100644
--- a/qt/i2pd_qt/pagewithbackbutton.cpp
+++ b/qt/i2pd_qt/pagewithbackbutton.cpp
@@ -1,6 +1,24 @@
#include "pagewithbackbutton.h"
+#include "QVBoxLayout"
+#include "QHBoxLayout"
+#include "QPushButton"
-PageWithBackButton::PageWithBackButton(QWidget *parent) : QWidget(parent)
+PageWithBackButton::PageWithBackButton(QWidget *parent, QWidget* child) : QWidget(parent)
{
+ QVBoxLayout * layout = new QVBoxLayout();
+ setLayout(layout);
+ QWidget * topBar = new QWidget();
+ QHBoxLayout * topBarLayout = new QHBoxLayout();
+ topBar->setLayout(topBarLayout);
+ layout->addWidget(topBar);
+ layout->addWidget(child);
+ QPushButton * backButton = new QPushButton(topBar);
+ backButton->setText("< Back");
+ topBarLayout->addWidget(backButton);
+ connect(backButton, SIGNAL(released()), this, SLOT(backReleasedSlot()));
+}
+
+void PageWithBackButton::backReleasedSlot() {
+ emit backReleased();
}
diff --git a/qt/i2pd_qt/pagewithbackbutton.h b/qt/i2pd_qt/pagewithbackbutton.h
index eef97b26..60779f80 100644
--- a/qt/i2pd_qt/pagewithbackbutton.h
+++ b/qt/i2pd_qt/pagewithbackbutton.h
@@ -7,11 +7,15 @@ class PageWithBackButton : public QWidget
{
Q_OBJECT
public:
- explicit PageWithBackButton(QWidget *parent = 0);
+ explicit PageWithBackButton(QWidget *parent, QWidget* child);
signals:
-public slots:
+ void backReleased();
+
+private slots:
+
+ void backReleasedSlot();
};
-#endif // PAGEWITHBACKBUTTON_H
\ No newline at end of file
+#endif // PAGEWITHBACKBUTTON_H
diff --git a/qt/i2pd_qt/routercommandswidget.ui b/qt/i2pd_qt/routercommandswidget.ui
index fa4f2177..c5098e8e 100644
--- a/qt/i2pd_qt/routercommandswidget.ui
+++ b/qt/i2pd_qt/routercommandswidget.ui
@@ -6,7 +6,7 @@
0
0
- 400
+ 711
300
@@ -24,13 +24,22 @@
0
0
- 401
+ 711
301
+
+ QLayout::SetMaximumSize
+
-
+
+
+ 0
+ 0
+
+
75
@@ -44,6 +53,12 @@
-
+
+
+ 0
+ 0
+
+
Run peer test
@@ -51,6 +66,12 @@
-
+
+
+ 0
+ 0
+
+
Decline transit tunnels
@@ -58,6 +79,12 @@
-
+
+
+ 0
+ 0
+
+
Accept transit tunnels
@@ -68,6 +95,12 @@
false
+
+
+ 0
+ 0
+
+
Cancel graceful quit
diff --git a/qt/i2pd_qt/textbrowsertweaked1.cpp b/qt/i2pd_qt/textbrowsertweaked1.cpp
index 7d0f5132..f8802061 100644
--- a/qt/i2pd_qt/textbrowsertweaked1.cpp
+++ b/qt/i2pd_qt/textbrowsertweaked1.cpp
@@ -1,6 +1,9 @@
#include "textbrowsertweaked1.h"
-TextBrowserTweaked1::TextBrowserTweaked1()
+TextBrowserTweaked1::TextBrowserTweaked1(QWidget * parent): QTextBrowser(parent)
{
-
}
+
+/*void TextBrowserTweaked1::setSource(const QUrl & url) {
+ emit navigatedTo(url);
+}*/
diff --git a/qt/i2pd_qt/textbrowsertweaked1.h b/qt/i2pd_qt/textbrowsertweaked1.h
index d64c58d8..288a3c32 100644
--- a/qt/i2pd_qt/textbrowsertweaked1.h
+++ b/qt/i2pd_qt/textbrowsertweaked1.h
@@ -2,19 +2,23 @@
#define TEXTBROWSERTWEAKED1_H
#include
+#include
class TextBrowserTweaked1 : public QTextBrowser
{
Q_OBJECT
public:
- TextBrowserTweaked1();
+ TextBrowserTweaked1(QWidget * parent);
+ //virtual void setSource(const QUrl & url);
signals:
void mouseReleased();
+ //void navigatedTo(const QUrl & link);
protected:
void mouseReleaseEvent(QMouseEvent *event) {
+ QTextBrowser::mouseReleaseEvent(event);
emit mouseReleased();
}
};