GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sqlitebrowser/src/RemotePushDialog.cpp at master · lineCode/sqlitebrowser Expand file tree/ Copy pathRemotePushDialog.cppMore file actions 144 lines (117 loc) · 4.37 KB / Copy pathRemotePushDialog.cppFile metadata and controls144 lines (117 loc) · 4.37 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 #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 QMap<QString, QString>& licences) { // Clear licence list and add default item for unspecified licence ui->comboLicence->clear(); ui->comboLicence->addItem(tr("Unspecified"), QString()); // Parse licence list and fill combo box. Show the full name to the user and use the short name as user data. for(auto it=licences.constBegin();it!=licences.constEnd();++it) ui->comboLicence->addItem(it.value(), it.key()); } void RemotePushDialog::fillInBranches(const QStringList& branches, const QString& default_branch) { // Clear branch list and add the default branch ui->comboBranch->clear(); ui->comboBranch->addItem(default_branch); // Add rest of the branch list to the combo box for(const QString& branch : branches) { if(branch != default_branch) ui->comboBranch->addItem(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); } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |