mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
dbhub: Fix branch list in push dialog
The JSON format generated by the server has changed.
This commit is contained in:
@@ -188,14 +188,18 @@ void RemoteDatabase::gotReply(QNetworkReply* reply)
|
||||
if(json.isNull() || !json.isObject())
|
||||
break;
|
||||
QJsonObject obj = json.object();
|
||||
QJsonObject obj_branches = obj["branches"].toObject();
|
||||
|
||||
// Parse data and assemble branch list
|
||||
QStringList branches;
|
||||
for(auto it=obj.constBegin();it!=obj.constEnd();++it)
|
||||
for(auto it=obj_branches.constBegin();it!=obj_branches.constEnd();++it)
|
||||
branches.append(it.key());
|
||||
|
||||
// Get default branch
|
||||
QString default_branch = obj["default_branch"].toString("master");
|
||||
|
||||
// Send branch list to anyone who is interested
|
||||
emit gotBranchList(branches);
|
||||
emit gotBranchList(branches, default_branch);
|
||||
break;
|
||||
}
|
||||
case RequestTypePush:
|
||||
|
||||
@@ -58,7 +58,7 @@ signals:
|
||||
void gotDirList(QString json, QVariant userdata);
|
||||
void gotCurrentVersion(QString version, QString url);
|
||||
void gotLicenceList(QMap<QString, QString> licences);
|
||||
void gotBranchList(QStringList branches);
|
||||
void gotBranchList(QStringList branches, QString default_branch);
|
||||
|
||||
// The uploadFinished() signal is emitted when a push() call is finished, i.e. a database upload has completed.
|
||||
void uploadFinished(QString url);
|
||||
|
||||
@@ -99,16 +99,16 @@ void RemotePushDialog::fillInLicences(const QMap<QString, QString>& licences)
|
||||
ui->comboLicence->addItem(it.value(), it.key());
|
||||
}
|
||||
|
||||
void RemotePushDialog::fillInBranches(const QStringList& branches)
|
||||
void RemotePushDialog::fillInBranches(const QStringList& branches, const QString& default_branch)
|
||||
{
|
||||
// Clear branch list and add the default master branch
|
||||
// Clear branch list and add the default branch
|
||||
ui->comboBranch->clear();
|
||||
ui->comboBranch->addItem("master");
|
||||
ui->comboBranch->addItem(default_branch);
|
||||
|
||||
// Add rest of the branch list to the combo box
|
||||
foreach(const QString& branch, branches)
|
||||
{
|
||||
if(branch != "master")
|
||||
if(branch != default_branch)
|
||||
ui->comboBranch->addItem(branch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ protected slots:
|
||||
void reloadBranchList();
|
||||
|
||||
void fillInLicences(const QMap<QString, QString>& licences);
|
||||
void fillInBranches(const QStringList& branches);
|
||||
void fillInBranches(const QStringList& branches, const QString& default_branch);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -105,6 +105,9 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user