Removing the legacy widgets too.
case QAbstractSocket::ConnectingState:
state = Connecting;
break;
- case QAbstractSocket::ConnectedState:
- state = Connected;
- break;
default:
state = Disconnected;
}
sessionStateReceived(msg["SessionState"].toMap());
break; // this is definitively the last message we process here!
} else {
- emit connectionError(tr("<b>Invalid data received from core!</b><br>Disconnecting."));
+ emit connectionError(tr("Invalid data received from core, disconnecting."));
disconnectFromCore();
return;
}
#endif /* HAVE_SSL */
void CoreConnection::connectionReady() {
+ setState(Connected);
+ emit connectionMsg(tr("Connected to %1").arg(currentAccount().accountName()));
+
if(!_coreMsgBuffer["Configured"].toBool()) {
// start wizard
emit startCoreSetup(_coreMsgBuffer["StorageBackends"].toList());
void CoreConnection::checkSyncState() {
if(_netsToSync.isEmpty()) {
setState(Synchronized);
- setProgressText(QString());
+ setProgressText(tr("Synchronized to %1").arg(currentAccount().accountName()));
setProgressMaximum(-1);
emit synchronized();
}
coreconfigwizardstorageselectionpage.ui
coreconfigwizardsyncpage.ui
coreconnectauthdlg.ui
+ coreconnectionstatuswidget.ui
coreinfodlg.ui
debugbufferviewoverlay.ui
debugconsole.ui
#include "coreconnectionstatuswidget.h"
#include "client.h"
-#include "coreconnection.h"
#include "iconloader.h"
+#include "signalproxy.h"
CoreConnectionStatusWidget::CoreConnectionStatusWidget(CoreConnection *connection, QWidget *parent)
: QWidget(parent),
_coreConnection(connection)
{
ui.setupUi(this);
+ ui.lagLabel->hide();
+ ui.sslLabel->hide();
update();
connect(coreConnection(), SIGNAL(progressTextChanged(QString)), ui.messageLabel, SLOT(setText(QString)));
connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), ui.progressBar, SLOT(setRange(int, int)));
connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int)));
+ connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState)));
connect(coreConnection(), SIGNAL(connectionError(QString)), ui.messageLabel, SLOT(setText(QString)));
+ connect(Client::signalProxy(), SIGNAL(lagUpdated(int)), SLOT(updateLag(int)));
}
void CoreConnectionStatusWidget::update() {
ui.progressBar->hide();
ui.messageLabel->setText(conn->progressText());
+}
+
+void CoreConnectionStatusWidget::updateLag(int msecs) {
+ if(msecs >= 0) {
+ ui.lagLabel->setText(tr("(Lag: %1 ms)").arg(msecs));
+ if(!ui.lagLabel->isVisible())
+ ui.lagLabel->show();
+ } else {
+ if(ui.lagLabel->isVisible())
+ ui.lagLabel->hide();
+ }
+}
+void CoreConnectionStatusWidget::connectionStateChanged(CoreConnection::ConnectionState state) {
+ if(state >= CoreConnection::Connected) {
+ if(coreConnection()->isEncrypted()) {
+ ui.sslLabel->setPixmap(SmallIcon("security-high"));
+ ui.sslLabel->setToolTip(tr("The connection to your core is encrypted with SSL."));
+ } else {
+ ui.sslLabel->setPixmap(SmallIcon("security-low"));
+ ui.sslLabel->setToolTip(tr("The connection to your core is not encrypted."));
+ }
+ ui.sslLabel->show();
+ } else
+ ui.sslLabel->hide();
}
void CoreConnectionStatusWidget::progressRangeChanged(int min, int max) {
#include "ui_coreconnectionstatuswidget.h"
-class CoreConnection;
+#include "coreconnection.h"
class CoreConnectionStatusWidget : public QWidget {
Q_OBJECT
public slots:
void update();
+ void updateLag(int msecs);
+
private slots:
+ void connectionStateChanged(CoreConnection::ConnectionState);
void progressRangeChanged(int min, int max);
private:
#else
: QMainWindow(parent),
#endif
- coreLagLabel(new QLabel()),
- sslLabel(new QLabel()),
_msgProcessorStatusWidget(new MsgProcessorStatusWidget(this)),
_coreConnectionStatusWidget(new CoreConnectionStatusWidget(Client::coreConnection(), this)),
_titleSetter(this),
_coreConnectionStatusWidget->update();
statusBar()->addPermanentWidget(_coreConnectionStatusWidget);
- // Core Lag:
- updateLagIndicator();
- statusBar()->addPermanentWidget(coreLagLabel);
- coreLagLabel->hide();
- connect(Client::signalProxy(), SIGNAL(lagUpdated(int)), this, SLOT(updateLagIndicator(int)));
-
- // SSL indicator
- sslLabel->setPixmap(QPixmap());
- statusBar()->addPermanentWidget(sslLabel);
- sslLabel->hide();
-
QAction *showStatusbar = QtUi::actionCollection("General")->action("ToggleStatusBar");
QtUiSettings uiSettings;
else
statusBar()->clearMessage();
- if(Client::signalProxy()->isSecure()) {
- sslLabel->setPixmap(SmallIcon("security-high"));
- } else {
- sslLabel->setPixmap(SmallIcon("security-low"));
- }
-
- sslLabel->setVisible(!Client::internalCore());
- coreLagLabel->setVisible(!Client::internalCore());
+ _coreConnectionStatusWidget->setVisible(!Client::internalCore());
updateIcon();
systemTray()->setState(SystemTray::Active);
if(accountId > 0) s.setValue(QString("MainWinState-%1").arg(accountId) , saveState(accountId));
}
-void MainWin::updateLagIndicator(int lag) {
- QString text = tr("Core Lag: %1");
- if(lag == -1)
- text = text.arg('-');
- else
- text = text.arg("%1 msec").arg(lag);
- coreLagLabel->setText(text);
-}
-
void MainWin::disconnectedFromCore() {
// save core specific layout and remove bufferviews;
saveLayout();
coll->action("CoreInfo")->setEnabled(false);
//_viewMenu->setEnabled(false);
statusBar()->showMessage(tr("Not connected to core."));
- sslLabel->setPixmap(QPixmap());
- sslLabel->hide();
- updateLagIndicator();
- coreLagLabel->hide();
if(_msgProcessorStatusWidget)
_msgProcessorStatusWidget->setProgress(0, 0);
updateIcon();
protected slots:
void connectedToCore();
void setConnectedState();
- void updateLagIndicator(int lag = -1);
void disconnectedFromCore();
void setDisconnectedState();
KHelpMenu *_kHelpMenu;
#endif
- QLabel *coreLagLabel;
- QLabel *sslLabel;
MsgProcessorStatusWidget *_msgProcessorStatusWidget;
CoreConnectionStatusWidget *_coreConnectionStatusWidget;
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
- <property name="margin">
+ <property name="leftMargin">
+ <number>4</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>4</number>
+ </property>
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
</property>
</widget>
</item>
+ <item>
+ <widget class="QLabel" name="lagLabel">
+ <property name="text">
+ <string notr="true">Lag: n/a</string>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QLabel" name="sslLabel">
<property name="text">