# # # add_file "src/view/dialogs/DatabaseDialogManager.cpp" # content [747825f29d1f4430ee9f7ffa78cc34a19d0b651a] # # add_file "src/view/dialogs/DatabaseDialogManager.h" # content [12ede7ec64dbde1ccf7f01f0ce1226212b901c2e] # # add_file "src/view/dialogs/WorkspaceDialogManager.cpp" # content [eae62066f3c403f953ed505b0ee3e6fc503a97a4] # # add_file "src/view/dialogs/WorkspaceDialogManager.h" # content [03667e4dc0dad5d0f121cce75fd409595b0f6c1a] # # patch "src/view/dialogs/DialogManager.cpp" # from [5f33d99686663af84f232e6c7b1cf831cec6b988] # to [7b7c3060381080175c064450c3ec1dcb4a7e343f] # # patch "src/view/dialogs/DialogManager.h" # from [cc548e839bedf3395db24df608a7a6ef0822fb3f] # to [030bff89fc02fe2676d4e556a6a05d7609a24e7b] # ============================================================ --- src/view/dialogs/DatabaseDialogManager.cpp 747825f29d1f4430ee9f7ffa78cc34a19d0b651a +++ src/view/dialogs/DatabaseDialogManager.cpp 747825f29d1f4430ee9f7ffa78cc34a19d0b651a @@ -0,0 +1,174 @@ +/*************************************************************************** + * 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 "DatabaseDialogManager.h" +#include "vocab.h" + +DatabaseDialogManager::DatabaseDialogManager(QWidget * parent) + : DialogManager(parent) +{ + connect( + changesetBrowser, SIGNAL(revisionManifest(const QString &)), + this, SLOT(showRevisionManifest(const QString &)) + ); + + connect( + fileHistory, SIGNAL(fileDiff(const QString &, const QString &, const QString &)), + this, SLOT(showFileDiff(const QString &, const QString &, const QString &)) + ); + + connect( + selectRevision, SIGNAL(revisionDiff(const QString &, const QString &, const QString &)), + this, SLOT(showRevisionDiff(const QString &, const QString &, const QString &)) + ); + + connect( + selectRevision, SIGNAL(revisionManifest(const QString &)), + this, SLOT(showRevisionManifest(const QString &)) + ); + + connect( + selectRevision, SIGNAL(revisionSelected(const QString &)), + this, SLOT(revisionSelected(const QString &)) + ); + + connect( + revisionManifest, SIGNAL(fileHistory(const QString &, const QString &)), + this, SLOT(showFileHistory(const QString &, const QString &)) + ); + + connect( + checkoutRevision, SIGNAL(selectRevisionFromSelector(const QString &)), + this, SLOT(showSelectRevision(const QString &)) + ); + + connect( + selectRevision, SIGNAL(revisionSelected(const QString &)), + checkoutRevision, SLOT(setSelectedRevision(const QString &)) + ); + + connect( + fileHistory, SIGNAL(fileDiff(const QString &, const QString &, const QString &)), + this, SLOT(showFileDiff(const QString &, const QString &, const QString &)) + ); + + // directly reload the keys dialog if a new key has been created + connect( + generateKeypair, SIGNAL(keypairGenerated()), + keyManagement, SLOT(readKeys()) + ); + + // delegate this further + connect( + checkoutRevision, SIGNAL(revisionCheckedOut(const QString &)), + this, SIGNAL(revisionCheckedOut(const QString &)) + ); +} + +DatabaseDialogManager::~DatabaseDialogManager() +{ + cleanup(); +} + +void DatabaseDialogManager::cleanup() +{ + if (changesetBrowser) delete changesetBrowser; + if (checkoutRevision) delete checkoutRevision; + if (fileDiff) delete fileDiff; + if (fileHistory) delete fileHistory; + if (generateKeypair) delete generateKeypair; + if (keyManagement) delete keyManagement; + if (revisionDiff) delete revisionDiff; + if (revisionManifest) delete revisionManifest; + if (selectRevision) delete selectRevision; +} + +void DatabaseDialogManager::init(const DatabaseFile & db) +{ + DialogManager::init(); + databaseFile = db; + cleanup(); + + QWidget * parentWidget = reinterpret_cast(parent()); + changesetBrowser = new ChangesetBrowser(parentWidget, databaseFile); + checkoutRevision = new CheckoutRevision(parentWidget, databaseFile); + fileDiff = new FileDiff(parentWidget); + fileHistory = new FileHistory(parentWidget, databaseFile); + generateKeypair = new GenerateKeypair(parentWidget, databaseFile); + keyManagement = new KeyManagement(parentWidget, databaseFile); + revisionDiff = new RevisionDiff(parentWidget); + revisionManifest = new RevisionManifest(parentWidget, databaseFile); + selectRevision = new SelectRevision(parentWidget, databaseFile); +} + +void DatabaseDialogManager::showChangesetBrowser() +{ + changesetBrowser->execDocumentModal(); +} + +void DatabaseDialogManager::showCheckoutRevision() +{ + checkoutRevision->execDocumentModal(); +} + +void DatabaseDialogManager::showFileDiff(const QString & file, const QString & base, const QString & target) +{ + fileDiff->forDatabase(databaseFile, file, base, target); + fileDiff->execDocumentModal(); +} + +void DatabaseDialogManager::showFileHistory(const QString & file, const QString & startRevision) +{ + fileHistory->readHistory(file, startRevision); + fileHistory->execDocumentModal(); +} + +void DatabaseDialogManager::showGenerateKeypair() +{ + generateKeypair->execDocumentModal(); +} + +void DatabaseDialogManager::showKeyManagement() +{ + keyManagement->readKeys(); + keyManagement->execDocumentModal(); +} + +void DatabaseDialogManager::showRevisionDiff(const QString & file, const QString & base, const QString & target) +{ + revisionDiff->forDatabase(databaseFile, file, base, target); + revisionDiff->execDocumentModal(); +} + +void DatabaseDialogManager::showRevisionManifest(const QString & revision) +{ + revisionManifest->readManifest(revision); + revisionManifest->execDocumentModal(); +} + +void DatabaseDialogManager::showSelectRevision(const QString & selector) +{ + if (selector.size() > 0) + { + selectRevision->queryRevisions(selector); + } + selectRevision->execDocumentModal(); +} + ============================================================ --- src/view/dialogs/DatabaseDialogManager.h 12ede7ec64dbde1ccf7f01f0ce1226212b901c2e +++ src/view/dialogs/DatabaseDialogManager.h 12ede7ec64dbde1ccf7f01f0ce1226212b901c2e @@ -0,0 +1,76 @@ +/*************************************************************************** + * 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 DATABASE_DIALOG_MANAGER_H +#define DATABASE_DIALOG_MANAGER_H + +#include "DialogManager.h" +#include "ChangesetBrowser.h" +#include "CheckoutRevision.h" +#include "FileDiff.h" +#include "FileHistory.h" +#include "GenerateKeypair.h" +#include "KeyManagement.h" +#include "RevisionDiff.h" +#include "RevisionManifest.h" +#include "SelectRevision.h" + +class DatabaseDialogManager : public DialogManager +{ + Q_OBJECT +public: + DatabaseDialogManager(QWidget *); + ~DatabaseDialogManager(); + + void init(const DatabaseFile &); + + //! delegated signals +signals: + void revisionCheckedOut(const QString &); + +public slots: + void showChangesetBrowser(); + void showCheckoutRevision(); + virtual void showFileDiff(const QString &, const QString &, const QString &); + void showFileHistory(const QString &, const QString &); + void showGenerateKeypair(); + void showKeyManagement(); + virtual void showRevisionDiff(const QString &, const QString &, const QString &); + void showRevisionManifest(const QString &); + void showSelectRevision(const QString &); + +protected: + ChangesetBrowser * changesetBrowser; + CheckoutRevision * checkoutRevision; + FileDiff * fileDiff; + FileHistory * fileHistory; + GenerateKeypair * generateKeypair; + KeyManagement * keyManagement; + RevisionDiff * revisionDiff; + RevisionManifest * revisionManifest; + SelectRevision * selectRevision; + +private: + void cleanup(); + + DatabaseFile databaseFile; +}; + +#endif ============================================================ --- src/view/dialogs/WorkspaceDialogManager.cpp eae62066f3c403f953ed505b0ee3e6fc503a97a4 +++ src/view/dialogs/WorkspaceDialogManager.cpp eae62066f3c403f953ed505b0ee3e6fc503a97a4 @@ -0,0 +1,93 @@ +/*************************************************************************** + * 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 "WorkspaceDialogManager.h" +#include "Guitone.h" + +WorkspaceDialogManager::WorkspaceDialogManager(QWidget * parent) + : DatabaseDialogManager(parent) +{ + connect( + updateWorkspace, SIGNAL(selectRevisionFromSelector(const QString &)), + this, SLOT(showSelectRevision(const QString &)) + ); + + connect( + selectRevision, SIGNAL(revisionSelected(const QString &)), + updateWorkspace, SLOT(setSelectedRevision(const QString &)) + ); + + // delegate this further + connect( + commitRevision, SIGNAL(revisionCommitted(const QString &)), + this, SIGNAL(revisionCommitted(const QString &)) + ); +} + +WorkspaceDialogManager::~WorkspaceDialogManager() +{ + cleanup(); +} + +void WorkspaceDialogManager::cleanup() +{ + if (commitRevision) delete commitRevision; + if (unaccountedRenames) delete unaccountedRenames; + if (updateWorkspace) delete updateWorkspace; +} + +void WorkspaceDialogManager::init(const WorkspacePath & path) +{ + DatabaseDialogManager::init(APP->manager()->getDatabaseFilePath(path)); + workspacePath = path; + cleanup(); + + QWidget * parentWidget = reinterpret_cast(parent()); + commitRevision = new CommitRevision(parentWidget, workspacePath); + updateWorkspace = new UpdateWorkspace(parentWidget, workspacePath); + unaccountedRenames = new UnaccountedRenames(parentWidget); +} + +void WorkspaceDialogManager::showCommitRevision() +{ + commitRevision->execDocumentModal(); +} + +void WorkspaceDialogManager::showFileDiff(const QString & file, const QString & base, const QString & target) +{ + fileDiff->forWorkspace(workspacePath, file, base, target); + fileDiff->execDocumentModal(); +} + +void WorkspaceDialogManager::showRevisionDiff(const QString & file, const QString & base, const QString & target) +{ + revisionDiff->forWorkspace(workspacePath, file, base, target); + revisionDiff->execDocumentModal(); +} +void WorkspaceDialogManager::showUnaccountedRenames(const QMap & renames) +{ + unaccountedRenames->showUnaccountedRenames(renames); +} + +void WorkspaceDialogManager::showUpdateWorkspace() +{ + checkoutRevision->execDocumentModal(); +} + ============================================================ --- src/view/dialogs/WorkspaceDialogManager.h 03667e4dc0dad5d0f121cce75fd409595b0f6c1a +++ src/view/dialogs/WorkspaceDialogManager.h 03667e4dc0dad5d0f121cce75fd409595b0f6c1a @@ -0,0 +1,63 @@ +/*************************************************************************** + * 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 WORKSPACE_DIALOG_MANAGER_H +#define WORKSPACE_DIALOG_MANAGER_H + +#include "DatabaseDialogManager.h" +#include "CommitRevision.h" +#include "UnaccountedRenames.h" +#include "UpdateWorkspace.h" + +#include +#include + +class WorkspaceDialogManager : public DatabaseDialogManager +{ + Q_OBJECT +public: + WorkspaceDialogManager(QWidget *); + ~WorkspaceDialogManager(); + + void init(const WorkspacePath &); + + //! delegated signals +signals: + void revisionCommitted(const QString &); + +public slots: + void showCommitRevision(); + void showUnaccountedRenames(const QMap &); + void showUpdateWorkspace(); + void showFileDiff(const QString &, const QString &, const QString &); + void showRevisionDiff(const QString &, const QString &, const QString &); + +protected: + CommitRevision * commitRevision; + UnaccountedRenames * unaccountedRenames; + UpdateWorkspace * updateWorkspace; + +private: + void cleanup(); + + WorkspacePath workspacePath; +}; + +#endif ============================================================ --- src/view/dialogs/DialogManager.cpp 5f33d99686663af84f232e6c7b1cf831cec6b988 +++ src/view/dialogs/DialogManager.cpp 7b7c3060381080175c064450c3ec1dcb4a7e343f @@ -19,148 +19,26 @@ ***************************************************************************/ #include "DialogManager.h" -#include "Guitone.h" +#include "vocab.h" -DialogManager::DialogManager(QWidget * parentWidget) : QObject(parentWidget) -{ - about = 0; - changesetBrowser = 0; - checkoutRevision = 0; - commitRevision = 0; - fileDiff = 0; - fileHistory = 0; - generateKeypair = 0; - keyManagement = 0; - preferences = 0; - revisionDiff = 0; - revisionManifest = 0; - selectRevision = 0; - unaccountedRenames = 0; - updateWorkspace = 0; -} +DialogManager::DialogManager(QWidget * parentWidget) : QObject(parentWidget) {} DialogManager::~DialogManager() { - delete about; - delete changesetBrowser; - delete checkoutRevision; - delete commitRevision; - delete fileDiff; - delete fileHistory; - delete generateKeypair; - delete keyManagement; - delete preferences; - delete revisionDiff; - delete revisionManifest; - delete selectRevision; - delete unaccountedRenames; - delete updateWorkspace; + cleanup(); } -void DialogManager::initWithDatabase(const DatabaseFile & db) +void DialogManager::cleanup() { - databaseFile = db; - - QWidget * parent = reinterpret_cast(parent); - - about = new About(parent); - changesetBrowser = new ChangesetBrowser(parent, databaseFile); - checkoutRevision = new CheckoutRevision(parent, databaseFile); - fileDiff = new FileDiff(parent); - fileHistory = new FileHistory(parent, databaseFile); - generateKeypair = new GenerateKeypair(parent, databaseFile); - keyManagement = new KeyManagement(parent, databaseFile); - preferences = new Preferences(parent); - revisionDiff = new RevisionDiff(parent); - revisionManifest = new RevisionManifest(parent, databaseFile); - selectRevision = new SelectRevision(parent, databaseFile); - unaccountedRenames = new UnaccountedRenames(parent); - - connect( - changesetBrowser, SIGNAL(revisionManifest(const QString &)), - this, SLOT(showRevisionManifest(const QString &)) - ); - - connect( - fileHistory, SIGNAL(fileDiff(const QString &, const QString &, const QString &)), - this, SLOT(showFileDiff(const QString &, const QString &, const QString &)) - ); - - connect( - selectRevision, SIGNAL(revisionDiff(const QString &, const QString &, const QString &)), - this, SLOT(showRevisionDiff(const QString &, const QString &, const QString &)) - ); - - connect( - selectRevision, SIGNAL(revisionManifest(const QString &)), - this, SLOT(showRevisionManifest(const QString &)) - ); - - connect( - selectRevision, SIGNAL(revisionSelected(const QString &)), - this, SLOT(revisionSelected(const QString &)) - ); - - connect( - revisionManifest, SIGNAL(fileHistory(const QString &, const QString &)), - this, SLOT(showFileHistory(const QString &, const QString &)) - ); - - connect( - checkoutRevision, SIGNAL(selectRevisionFromSelector(const QString &)), - this, SLOT(showSelectRevision(const QString &)) - ); - - connect( - selectRevision, SIGNAL(revisionSelected(const QString &)), - checkoutRevision, SLOT(setSelectedRevision(const QString &)) - ); - - connect( - fileHistory, SIGNAL(fileDiff(const QString &, const QString &, const QString &)), - this, SLOT(showFileDiff(const QString &, const QString &, const QString &)) - ); - - // directly reload the keys dialog if a new key has been created - connect( - generateKeypair, SIGNAL(keypairGenerated()), - keyManagement, SLOT(readKeys()) - ); - - // delegate this further - connect( - checkoutRevision, SIGNAL(revisionCheckedOut(const QString &)), - this, SIGNAL(revisionCheckedOut(const QString &)) - ); - + if (about) delete about; + if (preferences) delete preferences; } -void DialogManager::initWithWorkspace(const WorkspacePath & ws) +void DialogManager::init() { - workspacePath = ws; - - QWidget * parent = reinterpret_cast(parent); - - commitRevision = new CommitRevision(parent, workspacePath); - updateWorkspace = new UpdateWorkspace(parent, workspacePath); - - connect( - updateWorkspace, SIGNAL(selectRevisionFromSelector(const QString &)), - this, SLOT(showSelectRevision(const QString &)) - ); - - connect( - selectRevision, SIGNAL(revisionSelected(const QString &)), - updateWorkspace, SLOT(setSelectedRevision(const QString &)) - ); - - // delegate this further - connect( - commitRevision, SIGNAL(revisionCommitted(const QString &)), - this, SIGNAL(revisionCommitted(const QString &)) - ); - - initWithDatabase(APP->manager()->getDatabaseFilePath(ws)); + QWidget * parentWidget = reinterpret_cast(parent()); + about = new About(parentWidget); + preferences = new Preferences(parentWidget); } void DialogManager::showAbout() @@ -169,111 +47,9 @@ void DialogManager::showAbout() about->execDocumentModal(); } -void DialogManager::showChangesetBrowser() -{ - I(changesetBrowser); - changesetBrowser->execDocumentModal(); -} - -void DialogManager::showCheckoutRevision() -{ - I(checkoutRevision); - checkoutRevision->execDocumentModal(); -} - -void DialogManager::showCommitRevision() -{ - I(commitRevision); - commitRevision->execDocumentModal(); -} - -void DialogManager::showFileDiff(const QString & file, const QString & base, const QString & target) -{ - I(fileDiff); - - if (!workspacePath.isEmpty()) - { - fileDiff->forWorkspace(workspacePath, file); - } - else - { - fileDiff->forDatabase(databaseFile, file, base, target); - } - - fileDiff->execDocumentModal(); -} - -void DialogManager::showFileHistory(const QString & file, const QString & startRevision) -{ - I(fileHistory); - - fileHistory->readHistory(file, startRevision); - fileHistory->execDocumentModal(); -} - -void DialogManager::showGenerateKeypair() -{ - I(generateKeypair); - generateKeypair->execDocumentModal(); -} - -void DialogManager::showKeyManagement() -{ - I(keyManagement); - keyManagement->readKeys(); - keyManagement->execDocumentModal(); -} - void DialogManager::showPreferences() { I(preferences); preferences->execDocumentModal(); } -void DialogManager::showRevisionDiff(const QString & file, const QString & base, const QString & target) -{ - I(revisionDiff); - - if (!workspacePath.isEmpty()) - { - revisionDiff->forWorkspace(workspacePath, file); - } - else - { - revisionDiff->forDatabase(databaseFile, file, base, target); - } - - revisionDiff->execDocumentModal(); -} - -void DialogManager::showRevisionManifest(const QString & revision) -{ - I(revisionManifest); - - revisionManifest->readManifest(revision); - revisionManifest->execDocumentModal(); -} - -void DialogManager::showSelectRevision(const QString & selector) -{ - I(selectRevision); - - if (selector.size() > 0) - { - selectRevision->queryRevisions(selector); - } - selectRevision->execDocumentModal(); -} - -void DialogManager::showUnaccountedRenames(const QMap & renames) -{ - I(unaccountedRenames); - unaccountedRenames->showUnaccountedRenames(renames); -} - -void DialogManager::showUpdateWorkspace() -{ - I(updateWorkspace); - checkoutRevision->execDocumentModal(); -} - ============================================================ --- src/view/dialogs/DialogManager.h cc548e839bedf3395db24df608a7a6ef0822fb3f +++ src/view/dialogs/DialogManager.h 030bff89fc02fe2676d4e556a6a05d7609a24e7b @@ -22,19 +22,7 @@ #define DIALOGMANAGER_H #include "About.h" -#include "ChangesetBrowser.h" -#include "CheckoutRevision.h" -#include "CommitRevision.h" -#include "FileDiff.h" -#include "FileHistory.h" -#include "GenerateKeypair.h" -#include "KeyManagement.h" #include "Preferences.h" -#include "RevisionDiff.h" -#include "RevisionManifest.h" -#include "SelectRevision.h" -#include "UnaccountedRenames.h" -#include "UpdateWorkspace.h" #include #include @@ -45,51 +33,19 @@ public: public: DialogManager(QWidget *); ~DialogManager(); + void init(); - void initWithDatabase(const DatabaseFile &); - void initWithWorkspace(const WorkspacePath &); - - //! delegated signals -signals: - void revisionCheckedOut(const QString &); - void revisionCommitted(const QString &); - public slots: void showAbout(); - void showChangesetBrowser(); - void showCheckoutRevision(); - void showCommitRevision(); - void showFileDiff(const QString &, const QString &, const QString &); - void showFileHistory(const QString &, const QString &); - void showGenerateKeypair(); - void showKeyManagement(); void showPreferences(); - void showRevisionDiff(const QString &, const QString &, const QString &); - void showRevisionManifest(const QString &); - void showSelectRevision(const QString &); - void showUnaccountedRenames(const QMap &); - void showUpdateWorkspace(); +protected: + About * about; + Preferences * preferences; + private: - About * about; - ChangesetBrowser * changesetBrowser; - CheckoutRevision * checkoutRevision; - CommitRevision * commitRevision; - FileDiff * fileDiff; - FileHistory * fileHistory; - GenerateKeypair * generateKeypair; - KeyManagement * keyManagement; - Preferences * preferences; - RevisionDiff * revisionDiff; - RevisionManifest * revisionManifest; - SelectRevision * selectRevision; - UnaccountedRenames * unaccountedRenames; - UpdateWorkspace * updateWorkspace; - - DatabaseFile databaseFile; - WorkspacePath workspacePath; - - QMap > dialogMapping; + void cleanup(); }; #endif +