diff --git a/src/RemoteDatabase.cpp b/src/RemoteDatabase.cpp index 8f4a329d..f054888c 100644 --- a/src/RemoteDatabase.cpp +++ b/src/RemoteDatabase.cpp @@ -346,7 +346,7 @@ void RemoteDatabase::gotReply(QNetworkReply* reply) } // Send data list to anyone who is interested - emit gotMetadata(branches, obj_commits.dump(), releases, tags, default_branch); + emit gotMetadata(branches, obj_commits.dump(), releases, tags, default_branch, obj["web_page"]); break; } } diff --git a/src/RemoteDatabase.h b/src/RemoteDatabase.h index f85e0eb8..18b02dce 100644 --- a/src/RemoteDatabase.h +++ b/src/RemoteDatabase.h @@ -155,7 +155,7 @@ signals: void gotBranchList(std::vector branches, std::string default_branch); void gotMetadata(std::vector branches, std::string commits, std::vector releases, std::vector tags, - std::string default_branch); + std::string default_branch, std::string web_page); // The uploadFinished() signal is emitted when a push() call is finished, i.e. a database upload has completed. void uploadFinished(std::string url); diff --git a/src/RemoteDock.cpp b/src/RemoteDock.cpp index 1a3b23cf..36e1baed 100644 --- a/src/RemoteDock.cpp +++ b/src/RemoteDock.cpp @@ -208,6 +208,7 @@ void RemoteDock::enableButtons() ui->buttonCloneDatabase->setEnabled(logged_in); ui->buttonPushDatabase->setEnabled(db_opened && logged_in); + ui->actionDatabaseOpenBrowser->setEnabled(db_opened && logged_in); } void RemoteDock::pushDatabase() @@ -366,10 +367,14 @@ void RemoteDock::refreshMetadata(const QString& username, const QString& dbname) void RemoteDock::showMetadata(const std::vector& branches, const std::string& commits, const std::vector& releases, const std::vector& tags, - const std::string& /*default_branch*/) + const std::string& /*default_branch*/, const std::string& web_page) { + // Store all the commit information as-is current_commit_json = commits; + // Store the link to the web page in the action for opening that link in a browser + ui->actionDatabaseOpenBrowser->setData(QString::fromStdString(web_page)); + // Fill branches combo box ui->comboDatabaseBranch->clear(); for(const auto& branch : branches) @@ -409,3 +414,8 @@ void RemoteDock::deleteLocalDatabase(const QModelIndex& index) // Delete the file remoteLocalFilesModel->removeRow(index.row(), index.parent()); } + +void RemoteDock::openCurrentDatabaseInBrowser() const +{ + QDesktopServices::openUrl(ui->actionDatabaseOpenBrowser->data().toUrl()); +} diff --git a/src/RemoteDock.h b/src/RemoteDock.h index 9d5838bc..0f6d81b5 100644 --- a/src/RemoteDock.h +++ b/src/RemoteDock.h @@ -44,8 +44,9 @@ private slots: void openLocalFile(const QModelIndex& idx); void showMetadata(const std::vector& branches, const std::string& commits, const std::vector& releases, const std::vector& tags, - const std::string& default_branch); + const std::string& default_branch, const std::string& web_page); void deleteLocalDatabase(const QModelIndex& index); + void openCurrentDatabaseInBrowser() const; signals: void openFile(QString file); diff --git a/src/RemoteDock.ui b/src/RemoteDock.ui index 5e371776..445bc03f 100644 --- a/src/RemoteDock.ui +++ b/src/RemoteDock.ui @@ -7,7 +7,7 @@ 0 0 534 - 357 + 379 @@ -123,6 +123,18 @@ DBHub.io + + 2 + + + 0 + + + 2 + + + 0 + @@ -137,6 +149,18 @@ Local + + 2 + + + 0 + + + 2 + + + 0 + @@ -151,6 +175,29 @@ Current Database + + 2 + + + 0 + + + 2 + + + 0 + + + + + false + + + false + + + + @@ -217,6 +264,18 @@ Commits + + 2 + + + 0 + + + 2 + + + 0 + @@ -354,6 +413,18 @@ Delete the local clone of this database + + + + :/icons/browser_open:/icons/browser_open + + + Open in web browser + + + Open the web page for the current database in your browser + + comboUser @@ -466,6 +537,22 @@ + + actionDatabaseOpenBrowser + triggered() + RemoteDock + openCurrentDatabaseInBrowser() + + + -1 + -1 + + + 266 + 189 + + + setNewIdentity(QString) @@ -474,5 +561,6 @@ switchToMainView() openLocalFile(QModelIndex) fetchDatabase() + openCurrentDatabaseInBrowser()