mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 14:23:36 -05:00
improved login of on/off and parameter display in webui/jsonapi config pages
This commit is contained in:
parent
d83f0125f3
commit
c877a6e5c8
@ -29,6 +29,8 @@
|
|||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
|
|
||||||
|
#define IMAGE_LEDOFF ":/images/ledoff1.png"
|
||||||
|
#define IMAGE_LEDON ":/images/ledon1.png"
|
||||||
|
|
||||||
JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||||
{
|
{
|
||||||
@ -122,7 +124,19 @@ void JsonApiPage::load()
|
|||||||
QString::fromStdString(it.first) + ":" +
|
QString::fromStdString(it.first) + ":" +
|
||||||
QString::fromStdString(it.second) );
|
QString::fromStdString(it.second) );
|
||||||
|
|
||||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
||||||
|
|
||||||
|
QStringList newTk2;
|
||||||
|
|
||||||
|
for(const auto& it : rsJsonApi->getResourceProviders())
|
||||||
|
newTk2.push_back( QString::fromStdString(it.get().getName())) ;
|
||||||
|
|
||||||
|
whileBlocking(ui.providersListView)->setModel(new QStringListModel(newTk2));
|
||||||
|
|
||||||
|
if(rsJsonApi->isRunning())
|
||||||
|
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ;
|
||||||
|
else
|
||||||
|
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonApiPage::checkStartJsonApi()
|
bool JsonApiPage::checkStartJsonApi()
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/qtthreadsutils.h"
|
||||||
#include "retroshare/rswebui.h"
|
#include "retroshare/rswebui.h"
|
||||||
#include "retroshare/rsjsonapi.h"
|
#include "retroshare/rsjsonapi.h"
|
||||||
|
|
||||||
@ -40,6 +41,8 @@ resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0;
|
|||||||
#endif
|
#endif
|
||||||
resource_api::RsControlModule* WebuiPage::controlModule = 0;
|
resource_api::RsControlModule* WebuiPage::controlModule = 0;
|
||||||
|
|
||||||
|
#define IMAGE_LEDOFF ":/images/ledoff1.png"
|
||||||
|
#define IMAGE_LEDON ":/images/ledon1.png"
|
||||||
|
|
||||||
WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||||
{
|
{
|
||||||
@ -50,6 +53,15 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
|||||||
connect(ui.password_LE, SIGNAL(textChanged(QString)), this, SLOT(onPasswordValueChanged(QString)));
|
connect(ui.password_LE, SIGNAL(textChanged(QString)), this, SLOT(onPasswordValueChanged(QString)));
|
||||||
connect(ui.startWebBrowser_PB, SIGNAL(clicked()), this, SLOT(onStartWebBrowserClicked()));
|
connect(ui.startWebBrowser_PB, SIGNAL(clicked()), this, SLOT(onStartWebBrowserClicked()));
|
||||||
connect(ui.webInterfaceFilesDirectory_PB, SIGNAL(clicked()), this, SLOT(selectWebInterfaceDirectory()));
|
connect(ui.webInterfaceFilesDirectory_PB, SIGNAL(clicked()), this, SLOT(selectWebInterfaceDirectory()));
|
||||||
|
|
||||||
|
mEventsHandlerId = 0;
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> /* event */)
|
||||||
|
{
|
||||||
|
std::cerr << "Caught JSONAPI event in webui!" << std::endl;
|
||||||
|
RsQThreadUtils::postToObject([=]() { load(); }, this );
|
||||||
|
},
|
||||||
|
mEventsHandlerId, RsEventType::JSON_API );
|
||||||
}
|
}
|
||||||
|
|
||||||
WebuiPage::~WebuiPage()
|
WebuiPage::~WebuiPage()
|
||||||
@ -127,6 +139,13 @@ void WebuiPage::loadParams()
|
|||||||
|
|
||||||
if(it != smap.end())
|
if(it != smap.end())
|
||||||
whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second));
|
whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second));
|
||||||
|
|
||||||
|
if(rsWebUi->isRunning() && rsJsonApi->isRunning())
|
||||||
|
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ;
|
||||||
|
else
|
||||||
|
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ;
|
||||||
|
#else
|
||||||
|
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +191,6 @@ QString WebuiPage::helpText() const
|
|||||||
void WebuiPage::onEnableCBClicked(bool checked)
|
void WebuiPage::onEnableCBClicked(bool checked)
|
||||||
{
|
{
|
||||||
ui.params_GB->setEnabled(checked);
|
ui.params_GB->setEnabled(checked);
|
||||||
ui.apply_PB->setEnabled(checked);
|
|
||||||
ui.startWebBrowser_PB->setEnabled(checked);
|
ui.startWebBrowser_PB->setEnabled(checked);
|
||||||
QString S;
|
QString S;
|
||||||
}
|
}
|
||||||
@ -203,6 +221,7 @@ void WebuiPage::onApplyClicked()
|
|||||||
else
|
else
|
||||||
checkShutdownWebui();
|
checkShutdownWebui();
|
||||||
}
|
}
|
||||||
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebuiPage::onStartWebBrowserClicked() { showWebui(); }
|
void WebuiPage::onStartWebBrowserClicked() { showWebui(); }
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "retroshare/rsevents.h"
|
||||||
|
|
||||||
#include "retroshare-gui/configpage.h"
|
#include "retroshare-gui/configpage.h"
|
||||||
#include "gui/common/FilesDefs.h"
|
#include "gui/common/FilesDefs.h"
|
||||||
#include "ui_WebuiPage.h"
|
#include "ui_WebuiPage.h"
|
||||||
@ -82,4 +84,6 @@ private:
|
|||||||
static resource_api::ApiServerLocal* apiServerLocal;
|
static resource_api::ApiServerLocal* apiServerLocal;
|
||||||
#endif
|
#endif
|
||||||
static resource_api::RsControlModule* controlModule;
|
static resource_api::RsControlModule* controlModule;
|
||||||
|
|
||||||
|
RsEventsHandlerId_t mEventsHandlerId;
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>Status:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user