mirror of
https://github.com/PurpleI2P/i2pd-qt.git
synced 2025-02-03 18:24:19 +00:00
Merge pull request #79 from nonlin-lin-chaos-order-etc-etal/master
Assorted fixes
This commit is contained in:
commit
37f3e214eb
@ -25,40 +25,40 @@ namespace qt
|
|||||||
void Worker::startDaemon()
|
void Worker::startDaemon()
|
||||||
{
|
{
|
||||||
qDebug("Performing daemon start...");
|
qDebug("Performing daemon start...");
|
||||||
//try{
|
try{
|
||||||
m_Daemon.start();
|
m_Daemon.start();
|
||||||
qDebug("Daemon started.");
|
qDebug("Daemon started.");
|
||||||
emit resultReady(false, "");
|
emit resultReady(false, "");
|
||||||
/*}catch(std::exception ex){
|
}catch(std::exception& ex){
|
||||||
emit resultReady(true, ex.what());
|
emit resultReady(true, ex.what());
|
||||||
}catch(...){
|
}catch(...){
|
||||||
emit resultReady(true, QObject::tr("Error: unknown exception"));
|
emit resultReady(true, QObject::tr("Error: unknown exception"));
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
void Worker::restartDaemon()
|
void Worker::restartDaemon()
|
||||||
{
|
{
|
||||||
qDebug("Performing daemon restart...");
|
qDebug("Performing daemon restart...");
|
||||||
//try{
|
try{
|
||||||
m_Daemon.restart();
|
m_Daemon.restart();
|
||||||
qDebug("Daemon restarted.");
|
qDebug("Daemon restarted.");
|
||||||
emit resultReady(false, "");
|
emit resultReady(false, "");
|
||||||
/*}catch(std::exception ex){
|
}catch(std::exception& ex){
|
||||||
emit resultReady(true, ex.what());
|
emit resultReady(true, ex.what());
|
||||||
}catch(...){
|
}catch(...){
|
||||||
emit resultReady(true, QObject::tr("Error: unknown exception"));
|
emit resultReady(true, QObject::tr("Error: unknown exception"));
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
void Worker::stopDaemon() {
|
void Worker::stopDaemon() {
|
||||||
qDebug("Performing daemon stop...");
|
qDebug("Performing daemon stop...");
|
||||||
//try{
|
try{
|
||||||
m_Daemon.stop();
|
m_Daemon.stop();
|
||||||
qDebug("Daemon stopped.");
|
qDebug("Daemon stopped.");
|
||||||
emit resultReady(false, "");
|
emit resultReady(false, "");
|
||||||
/*}catch(std::exception ex){
|
}catch(std::exception& ex){
|
||||||
emit resultReady(true, ex.what());
|
emit resultReady(true, ex.what());
|
||||||
}catch(...){
|
}catch(...){
|
||||||
emit resultReady(true, QObject::tr("Error: unknown exception"));
|
emit resultReady(true, QObject::tr("Error: unknown exception"));
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller::Controller(DaemonQTImpl& daemon):
|
Controller::Controller(DaemonQTImpl& daemon):
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void reloadTunnelsConfigAndUISignal(const QString);
|
void reloadTunnelsConfigAndUISignal(const QString);
|
||||||
|
void showPreventedSaveTunnelsConfMessage();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SAVER_H
|
#endif // SAVER_H
|
||||||
|
@ -9,9 +9,11 @@
|
|||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
SaverImpl::SaverImpl(MainWindow *mainWindowPtr_, QSharedPointer<QList<MainWindowItem*>> configItems_, QSharedPointer<std::map<std::string,TunnelConfig*>> tunnelConfigs_) :
|
SaverImpl::SaverImpl(MainWindow *mainWindowPtr_, QList<MainWindowItem*>* configItems_, std::map<std::string,TunnelConfig*>* tunnelConfigs_) :
|
||||||
configItems(configItems_), tunnelConfigs(tunnelConfigs_), confpath(), tunconfpath(), mainWindowPtr(mainWindowPtr_)
|
configItems(configItems_), tunnelConfigs(tunnelConfigs_), confpath(), tunconfpath(), mainWindowPtr(mainWindowPtr_)
|
||||||
{}
|
{
|
||||||
|
QObject::connect(this, SIGNAL(showPreventedSaveTunnelsConfMessage()), mainWindowPtr, SLOT(showTunnelsPagePreventedMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
SaverImpl::~SaverImpl() {}
|
SaverImpl::~SaverImpl() {}
|
||||||
|
|
||||||
@ -37,7 +39,9 @@ bool SaverImpl::save(bool reloadAfterSave, const FocusEnum focusOn, const std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
//save tunnels config
|
//save tunnels config
|
||||||
{
|
if (mainWindowPtr->isPreventSaveTunnelsMode()) {
|
||||||
|
emit showPreventedSaveTunnelsConfMessage();
|
||||||
|
}else{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
for (std::map<std::string,TunnelConfig*>::iterator it=tunnelConfigs->begin(); it!=tunnelConfigs->end(); ++it) {
|
for (std::map<std::string,TunnelConfig*>::iterator it=tunnelConfigs->begin(); it!=tunnelConfigs->end(); ++it) {
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "QList"
|
#include "QList"
|
||||||
#include "QSharedPointer"
|
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "TunnelConfig.h"
|
#include "TunnelConfig.h"
|
||||||
@ -15,17 +14,16 @@
|
|||||||
class MainWindowItem;
|
class MainWindowItem;
|
||||||
class TunnelConfig;
|
class TunnelConfig;
|
||||||
|
|
||||||
class SaverImpl : public Saver
|
class SaverImpl : public Saver {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
SaverImpl(MainWindow *mainWindowPtr_, QSharedPointer<QList<MainWindowItem*>> configItems_, QSharedPointer<std::map<std::string,TunnelConfig*>> tunnelConfigs_);
|
SaverImpl(MainWindow *mainWindowPtr_, QList<MainWindowItem*>* configItems_, std::map<std::string,TunnelConfig*>* tunnelConfigs_);
|
||||||
virtual ~SaverImpl();
|
virtual ~SaverImpl();
|
||||||
virtual bool save(bool reloadAfterSave, const FocusEnum focusOn, const std::string& tunnelNameToFocus, QWidget* widgetToFocus);
|
virtual bool save(bool reloadAfterSave, const FocusEnum focusOn, const std::string& tunnelNameToFocus, QWidget* widgetToFocus);
|
||||||
void setConfPath(QString& confpath_);
|
void setConfPath(QString& confpath_);
|
||||||
void setTunnelsConfPath(QString& tunconfpath_);
|
void setTunnelsConfPath(QString& tunconfpath_);
|
||||||
private:
|
private:
|
||||||
QSharedPointer<QList<MainWindowItem*>> configItems;
|
QList<MainWindowItem*>* configItems;
|
||||||
QSharedPointer<std::map<std::string,TunnelConfig*>> tunnelConfigs;
|
std::map<std::string,TunnelConfig*>* tunnelConfigs;
|
||||||
QString confpath;
|
QString confpath;
|
||||||
QString tunconfpath;
|
QString tunconfpath;
|
||||||
MainWindow* mainWindowPtr;
|
MainWindow* mainWindowPtr;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <QStyleHints>
|
#include <QStyleHints>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -68,10 +69,11 @@ MainWindow::MainWindow(std::shared_ptr<std::iostream> logStream_, QWidget *paren
|
|||||||
,tunconfpath()
|
,tunconfpath()
|
||||||
,tunnelConfigs()
|
,tunnelConfigs()
|
||||||
,tunnelsPageUpdateListener(this)
|
,tunnelsPageUpdateListener(this)
|
||||||
|
,preventSaveTunnelsBool(false)
|
||||||
,saverPtr(
|
,saverPtr(
|
||||||
new SaverImpl(this,
|
new SaverImpl(this,
|
||||||
QSharedPointer<QList<MainWindowItem*>>(&configItems),
|
&configItems,
|
||||||
QSharedPointer<std::map<std::string,TunnelConfig*>>(&tunnelConfigs)))
|
&tunnelConfigs))
|
||||||
|
|
||||||
{
|
{
|
||||||
assert(delayedSaveManagerPtr!=nullptr);
|
assert(delayedSaveManagerPtr!=nullptr);
|
||||||
@ -778,6 +780,10 @@ void MainWindow::loadAllConfigs(SaverImpl* saverPtr){
|
|||||||
|
|
||||||
void MainWindow::DisableTunnelsPage() {
|
void MainWindow::DisableTunnelsPage() {
|
||||||
ui->tunnelsScrollAreaWidgetContents->setEnabled(false);
|
ui->tunnelsScrollAreaWidgetContents->setEnabled(false);
|
||||||
|
ui->tunnelsScrollArea->setEnabled(false);
|
||||||
|
ui->addClientTunnelPushButton->setEnabled(false);
|
||||||
|
ui->addServerTunnelPushButton->setEnabled(false);
|
||||||
|
preventSaveTunnels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::layoutTunnels() {
|
void MainWindow::layoutTunnels() {
|
||||||
@ -1135,3 +1141,14 @@ void MainWindow::syncLogLevel (int /*comboBoxIndex*/) {
|
|||||||
i2p::log::Logger().Reopen ();
|
i2p::log::Logger().Reopen ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::preventSaveTunnels() {
|
||||||
|
preventSaveTunnelsBool = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::isPreventSaveTunnelsMode() {
|
||||||
|
return preventSaveTunnelsBool;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::showTunnelsPagePreventedMessage() {
|
||||||
|
QMessageBox::critical(this,QObject::tr("Error"),QObject::tr("Not saving tunnels configuration due to previous errors with it."));
|
||||||
|
}
|
||||||
|
@ -500,6 +500,8 @@ public:
|
|||||||
Ui::GeneralSettingsContentsForm* uiSettings;
|
Ui::GeneralSettingsContentsForm* uiSettings;
|
||||||
void adjustSizesAccordingToWrongLabel();
|
void adjustSizesAccordingToWrongLabel();
|
||||||
bool applyTunnelsUiToConfigs();
|
bool applyTunnelsUiToConfigs();
|
||||||
|
void preventSaveTunnels();
|
||||||
|
bool isPreventSaveTunnelsMode();
|
||||||
private:
|
private:
|
||||||
int settingsTitleLabelNominalHeight;
|
int settingsTitleLabelNominalHeight;
|
||||||
TextBrowserTweaked1 * textBrowser;
|
TextBrowserTweaked1 * textBrowser;
|
||||||
@ -894,9 +896,13 @@ private:
|
|||||||
|
|
||||||
//void onLoggingOptionsChange() {}
|
//void onLoggingOptionsChange() {}
|
||||||
|
|
||||||
|
bool preventSaveTunnelsBool;
|
||||||
SaverImpl* saverPtr;
|
SaverImpl* saverPtr;
|
||||||
|
|
||||||
void DisableTunnelsPage();
|
void DisableTunnelsPage();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void showTunnelsPagePreventedMessage();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user