}
+void Client::onDbUpgradeInProgress(bool inProgress)
+{
+ emit dbUpgradeInProgress(inProgress);
+}
+
+
/*** Network handling ***/
QList<NetworkId> Client::networkIds()
void requestKickClient(int peerId);
void passwordChanged(bool success);
+ //! Emitted when database schema upgrade starts or ends (only mono client)
+ void dbUpgradeInProgress(bool inProgress);
+
public slots:
void disconnectFromCore();
void markBufferAsRead(BufferId id);
+ void onDbUpgradeInProgress(bool inProgress);
+
private slots:
void setSyncedToCore();
void setDisconnectedFromCore();
InternalPeer *peer = new InternalPeer();
_peer = peer;
Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership
+ emit connectionMsg(tr("Initializing..."));
emit connectToInternalCore(peer);
setState(Connected);
return;
}
if (installedSchemaVersion() < schemaVersion()) {
- qWarning() << qPrintable(tr("Installed Schema (version %1) is not up to date. Upgrading to "
- "version %2... This may take a while for major upgrades."
- ).arg(installedSchemaVersion()).arg(schemaVersion()));
- // TODO: The monolithic client won't show this message unless one looks into the debug log.
- // This should be made more friendly, e.g. a popup message in the GUI.
- if (!upgradeDb()) {
+ quInfo() << qPrintable(tr("Installed database schema (version %1) is not up to date. Upgrading to "
+ "version %2... This may take a while for major upgrades."
+ ).arg(installedSchemaVersion()).arg(schemaVersion()));
+ emit dbUpgradeInProgress(true);
+ auto upgradeResult = upgradeDb();
+ emit dbUpgradeInProgress(false);
+ if (!upgradeResult) {
qWarning() << qPrintable(tr("Upgrade failed..."));
return NotAvailable;
}
- // Warning messages are also sent to the console, while Info messages aren't. Add a message
- // when migration succeeds to avoid confusing folks by implying the schema upgrade failed if
+ // Add a message when migration succeeds to avoid confusing folks by implying the schema upgrade failed if
// later functionality does not work.
- qWarning() << qPrintable(tr("Installed Schema successfully upgraded to version %1."
- ).arg(schemaVersion()));
+ quInfo() << qPrintable(tr("Installed database schema successfully upgraded to version %1.").arg(schemaVersion()));
}
quInfo() << qPrintable(displayName()) << "storage backend is ready. Schema version:" << installedSchemaVersion();
return false;
}
+ connect(storage.get(), SIGNAL(dbUpgradeInProgress(bool)), this, SIGNAL(dbUpgradeInProgress(bool)));
+
Storage::State storageState = storage->init(settings, environment, loadFromEnvironment);
switch (storageState) {
case Storage::NeedsSetup:
//! Relay from CoreSession::sessionState(). Used for internal connection only
void sessionState(const Protocol::SessionState &sessionState);
+ //! Emitted when database schema upgrade starts or ends
+ void dbUpgradeInProgress(bool inProgress);
+
public slots:
bool init();
//! Sent when a user has been removed
void userRemoved(UserId);
+ //! Emitted when database schema upgrade starts or ends
+ void dbUpgradeInProgress(bool inProgress);
+
protected:
QString hashPassword(const QString &password);
bool checkHashedPassword(const UserId user, const QString &password, const QString &hashedPassword, const Storage::HashVersion version);
connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showNetworkConfig(NetworkId)), SLOT(showNetworkConfig(NetworkId)));
connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString)));
connect(Client::instance(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString)));
+ connect(Client::instance(), SIGNAL(dbUpgradeInProgress(bool)), SLOT(showMigrationWarning(bool)));
connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList, QVariantList)), SLOT(showCoreConfigWizard(QVariantList, QVariantList)));
connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString)));
}
+void MainWin::showMigrationWarning(bool show)
+{
+ if (show && !_migrationWarning) {
+ _migrationWarning = new QMessageBox(QMessageBox::Information,
+ tr("Upgrading..."),
+ "<b>" + tr("Your database is being upgraded") + "</b>",
+ QMessageBox::NoButton, this);
+ _migrationWarning->setInformativeText("<p>"
+ + tr("In order to support new features, we need to make changes to your backlog database. This may take a long while.")
+ + "</p><p>"
+ + tr("Do not exit Quassel until the upgrade is complete!")
+ + "</p>");
+ _migrationWarning->setStandardButtons(QMessageBox::NoButton);
+ _migrationWarning->show();
+ }
+ else if (!show && _migrationWarning) {
+ _migrationWarning->close();
+ _migrationWarning->deleteLater();
+ _migrationWarning = nullptr;
+ }
+}
+
+
void MainWin::changeActiveBufferView(bool backwards)
{
if (_activeBufferViewIndex >= 0 && _activeBufferViewIndex < _bufferViews.count()) {
class SystemTray;
class TopicWidget;
-class QMenu;
class QLabel;
+class QMenu;
+class QMessageBox;
class QToolBar;
class KHelpMenu;
void nextBuffer();
void previousBuffer();
+ void showMigrationWarning(bool show);
+
//! Quit application
void quit();
QWidget *_awayLog;
+ QMessageBox* _migrationWarning{nullptr};
+
bool _layoutLoaded;
QSize _normalSize; //!< Size of the non-maximized window
connect(this, SIGNAL(connectInternalPeer(QPointer<InternalPeer>)), _core, SLOT(connectInternalPeer(QPointer<InternalPeer>)));
connect(_core, SIGNAL(sessionState(Protocol::SessionState)), Client::coreConnection(), SLOT(internalSessionStateReceived(Protocol::SessionState)));
+ connect(_core, SIGNAL(dbUpgradeInProgress(bool)), Client::instance(), SLOT(onDbUpgradeInProgress(bool)));
+
_coreThread.start();
}