dbhub: Add link to webUI page of currently opened database · anandsanto/sqlitebrowser@12ba01f · GitHub
Skip to content

Commit 12ba01f

Browse files
committed
dbhub: Add link to webUI page of currently opened database
Add a toolbar to the Current Database tab of the Remote dock with one button for now. This button opens the web page of the currently opened database in the browser. Also reduce the margins in the Remote dock a bit.
1 parent 595d845 commit 12ba01f

5 files changed

Lines changed: 104 additions & 5 deletions

File tree

‎src/RemoteDatabase.cpp‎

Lines changed: 1 addition & 1 deletion

‎src/RemoteDatabase.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class RemoteDatabase : public QObject
155155
void gotBranchList(std::vector<std::string> branches, std::string default_branch);
156156
void gotMetadata(std::vector<RemoteMetadataBranchInfo> branches, std::string commits,
157157
std::vector<RemoteMetadataReleaseInfo> releases, std::vector<RemoteMetadataReleaseInfo> tags,
158-
std::string default_branch);
158+
std::string default_branch, std::string web_page);
159159

160160
// The uploadFinished() signal is emitted when a push() call is finished, i.e. a database upload has completed.
161161
void uploadFinished(std::string url);

‎src/RemoteDock.cpp‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ void RemoteDock::enableButtons()
208208

209209
ui->buttonCloneDatabase->setEnabled(logged_in);
210210
ui->buttonPushDatabase->setEnabled(db_opened && logged_in);
211+
ui->actionDatabaseOpenBrowser->setEnabled(db_opened && logged_in);
211212
}
212213

213214
void RemoteDock::pushDatabase()
@@ -366,10 +367,14 @@ void RemoteDock::refreshMetadata(const QString& username, const QString& dbname)
366367

367368
void RemoteDock::showMetadata(const std::vector<RemoteMetadataBranchInfo>& branches, const std::string& commits,
368369
const std::vector<RemoteMetadataReleaseInfo>& releases, const std::vector<RemoteMetadataReleaseInfo>& tags,
369-
const std::string& /*default_branch*/)
370+
const std::string& /*default_branch*/, const std::string& web_page)
370371
{
372+
// Store all the commit information as-is
371373
current_commit_json = commits;
372374

375+
// Store the link to the web page in the action for opening that link in a browser
376+
ui->actionDatabaseOpenBrowser->setData(QString::fromStdString(web_page));
377+
373378
// Fill branches combo box
374379
ui->comboDatabaseBranch->clear();
375380
for(const auto& branch : branches)
@@ -409,3 +414,8 @@ void RemoteDock::deleteLocalDatabase(const QModelIndex& index)
409414
// Delete the file
410415
remoteLocalFilesModel->removeRow(index.row(), index.parent());
411416
}
417+
418+
void RemoteDock::openCurrentDatabaseInBrowser() const
419+
{
420+
QDesktopServices::openUrl(ui->actionDatabaseOpenBrowser->data().toUrl());
421+
}

‎src/RemoteDock.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ private slots:
4444
void openLocalFile(const QModelIndex& idx);
4545
void showMetadata(const std::vector<RemoteMetadataBranchInfo>& branches, const std::string& commits,
4646
const std::vector<RemoteMetadataReleaseInfo>& releases, const std::vector<RemoteMetadataReleaseInfo>& tags,
47-
const std::string& default_branch);
47+
const std::string& default_branch, const std::string& web_page);
4848
void deleteLocalDatabase(const QModelIndex& index);
49+
void openCurrentDatabaseInBrowser() const;
4950

5051
signals:
5152
void openFile(QString file);

‎src/RemoteDock.ui‎

Lines changed: 89 additions & 1 deletion

0 commit comments

Comments
 (0)