improved display of Tor starting window

This commit is contained in:
csoler 2017-12-26 20:42:25 +01:00
parent 355a0b42e9
commit 390af949a8
6 changed files with 152 additions and 61 deletions

View File

@ -3,6 +3,7 @@
#include <QTimer>
#include <QFile>
#include <QTcpServer>
#include <QGraphicsDropShadowEffect>
#include <iostream>
@ -34,6 +35,19 @@ TorControlDialog::TorControlDialog(Tor::TorManager *tm,QWidget *parent)
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(showLog())) ;
timer->start(500) ;
// Hide some debug output for the released version
// torLog_TB->hide();
torBootstrapStatus_LB->hide();
label_2->hide();
setWindowFlags( Qt::Dialog | Qt::FramelessWindowHint );
adjustSize();
// QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
// effect->setBlurRadius(30.0);
// setGraphicsEffect(effect);
}
void TorControlDialog::onIncomingConnection()
@ -66,7 +80,8 @@ void TorControlDialog::statusChanged()
case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ;
}
torStatus_LB->setText(torstatus_str + "(" + status_str + ")") ;
//torStatus_LB->setText(torstatus_str + "(" + status_str + ")") ;
torStatus_LB->setText(status_str) ;
QVariantMap qvm = mTorManager->control()->bootstrapStatus();
QString bootstrapstatus_str ;
@ -79,23 +94,29 @@ void TorControlDialog::statusChanged()
QList<Tor::HiddenService*> hidden_services = mTorManager->control()->hiddenServices();
if(hidden_services.empty())
hiddenService_LB->setText(QString("None")) ;
{
hiddenServiceAddress_LB->setText(QString("[Not ready]")) ;
onionAddress_LB->setText(QString("[Not ready]")) ;
}
else
{
QString hiddenservices_str ;
for(auto it(hidden_services.begin());it!=hidden_services.end();++it)
{
hiddenservices_str += (*it)->hostname();
onionAddress_LB->setText((*it)->hostname());
for(auto it2((*it)->targets().begin());it2!=(*it)->targets().end();++it2)
hiddenservices_str += QString::number((*it2).servicePort) + ":" + (*it2).targetAddress.toString() + ":" + QString::number((*it2).targetPort) + " " ;
{
hiddenServiceAddress_LB->setText(QString::number((*it2).servicePort) + ":" + (*it2).targetAddress.toString() + ":" + QString::number((*it2).targetPort));
break ;
}
break ;
}
hiddenService_LB->setText(hiddenservices_str) ;
}
showLog();
adjustSize();
}
void TorControlDialog::showLog()
@ -106,10 +127,9 @@ void TorControlDialog::showLog()
for(QStringList::const_iterator it(logmsgs.begin());it!=logmsgs.end();++it)
s += *it + "\n" ;
torLog_TB->setText(s) ;
// QCoreApplication::processEvents() ;
// torLog_TB->setText(s) ;
// std::cerr << s.toStdString() << std::endl;
std::cerr << s.toStdString() << std::endl;
}
TorControlDialog::TorStatus TorControlDialog::checkForTor()

View File

@ -7,7 +7,7 @@ namespace Tor {
class TorManager ;
}
class TorControlDialog: public QDialog, public Ui::TorControlDialog
class TorControlDialog: public QWidget, public Ui::TorControlDialog
{
Q_OBJECT

View File

@ -1,32 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TorControlDialog</class>
<widget class="QDialog" name="TorControlDialog">
<widget class="QWidget" name="TorControlDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>739</width>
<height>489</height>
<width>600</width>
<height>188</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1">
<widget class="QLabel" name="hiddenService_LB">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TextLabel</string>
<string>Setting up Tor...</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tor bootstrap status:</string>
<string/>
</property>
<property name="pixmap">
<pixmap resource="../gui/icons.qrc">:/icons/tor-logo.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Tor status:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="torStatus_LB">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
@ -40,19 +80,42 @@
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Hidden service:</string>
<string>Hidden service address:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tor status:</string>
<string>Tor bootstrap status:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="torStatus_LB">
<item row="2" column="1">
<widget class="QLabel" name="hiddenServiceAddress_LB">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Onion address:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="onionAddress_LB">
<property name="text">
<string>TextLabel</string>
</property>
@ -60,11 +123,12 @@
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="torLog_TB"/>
</layout>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../gui/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/onion.png</file>
<file>icons/svg/hidden.svg</file>
<file>icons/svg/randomness.svg</file>
<file>icons/svg/password.svg</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -313,8 +313,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
// #endif
/* Start RetroShare */
QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/);
QString sDefaultGXSIdToCreate = "";
switch (initResult) {
case RS_INIT_OK:
@ -348,13 +346,13 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
sDefaultGXSIdToCreate = gd.getGXSNickname();
}
splashScreen.show();
//splashScreen.show();
}
break;
case RS_INIT_HAVE_ACCOUNT:
{
splashScreen.show();
splashScreen.showMessage(rshare.translate("SplashScreen", "Load profile"), Qt::AlignHCenter | Qt::AlignBottom);
//splashScreen.show();
//splashScreen.showMessage(rshare.translate("SplashScreen", "Load profile"), Qt::AlignHCenter | Qt::AlignBottom);
RsPeerId preferredId;
RsAccounts::GetPreferredAccountId(preferredId);
@ -394,7 +392,12 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
TorControlDialog tcd(torManager) ;
tcd.show();
while(tcd.checkForHiddenService() != 1+TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
while(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
{
QCoreApplication::processEvents();
usleep(0.2*1000*1000) ;
}
for(uint32_t i=0;i<10;++i) // give some time (2 secs) to see what's going on
{
QCoreApplication::processEvents();
usleep(0.2*1000*1000) ;
@ -410,6 +413,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
}
#endif
QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/);
splashScreen.show();
splashScreen.showMessage(rshare.translate("SplashScreen", "Load configuration"), Qt::AlignHCenter | Qt::AlignBottom);
/* stop Retroshare if startup fails */