Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (16)
Tags (31)
master
coverity_scan
v3.11.x
issue1831_v1
qdarkstyle
no_savepoints_ro_db
v3.10.x
v3.9.x
v3.6.x
v3.5.x
v3.4.x
v3.3.x
utf8grammar
sqlb-3.2.x
sqlb-3.1.x
sqlb-3.x
continuous
v3.11.2
v3.11.1v2
v3.11.1
v3.11.0
v3.11.0-beta3
v3.11.0-beta2
v3.11.0-beta1
v3.11.0-alpha1
v3.10.1
v3.10.0
v3.10.0-beta2
v3.10.0-beta1
v3.9.1
v3.9.0
v3.9.0-beta1
v3.8.0
v3.7.0
v3.6.0
v3.5.1
master
Branches (16)
Tags (31)
master
coverity_scan
v3.11.x
issue1831_v1
qdarkstyle
no_savepoints_ro_db
v3.10.x
v3.9.x
v3.6.x
v3.5.x
v3.4.x
v3.3.x
utf8grammar
sqlb-3.2.x
sqlb-3.1.x
sqlb-3.x
continuous
v3.11.2
v3.11.1v2
v3.11.1
v3.11.0
v3.11.0-beta3
v3.11.0-beta2
v3.11.0-beta1
v3.11.0-alpha1
v3.10.1
v3.10.0
v3.10.0-beta2
v3.10.0-beta1
v3.9.1
v3.9.0
v3.9.0-beta1
v3.8.0
v3.7.0
v3.6.0
v3.5.1
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (16)
Tags (31)
master
coverity_scan
v3.11.x
issue1831_v1
qdarkstyle
no_savepoints_ro_db
v3.10.x
v3.9.x
v3.6.x
v3.5.x
v3.4.x
v3.3.x
utf8grammar
sqlb-3.2.x
sqlb-3.1.x
sqlb-3.x
continuous
v3.11.2
v3.11.1v2
v3.11.1
v3.11.0
v3.11.0-beta3
v3.11.0-beta2
v3.11.0-beta1
v3.11.0-alpha1
v3.10.1
v3.10.0
v3.10.0-beta2
v3.10.0-beta1
v3.9.1
v3.9.0
v3.9.0-beta1
v3.8.0
v3.7.0
v3.6.0
v3.5.1
sqlitebrowser
/
src
/
RemotePushDialog.cpp
sqlitebrowser
/
src
/
RemotePushDialog.cpp
RemotePushDialog.cpp 4.37 KB
Copy Edit Raw Blame History
#include <QPushButton>
#include <QUrlQuery>
#include <QRegExpValidator>
#include "RemotePushDialog.h"
#include "ui_RemotePushDialog.h"
#include "RemoteDatabase.h"
RemotePushDialog::RemotePushDialog(QWidget* parent, RemoteDatabase& remote, const QString& host, const QString& clientCert, const QString& name) :
QDialog(parent),
ui(new Ui::RemotePushDialog),
m_host(host),
m_clientCert(clientCert),
remoteDatabase(remote),
m_nameValidator(new QRegExpValidator(QRegExp("^[a-z,A-Z,0-9,\\.,\\-,\\_,\\(,\\),\\+,\\ ]+$"), this)),
m_branchValidator(new QRegExpValidator(QRegExp("^[a-z,A-Z,0-9,\\^,\\.,\\-,\\_,\\/,\\(,\\),\\:,\\&,\\ )]+$"), this))
{
// Create UI
ui->setupUi(this);
ui->editName->setValidator(m_nameValidator);
ui->comboBranch->setValidator(m_branchValidator);
// Set start values
ui->editName->setText(name);
// Enable/disable accept button
checkInput();
// Fetch list of available licences
connect(&remoteDatabase, &RemoteDatabase::gotLicenceList, this, &RemotePushDialog::fillInLicences);
remoteDatabase.fetch(host + "licence/list", RemoteDatabase::RequestTypeLicenceList, clientCert);
// Prepare fetching list of available branches
connect(&remoteDatabase, &RemoteDatabase::gotBranchList, this, &RemotePushDialog::fillInBranches);
reloadBranchList();
}
RemotePushDialog::~RemotePushDialog()
{
delete ui;
}
void RemotePushDialog::checkInput()
{
// Update public/private check box text
if(ui->checkPublic->isChecked())
ui->checkPublic->setText(tr("Database will be public. Everyone has read access to it."));
else
ui->checkPublic->setText(tr("Database will be private. Only you have access to it."));
// Update the foce push check box text
if(ui->checkForce->isChecked())
ui->checkForce->setText(tr("Use with care. This can cause remote commits to be deleted."));
else
ui->checkForce->setText(" "); // The space character here is required to avoid annoying resizes when toggling the checkbox
// Check input
bool valid = true;
if(ui->editName->text().trimmed().isEmpty())
valid = false;
if(ui->editCommitMessage->toPlainText().size() > 1024)
valid = false;
if(ui->comboBranch->currentText().size() < 1 || ui->comboBranch->currentText().size() > 32)
valid = false;
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
}
void RemotePushDialog::accept()
{
QDialog::accept();
}
QString RemotePushDialog::name() const
{
return ui->editName->text().trimmed();
}
QString RemotePushDialog::commitMessage() const
{
return ui->editCommitMessage->toPlainText().trimmed();
}
QString RemotePushDialog::licence() const
{
return ui->comboLicence->currentData(Qt::UserRole).toString();
}
bool RemotePushDialog::isPublic() const
{
return ui->checkPublic->isChecked();
}
QString RemotePushDialog::branch() const
{
return ui->comboBranch->currentText();
}
bool RemotePushDialog::forcePush() const
{
return ui->checkForce->isChecked();
}
void RemotePushDialog::fillInLicences(const std::vector<std::pair<std::string, std::string>>& licences)
{
// Clear licence list
ui->comboLicence->clear();
// Parse licence list and fill combo box. Show the full name to the user and use the short name as user data.
for(const auto& it : licences)
ui->comboLicence->addItem(QString::fromStdString(it.second), QString::fromStdString(it.first));
}
void RemotePushDialog::fillInBranches(const std::vector<std::string>& branches, const std::string& default_branch)
{
// Clear branch list and add the default branch
ui->comboBranch->clear();
ui->comboBranch->addItem(QString::fromStdString(default_branch));
// Add rest of the branch list to the combo box
for(const std::string& branch : branches)
{
if(branch != default_branch)
ui->comboBranch->addItem(QString::fromStdString(branch));
}
}
void RemotePushDialog::reloadBranchList()
{
// Assemble query URL
QUrl url(m_host + "branch/list");
QUrlQuery query;
query.addQueryItem("username", remoteDatabase.getInfoFromClientCert(m_clientCert, RemoteDatabase::CertInfoUser));
query.addQueryItem("folder", "/");
query.addQueryItem("dbname", ui->editName->text());
url.setQuery(query);
// Send request
remoteDatabase.fetch(url.toString(), RemoteDatabase::RequestTypeBranchList, m_clientCert);
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

Official home of the DB Browser for SQLite (DB4S) project. Previously known as "SQLite Database Browser" and "Database Browser for SQLite". Website at:
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ax4688/sqlitebrowser.git
git@gitee.com:ax4688/sqlitebrowser.git
ax4688
sqlitebrowser
sqlitebrowser
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /