#
#
# add_file "guitone/res/forms/checkout_revision.ui"
# content [8e82527042f3591900f33a18dd49b5db7aecc734]
#
# add_file "guitone/src/view/dialogs/CheckoutRevision.cpp"
# content [0ad602766bdbe0e74db8140ed4fa83650071437d]
#
# add_file "guitone/src/view/dialogs/CheckoutRevision.h"
# content [c2406fda2ad112fc53938b47b334d316d3ed6e37]
#
# patch "guitone/guitone.pro"
# from [9e08c88bd08fd7534bb3ee5c027dcd187332e711]
# to [acb9814e8205a3b5bf2e1d9b8ee7694ec98a3490]
#
# patch "guitone/res/forms/main_window.ui"
# from [71b8b4a3457be2b37a649658407ee48a0f2e81cd]
# to [22ad832e3f5c2c47aa9b2453911e2640c6036a3f]
#
# patch "guitone/src/view/MainWindow.cpp"
# from [090b8fbed5df13a3ab5e68a2842af16a9c104dc9]
# to [adeca012c74a861bfc6bd8f90154256712ca6b74]
#
# patch "guitone/src/view/MainWindow.h"
# from [19ab975f98d2d7f1ff87767bc6ed01a8fec7008b]
# to [7a2b0ee4dfec6de9a58b70b1e9a8902b82df53be]
#
============================================================
--- guitone/res/forms/checkout_revision.ui 8e82527042f3591900f33a18dd49b5db7aecc734
+++ guitone/res/forms/checkout_revision.ui 8e82527042f3591900f33a18dd49b5db7aecc734
@@ -0,0 +1,319 @@
+
+ CheckoutRevision
+
+
+
+ 0
+ 0
+ 475
+ 325
+
+
+
+
+ 5
+ 7
+ 0
+ 0
+
+
+
+
+ 0
+ 325
+
+
+
+
+ 16777215
+ 325
+
+
+
+ Checkout revision
+
+
+ :/icons/guitone.png
+
+
+
+ 9
+
+
+ 6
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Checkout all files from...
+
+
+
+ 9
+
+
+ 6
+
+
-
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ the head of branch
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::MinimumExpanding
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 3
+ 0
+ 0
+ 0
+
+
+
+
+ 200
+ 0
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ the tag
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::MinimumExpanding
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 3
+ 0
+ 0
+ 0
+
+
+
+
+ 200
+ 0
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+ 3
+
+
-
+
+
+ an individual revision (selectors allowed)
+
+
+
+ -
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 20
+
+
+
+
+ -
+
+
+ -
+
+
+ select revision
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ ...and save them here
+
+
+
+ 9
+
+
+ 6
+
+
-
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ -
+
+
+ browse
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CheckoutRevision
+ accept()
+
+
+ 237
+ 235
+
+
+ 237
+ 130
+
+
+
+
+ buttonBox
+ rejected()
+ CheckoutRevision
+ reject()
+
+
+ 237
+ 235
+
+
+ 237
+ 130
+
+
+
+
+
============================================================
--- guitone/src/view/dialogs/CheckoutRevision.cpp 0ad602766bdbe0e74db8140ed4fa83650071437d
+++ guitone/src/view/dialogs/CheckoutRevision.cpp 0ad602766bdbe0e74db8140ed4fa83650071437d
@@ -0,0 +1,288 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "CheckoutRevision.h"
+#include "SelectRevision.h"
+#include "MonotoneDelegate.h"
+#include "Settings.h"
+
+#include
+
+CheckoutRevision::CheckoutRevision(QWidget* parent)
+ : Dialog(parent)
+{
+ setupUi(this);
+ Dialog::init();
+
+ // OSX sheet-alike dialog
+ setWindowFlags(Qt::Sheet);
+
+ branchesModel = new Branches(this, false);
+ branchesModel->readBranches();
+ branchList->setModel(branchesModel);
+
+ tagsModel = new Tags(this);
+ tagsModel->readTags(QString());
+ tagList->setModel(tagsModel);
+
+ selectorCompleter = new QCompleter(
+ Settings::getItemList("RecentCheckoutSelectors"),
+ this
+ );
+
+ selectorCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+ selectedRevision->setCompleter(selectorCompleter);
+
+ localCheckoutPath->setText(QDir::homePath());
+
+ connect(
+ selectRevision, SIGNAL(clicked()),
+ this, SLOT(slotSelectRevision())
+ );
+
+ connect(
+ branchList, SIGNAL(activated(int)),
+ this, SLOT(selectBranchOption())
+ );
+
+ connect(
+ tagList, SIGNAL(activated(int)),
+ this, SLOT(selectTagOption())
+ );
+
+ connect(
+ selectedRevision, SIGNAL(textChanged(const QString &)),
+ this, SLOT(selectSelectorOption())
+ );
+
+ connect(
+ browseDirs, SIGNAL(clicked()),
+ this, SLOT(openDirBrowser())
+ );
+}
+
+CheckoutRevision::~CheckoutRevision()
+{
+ delete branchesModel;
+ delete tagsModel;
+ delete selectorCompleter;
+}
+
+void CheckoutRevision::accept()
+{
+ QString selector;
+
+ if (checkoutByBranch->isChecked())
+ {
+ QString selection(branchList->currentText());
+ if (selection.isEmpty())
+ {
+ QMessageBox::warning(
+ this,
+ tr("No branch selected"),
+ tr("Please select a branch from the list of branches."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ selector = "h:" + selection;
+ }
+
+ if (checkoutByTag->isChecked())
+ {
+ QString selection(tagList->currentText());
+ if (selection.isEmpty())
+ {
+ QMessageBox::warning(
+ this,
+ tr("No tag selected"),
+ tr("Please select a tag from the list of tags (if any are available)."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ selector = "t:" + selection;
+ }
+
+ if (checkoutByRevision->isChecked())
+ {
+ QString selection = selectedRevision->text();
+ if (selection.isEmpty())
+ {
+ QMessageBox::warning(
+ this,
+ tr("No selector given"),
+ tr("Please enter a monotone selector or choose a revision by clicking on 'select revision'."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ selector = selection;
+ Settings::addItemToList("RecentCheckoutSelectors", selection, 10);
+ }
+
+ QStringList revList(MonotoneDelegate::resolveSelector(selector));
+
+ if (revList.size() == 0)
+ {
+ QMessageBox::warning(
+ this,
+ tr("No revisions matched"),
+ tr("Your selection didn't match any revisions or was invalid."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ if (revList.size() > 1)
+ {
+ QMessageBox::information(
+ this,
+ tr("Multiple revisions matched"),
+ tr("Your selection matched multiple revisions. Please choose one."),
+ QMessageBox::Ok
+ );
+
+ openSelectRevision(selector);
+ return;
+ }
+
+ QString checkoutPath = localCheckoutPath->text();
+ QDir checkoutDir(checkoutPath);
+
+ // check if the dir exists, and if not, create it
+ if (!checkoutDir.exists())
+ {
+ QMessageBox::StandardButton btn = QMessageBox::question(
+ this,
+ tr("Directory does not exist"),
+ tr("The checkout directory does not exist, "
+ "do you want to create it?"),
+ QMessageBox::Yes | QMessageBox::No
+ );
+
+ if (btn == QMessageBox::No) return;
+
+ checkoutDir.setPath(QDir::rootPath());
+ if (!checkoutDir.mkpath(checkoutPath))
+ {
+ QMessageBox::critical(
+ this,
+ tr("Directory path could not be created"),
+ tr("The directory path could not be created, "
+ "please check your permissions or enter a different one."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ checkoutDir.setPath(checkoutPath);
+ }
+
+ // check permissions
+ QFileInfo info(checkoutDir.absolutePath());
+ if (!info.isWritable())
+ {
+ QMessageBox::critical(
+ this,
+ tr("Directory not writable"),
+ tr("The directory is not writable, "
+ "please check your permissions or enter a different one."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ QDir::Filters filters = QDir::NoDotAndDotDot | QDir::AllEntries |
+ QDir::Hidden | QDir::System;
+ // ensure the user acknowledges that a directory may not be empty
+ if (checkoutDir.entryList(filters).size() > 0)
+ {
+ QMessageBox::StandardButton btn = QMessageBox::question(
+ this,
+ tr("Directory not empty"),
+ tr("The checkout directory is not empty. "
+ "Do you want to continue?"),
+ QMessageBox::Yes | QMessageBox::No
+ );
+
+ if (btn == QMessageBox::No) return;
+ }
+
+ selectedRevisionId = revList.at(0);
+ selectedCheckoutDirectory = checkoutDir;
+
+ qDebug("selected %s to be checked out to %s",
+ qPrintable(selectedRevisionId),
+ qPrintable(selectedCheckoutDirectory.absolutePath())
+ );
+ done(0);
+}
+
+void CheckoutRevision::slotSelectRevision()
+{
+ openSelectRevision(QString());
+}
+
+void CheckoutRevision::openSelectRevision(const QString & selector)
+{
+ hide();
+
+ SelectRevision dlg(parentWidget());
+
+ if (selector.size() > 0)
+ {
+ dlg.queryRevisions(selector);
+ }
+
+ if (dlg.execDocumentModal() == QDialog::Accepted)
+ {
+ selectedRevision->setText(dlg.getSelectedRevision());
+ }
+
+ show();
+}
+
+void CheckoutRevision::selectBranchOption()
+{
+ checkoutByBranch->setChecked(true);
+}
+
+void CheckoutRevision::selectTagOption()
+{
+ checkoutByTag->setChecked(true);
+}
+
+void CheckoutRevision::selectSelectorOption()
+{
+ checkoutByRevision->setChecked(true);
+}
+
+void CheckoutRevision::openDirBrowser()
+{
+ QString fn = QFileDialog::getExistingDirectory(
+ this, tr("Select a directory for checkout...")
+ );
+
+ if (!fn.isEmpty())
+ {
+ localCheckoutPath->setText(fn);
+ }
+}
+
============================================================
--- guitone/src/view/dialogs/CheckoutRevision.h c2406fda2ad112fc53938b47b334d316d3ed6e37
+++ guitone/src/view/dialogs/CheckoutRevision.h c2406fda2ad112fc53938b47b334d316d3ed6e37
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef CHECKOUT_REVISION_H
+#define CHECKOUT_REVISION_H
+
+#include "Dialog.h"
+#include "ui_checkout_revision.h"
+#include "Select.h"
+#include "Branches.h"
+#include "Tags.h"
+
+#include
+
+class CheckoutRevision : public Dialog, private Ui::CheckoutRevision
+{
+ Q_OBJECT
+
+public:
+ CheckoutRevision(QWidget *);
+ ~CheckoutRevision();
+ inline QString getSelectedRevision() const { return selectedRevisionId; }
+ inline QDir getSelectedCheckoutDirectory() const {
+ return selectedCheckoutDirectory;
+ }
+
+private:
+ void openSelectRevision(const QString &);
+
+ Branches * branchesModel;
+ Tags * tagsModel;
+ QCompleter * selectorCompleter;
+ QString selectedRevisionId;
+ QDir selectedCheckoutDirectory;
+
+private slots:
+ void slotSelectRevision();
+ void accept();
+ void selectBranchOption();
+ void selectTagOption();
+ void selectSelectorOption();
+ void openDirBrowser();
+};
+
+#endif
============================================================
--- guitone/guitone.pro 9e08c88bd08fd7534bb3ee5c027dcd187332e711
+++ guitone/guitone.pro acb9814e8205a3b5bf2e1d9b8ee7694ec98a3490
@@ -22,6 +22,7 @@ HEADERS += src/view/MainWindow.h \
src/view/dialogs/Dialog.h \
src/view/dialogs/SelectRevision.h \
src/view/dialogs/UpdateWorkspace.h \
+ src/view/dialogs/CheckoutRevision.h \
src/view/dialogs/Preferences.h \
src/view/dialogs/FileDiff.h \
src/view/dialogs/RevisionDiff.h \
@@ -69,6 +70,7 @@ SOURCES += src/view/MainWindow.cpp \
src/view/dialogs/Dialog.cpp \
src/view/dialogs/SelectRevision.cpp \
src/view/dialogs/UpdateWorkspace.cpp \
+ src/view/dialogs/CheckoutRevision.cpp \
src/view/dialogs/Preferences.cpp \
src/view/dialogs/FileDiff.cpp \
src/view/dialogs/RevisionDiff.cpp \
@@ -110,6 +112,7 @@ FORMS += res/forms/select_revision.ui
FORMS += res/forms/select_revision.ui \
res/forms/update_workspace.ui \
+ res/forms/checkout_revision.ui \
res/forms/preferences.ui \
res/forms/file_diff.ui \
res/forms/revision_diff.ui \
============================================================
--- guitone/res/forms/main_window.ui 71b8b4a3457be2b37a649658407ee48a0f2e81cd
+++ guitone/res/forms/main_window.ui 22ad832e3f5c2c47aa9b2453911e2640c6036a3f
@@ -128,32 +128,6 @@ You can switch back to the workspace mod
22
-
-
+
+
@@ -366,7 +367,7 @@ You can switch back to the workspace mod
Update workspace
- Ctrl+R
+ Ctrl+U
@@ -431,19 +432,27 @@ You can switch back to the workspace mod
Ctrl+B
+
+
+ Checkout revision
+
+
+ Ctrl+Shift+U
+
+
- Splitter
- QSplitter
-
-
-
InventoryView
QTreeView
+ Splitter
+ QSplitter
+
+
+
AttributesView
QTreeView
============================================================
--- guitone/src/view/MainWindow.cpp 090b8fbed5df13a3ab5e68a2842af16a9c104dc9
+++ guitone/src/view/MainWindow.cpp adeca012c74a861bfc6bd8f90154256712ca6b74
@@ -28,6 +28,7 @@
#include "InventoryView.h"
#include "AttributesView.h"
#include "UpdateWorkspace.h"
+#include "CheckoutRevision.h"
#include "Preferences.h"
#include "KeyManagement.h"
#include "About.h"
@@ -459,6 +460,14 @@ void MainWindow::on_actionUpdate_workspa
dialog.execDocumentModal();
}
+void MainWindow::on_actionCheckout_revision_triggered()
+{
+ // TODO: of course the actual checkout which should then be displayed
+ // in a new window
+ CheckoutRevision dialog(this);
+ dialog.execDocumentModal();
+}
+
void MainWindow::on_actionPreferences_triggered()
{
Preferences dialog(this);
============================================================
--- guitone/src/view/MainWindow.h 19ab975f98d2d7f1ff87767bc6ed01a8fec7008b
+++ guitone/src/view/MainWindow.h 7a2b0ee4dfec6de9a58b70b1e9a8902b82df53be
@@ -52,6 +52,7 @@ private slots:
void on_menuShow_triggered(QAction *);
void on_actionExpand_tree_triggered();
void on_actionUpdate_workspace_triggered();
+ void on_actionCheckout_revision_triggered();
void on_actionKey_management_triggered();
void on_actionPreferences_triggered();
void on_actionAbout_guitone_triggered();