#include "widget.h" #include "ui_widget.h" #include Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); ui->teLog->setFont(QFont("Courier new")); connect(ui->btAdd, SIGNAL(clicked()), this, SLOT(btAdd())); connect(ui->btBrowse, SIGNAL(clicked()), this, SLOT(btBrowse())); connect(ui->btCheckout, SIGNAL(clicked()), this, SLOT(btCheckout())); connect(ui->btCleanup, SIGNAL(clicked()), this, SLOT(btCleanup())); connect(ui->btCommit, SIGNAL(clicked()), this, SLOT(btCommit())); connect(ui->btInfo, SIGNAL(clicked()), this, SLOT(btInfo())); connect(ui->btLock, SIGNAL(clicked()), this, SLOT(btLock())); connect(ui->btLog, SIGNAL(clicked()), this, SLOT(btLog())); connect(ui->btReverse, SIGNAL(clicked()), this, SLOT(btReverse())); connect(ui->btUnlock, SIGNAL(clicked()), this, SLOT(btUnlock())); connect(ui->btUpdate, SIGNAL(clicked()), this, SLOT(btUpdate())); connect(&svn, SIGNAL(message(QString)), this, SLOT(onMessage(QString))); connect(&svn, SIGNAL(error(QString)), this, SLOT(onError(QString))); connect(&svn, SIGNAL(finished(bool)), this, SLOT(finished(bool))); // connect(&svn, SIGNAL(isRunningChanged(bool)), this, SLOT(isRunningChanged(bool))); } Widget::~Widget() { delete ui; } void Widget::changeEvent(QEvent *e) { QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void Widget::btBrowse() { QFileDialog fd(this); fd.setFileMode(QFileDialog::ExistingFiles); //fd.setAcceptMode(QFileDialog::AcceptOpen); //fd.setOptions(0); //fd.setOption(QFileDialog::DontUseNativeDialog, true); QStringList paths ;//= QFileDialog::getOpenFileNames(this, "Select files or folder"); if (fd.exec()) paths = fd.selectedFiles(); if(!paths.isEmpty()){ m_currentPaths = paths; ui->lePaths->setText(paths.join(", ")); svn.setCurrentPaths(m_currentPaths); } } void Widget::btCommit() { svn.commit(ui->leCommit->text(), m_currentPaths); } void Widget::btCheckout() { svn.checkout(ui->leCheckoutUrl->text().split(" "), ui->leCheckoutPath->text().split(" ")); } void Widget::btInfo() { svn.setVerbose(false); svn.info(m_currentPaths); svn.setVerbose(true); } void Widget::btLock() { svn.lock(m_currentPaths, ui->leLock->text()); } void Widget::btLog() { svn.log(m_currentPaths); } void Widget::btUnlock() { svn.unlock(m_currentPaths); } void Widget::btAdd() { svn.add(m_currentPaths); } void Widget::btReverse() { svn.revert(m_currentPaths); } void Widget::btUpdate() { svn.update(m_currentPaths); } void Widget::btCleanup() { svn.cleanUp(m_currentPaths); } void Widget::started() { ui->teLog->append(tr("SVN action started")); } void Widget::finished(bool status) { ui->teLog->append(tr("Last SVN action %1").arg(status ? "done successfully" : "failed")); } void Widget::onError(const QString &error) { ui->teLog->append(tr("Error: %1").arg(error)); } void Widget::onMessage(const QString &msg) { ui->teLog->append(tr("SVN : %1").arg(msg)); }