From c9e385160c74fe61f6ce9201b15b601f32b41698 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 20 Mar 2015 09:39:45 +0100 Subject: [PATCH 01/21] Remotes Module: remove all "global" module actions The menu is at the wrong place and about to be moved to the appropriate context (e.g. repo, branch, remote, ...) --- Modules/Remotes/RemotesModule.cpp | 1 - Modules/Remotes/RemotesModuleActions.hid | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 05e7d295..b9fec45f 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -35,7 +35,6 @@ BlueSky::View* RemotesModule::createRemotesView() void RemotesModule::initialize() { setupActions( this ); - acRemotesAC->mergeInto( "RemotesMP" ); MacGitver::self().registerView( "Remotes", tr( "Remotes" ), &RemotesModule::createRemotesView ); diff --git a/Modules/Remotes/RemotesModuleActions.hid b/Modules/Remotes/RemotesModuleActions.hid index 4f7ffe4a..37761846 100644 --- a/Modules/Remotes/RemotesModuleActions.hid +++ b/Modules/Remotes/RemotesModuleActions.hid @@ -16,27 +16,12 @@ Ui RemotesModuleActions { - Container RemotesAC { - Menu Remotes { - Text "R&emotes"; - Action RemotesCreate { - Text "&Create..."; - _ConnectTo onRemoteCreate(); - }; - Action RemotesFetch { - Text "&Fetch"; - }; - Action RemotesPush { - Text "P&ush..."; - }; - }; - }; }; From afa67d44bc5a1e992163c838c00790d0d8af085f Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 20 Mar 2015 14:44:25 +0100 Subject: [PATCH 02/21] Remotes Module: Prepare an action container to build the fetch menu as a mergeable submenu. --- Modules/Remotes/RemotesModule.cpp | 12 ++++++++++++ Modules/Remotes/RemotesModule.h | 4 ++++ Modules/Remotes/RemotesModuleActions.hid | 11 +++++++++++ 3 files changed, 27 insertions(+) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index b9fec45f..27faac84 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -36,6 +36,8 @@ void RemotesModule::initialize() { setupActions( this ); + acRemotesFetchAC->mergeInto( "RemotesFetchMP" ); + MacGitver::self().registerView( "Remotes", tr( "Remotes" ), &RemotesModule::createRemotesView ); } @@ -49,3 +51,13 @@ void RemotesModule::onRemoteCreate() { RemoteCreateEditDlg().exec(); } + +/** + * @brief Menu action to fetch all remotes of a repository. + */ +void RemotesModule::onRemotesFetchAll() +{ + // TODO: requires a RepositoryContext (the repo to fetch all remotes from) + // A sub-context (i.e. a branch) can further restrict, what is fetched +} + diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index fd72b521..11e52adf 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -39,6 +39,10 @@ class RemotesModule : public Module, public RemotesModuleActions private slots: void onRemoteCreate(); + +private slots: + // RemotesFetchAC + void onRemotesFetchAll(); }; #endif diff --git a/Modules/Remotes/RemotesModuleActions.hid b/Modules/Remotes/RemotesModuleActions.hid index 37761846..9b97c147 100644 --- a/Modules/Remotes/RemotesModuleActions.hid +++ b/Modules/Remotes/RemotesModuleActions.hid @@ -21,7 +21,18 @@ Ui RemotesModuleActions { + Container RemotesFetchAC { + Menu MnuFetch { + Text "Fetch"; + Action RemotesFetchAll { + Text "All Remotes"; + _ConnectTo onRemotesFetchAll(); + }; + Separator; + }; + + }; }; From 18f420f95049d941cb38e5810e9f742cfe995804 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 20 Mar 2015 15:28:38 +0100 Subject: [PATCH 03/21] Remotes Module: Add action container to manage Git Remotes. --- Modules/Remotes/RemotesModule.cpp | 13 +++++++++++-- Modules/Remotes/RemotesModule.h | 3 ++- Modules/Remotes/RemotesModuleActions.hid | 9 +++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 27faac84..352dd006 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -36,6 +36,7 @@ void RemotesModule::initialize() { setupActions( this ); + acRemotesAC->mergeInto( "RemotesMP" ); acRemotesFetchAC->mergeInto( "RemotesFetchMP" ); MacGitver::self().registerView( "Remotes", tr( "Remotes" ), @@ -47,9 +48,17 @@ void RemotesModule::deinitialize() MacGitver::self().unregisterView( "Remotes" ); } -void RemotesModule::onRemoteCreate() +/** + * @brief Menu action to create a remote and add it to a repository. + */ +void RemotesModule::onRemoteCreateEdit() { - RemoteCreateEditDlg().exec(); + // TODO: requires a repository context (the repo to add the remote to) + // To edit an existing remote, the remote context is required + RemoteCreateEditDlg dlg; + //TODO: dlg.setContext( ctx ); + dlg.exec(); +} } /** diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index 11e52adf..67a86fb0 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -38,7 +38,8 @@ class RemotesModule : public Module, public RemotesModuleActions static BlueSky::View* createRemotesView(); private slots: - void onRemoteCreate(); + // RemotesAC + void onRemoteCreateEdit(); private slots: // RemotesFetchAC diff --git a/Modules/Remotes/RemotesModuleActions.hid b/Modules/Remotes/RemotesModuleActions.hid index 9b97c147..3157f63b 100644 --- a/Modules/Remotes/RemotesModuleActions.hid +++ b/Modules/Remotes/RemotesModuleActions.hid @@ -16,10 +16,19 @@ Ui RemotesModuleActions { + Container RemotesAC { + Menu MnuRemotes { + Text "Remotes"; + Action RemoteAdd { + Text "Add Remote ..."; + _ConnectTo onRemoteCreateEdit(); + }; + }; + }; Container RemotesFetchAC { From 1cd7d98d2a2c7d604d14c437ea699ae21c0cbe8c Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 20 Mar 2015 15:30:40 +0100 Subject: [PATCH 04/21] Repository Module: Add menu merge places for "Fetch" and "Remotes" actions --- Modules/Repository/RepoTreeViewCtxMenu.hid | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/Repository/RepoTreeViewCtxMenu.hid b/Modules/Repository/RepoTreeViewCtxMenu.hid index cbedc14f..70164144 100644 --- a/Modules/Repository/RepoTreeViewCtxMenu.hid +++ b/Modules/Repository/RepoTreeViewCtxMenu.hid @@ -16,8 +16,6 @@ Ui RepoTreeViewCtxMenu { - - Action Activate { Text "&Activate"; StatusToolTip "Make this repository the active one."; @@ -34,6 +32,9 @@ Ui RepoTreeViewCtxMenu { Action Activate; Separator; + MergePlace RemotesMP; + MergePlace RemotesFetchMP; + Separator; Action Close; }; From d6d3965350bc98cb8e1066439e5a226b47dab563 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 20 Mar 2015 15:33:59 +0100 Subject: [PATCH 05/21] Remotes Module: minor cleanup in the edit dialog for Git Remotes The dialog is non-functional yet. It could use the (Options ...) technique from the clone dialog to hide the "advanced options". --- Modules/Remotes/RemoteCreateEditDlg.ui | 146 +++++++++++++------------ 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/Modules/Remotes/RemoteCreateEditDlg.ui b/Modules/Remotes/RemoteCreateEditDlg.ui index 05f0b419..29f40538 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.ui +++ b/Modules/Remotes/RemoteCreateEditDlg.ui @@ -6,75 +6,58 @@ 0 0 - 428 - 307 + 438 + 340 - - - - - Remote Server + + + + + URL + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtUrl - - - - - Url - - - txtUrl - - - - - - - true - - - - - - - Name - - - txtName - - - - - - - true - - - - - - - Push Url - - - - - - - false - - - true - - - - - + + + + Enter the full URI to the remote repository + + + true + + + + + + + false + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + - Custom refspec for Fetch + Custom refspecs for Fetch true @@ -139,13 +122,36 @@ - - - - Qt::Horizontal + + + + Alias - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtName + + + + + + + + + + Enter an alias for the Git Remote ... + + + true + + + + + + + Push URL @@ -159,10 +165,6 @@ - txtName - txtUrl - chkPushUrl - txtPushUrl chkRefSpecs treeRefSpecs txtEditRefSpec From 1222dc0d232005e3b053c18306b5c2778ca648b5 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 20 Mar 2015 17:01:36 +0100 Subject: [PATCH 06/21] Remotes Module: add (preview) implementation for menu action "fetch -> all remotes" Also fixes a compile error due to a double closing bracket. Caution: This currently *only* works within a repository context (static cast to RM::Repo)! If used in other contexts, MGV might crash or not behave like expected! --- Modules/Remotes/RemotesModule.cpp | 61 ++++++++++++++++++++++++++++++- Modules/Remotes/RemotesModule.h | 4 ++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 352dd006..bfca88c6 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -16,8 +16,12 @@ #include #include +#include + +#include "libGitWrap/Operations/RemoteOperations.hpp" #include "libMacGitverCore/App/MacGitver.hpp" +#include "libMacGitverCore/RepoMan/Repo.hpp" #include "RemoteCreateEditDlg.h" #include "RemotesModule.h" @@ -59,6 +63,10 @@ void RemotesModule::onRemoteCreateEdit() //TODO: dlg.setContext( ctx ); dlg.exec(); } + +void RemotesModule::onRemoteDelete() +{ + // TODO: requires the remote context (the remote to delete) } /** @@ -66,7 +74,58 @@ void RemotesModule::onRemoteCreateEdit() */ void RemotesModule::onRemotesFetchAll() { - // TODO: requires a RepositoryContext (the repo to fetch all remotes from) + // TODO: requires a repository context (the repo to fetch all remotes from) // A sub-context (i.e. a branch) can further restrict, what is fetched + Heaven::Action* action = qobject_cast< Heaven::Action* >( sender() ); + Q_ASSERT( action ); + RM::Repo* repo = qobject_cast< RM::Repo* >( action->activatedBy() ); + if( repo ) { + Git::Result r; + Git::Repository gitRepo = repo->gitRepo(); + const QStringList aliases( gitRepo.allRemoteNames(r) ); + if ( !r ) { + QMessageBox::warning( 0, tr("Lookup of remotes failed"), + tr("Unable to lookup remotes for repository '%1'." + "\nMessage: %2").arg(repo->displayName()) + .arg(r.errorText()) + ); + return; + } + + if ( aliases.isEmpty() ) { + QMessageBox::information( 0, tr("No Remotes found"), + tr("No remotes configured for repository '%1'.") + .arg(repo->displayName()) + ); + return; + } + + foreach (const QString& alias, aliases) { + Git::FetchOperation* op = new Git::FetchOperation( repo->gitRepo() ); + op->setRemoteAlias( alias ); + op->setBackgroundMode( true ); + connect( op, SIGNAL(finished()), this, SLOT(fetchOperationFinished()) ); + // TODO: create a central dialog to show progress of parallel operations + op->execute(); + } + } +} + +/** + * @brief Called, when an non-blocking Git::Operation finished. + */ +void RemotesModule::onOperationFinished() +{ + Git::BaseOperation* op = qobject_cast( sender() ); + Q_ASSERT( op ); + Git::Result r( op->result() ); + if ( !r ) { + QMessageBox::warning( 0, tr("Operation failed."), + tr("Operation failed. Message:\n %1").arg(r.errorText()) + ); + } + + // delete the operation + op->deleteLater(); } diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index 67a86fb0..9ddf949c 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -40,10 +40,14 @@ class RemotesModule : public Module, public RemotesModuleActions private slots: // RemotesAC void onRemoteCreateEdit(); + void onRemoteDelete(); private slots: // RemotesFetchAC void onRemotesFetchAll(); + +private slots: + void onOperationFinished(); }; #endif From 4a040462001c8588622c07fc4921e5aa745c9e1f Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 01:25:04 +0200 Subject: [PATCH 07/21] Remotes Module: replaced include guards with #pragma once --- Modules/Remotes/RemoteCreateEditDlg.h | 5 +---- Modules/Remotes/RemotesModule.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Modules/Remotes/RemoteCreateEditDlg.h b/Modules/Remotes/RemoteCreateEditDlg.h index 1f55dbc2..9fb964c2 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.h +++ b/Modules/Remotes/RemoteCreateEditDlg.h @@ -14,8 +14,7 @@ * */ -#ifndef MGV_REMOTE_CREATE_EDIT_DLG_H -#define MGV_REMOTE_CREATE_EDIT_DLG_H +#pragma once #include "ui_RemoteCreateEditDlg.h" @@ -43,5 +42,3 @@ private slots: private: Git::Remote mRemote; }; - -#endif diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index 9ddf949c..36f39539 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -14,8 +14,7 @@ * */ -#ifndef MGV_MODULE_REMOTES_H -#define MGV_MODULE_REMOTES_H +#pragma once #include "libMacGitverCore/MacGitver/Module.h" @@ -49,5 +48,3 @@ private slots: private slots: void onOperationFinished(); }; - -#endif From 1014c40ece6b11f98d01b4afdbcb52d9548d7dab Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 18:23:11 +0200 Subject: [PATCH 08/21] add submenu "Active Repository" to "Repository" main menu --- Modules/Repository/RepositoryModule.hid | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/Repository/RepositoryModule.hid b/Modules/Repository/RepositoryModule.hid index 96b7a472..bffe9269 100644 --- a/Modules/Repository/RepositoryModule.hid +++ b/Modules/Repository/RepositoryModule.hid @@ -43,14 +43,21 @@ Ui RepositoryActions { }; + Menu MnuActiveRepo { + Text "Active repository"; + }; + Container RepositoryMenuAC { Action RepositoryOpen; Menu RepoOpenRecent; Separator; + Action RepositoryCreate; Action RepositoryClone; + Separator; + Menu MnuActiveRepo; }; }; From 11822a17f2039ccd6b4f4e1919c69ba1454f1081 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 18:24:40 +0200 Subject: [PATCH 09/21] move "Remotes" merge place to "Active Repository" menu --- Libs/libMacGitverCore/App/MgvPrimaryWindowActions.hid | 1 - Modules/Repository/RepositoryModule.hid | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Libs/libMacGitverCore/App/MgvPrimaryWindowActions.hid b/Libs/libMacGitverCore/App/MgvPrimaryWindowActions.hid index 11a375b5..cf66420b 100644 --- a/Libs/libMacGitverCore/App/MgvPrimaryWindowActions.hid +++ b/Libs/libMacGitverCore/App/MgvPrimaryWindowActions.hid @@ -48,7 +48,6 @@ Ui MgvPrimaryWindowActions { MergePlace ViewsListMP; }; - MergePlace RemotesMP; MergePlace WorkingTreeMP; Menu ToolsMenu { diff --git a/Modules/Repository/RepositoryModule.hid b/Modules/Repository/RepositoryModule.hid index bffe9269..0e6fad0c 100644 --- a/Modules/Repository/RepositoryModule.hid +++ b/Modules/Repository/RepositoryModule.hid @@ -45,6 +45,9 @@ Ui RepositoryActions { Menu MnuActiveRepo { Text "Active repository"; + + MergePlace RemotesMP; + Separator; }; Container RepositoryMenuAC { From 040ef7367432e715d67e5be1f4197d2571c8ee6b Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 18:29:52 +0200 Subject: [PATCH 10/21] reorganize "Remotes" actions This allows us to define different entry points for the fetch/push actions and assign an appropriate action context later. --- Modules/Remotes/RemotesModuleActions.hid | 37 +++++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Modules/Remotes/RemotesModuleActions.hid b/Modules/Remotes/RemotesModuleActions.hid index 3157f63b..e8587557 100644 --- a/Modules/Remotes/RemotesModuleActions.hid +++ b/Modules/Remotes/RemotesModuleActions.hid @@ -18,28 +18,43 @@ Ui RemotesModuleActions { Container RemotesAC { - Menu MnuRemotes { - Text "Remotes"; + Action ManageRemotes { + Text "Remotes ..."; + _ConnectTo onManageRemotes(); + }; + + }; + + Container FetchAC { + + Menu MnuFetch { + Text "Fetch"; - Action RemoteAdd { - Text "Add Remote ..."; - _ConnectTo onRemoteCreateEdit(); + Action FetchAll { + Text "Fetch All Remotes"; + _ConnectTo onFetchAllRemotes(); }; + Separator; + // TODO: Add DAM to fetch a single Remote }; + }; - Container RemotesFetchAC { + Container PushAC { - Menu MnuFetch { - Text "Fetch"; + Menu MnuPush { + Text "Push"; - Action RemotesFetchAll { - Text "All Remotes"; - _ConnectTo onRemotesFetchAll(); + Action PushToAll { + Text "Push To All Remotes"; + _ConnectTo onPushToAllRemotes(); }; + Separator; + + // TODO: Add DAM to push to a single Remote }; }; From 363af46633b59b526296c576bcba440755f9d81f Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 18:39:07 +0200 Subject: [PATCH 11/21] insert the "Remotes" merge places into the appropriate menus The menu structure is also meant to be integrated in the reference and history view later. --- Modules/Remotes/RemotesModule.cpp | 5 +++-- Modules/Repository/RepoTreeViewCtxMenu.hid | 8 +++++++- Modules/Repository/RepositoryModule.hid | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index bfca88c6..2caa2f8e 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -40,8 +40,9 @@ void RemotesModule::initialize() { setupActions( this ); - acRemotesAC->mergeInto( "RemotesMP" ); - acRemotesFetchAC->mergeInto( "RemotesFetchMP" ); + acRemotesAC->mergeInto( "RemotesMP" ); + acFetchAC->mergeInto( "FetchMP" ); + acPushAC->mergeInto( "PushMP" ); MacGitver::self().registerView( "Remotes", tr( "Remotes" ), &RemotesModule::createRemotesView ); diff --git a/Modules/Repository/RepoTreeViewCtxMenu.hid b/Modules/Repository/RepoTreeViewCtxMenu.hid index 70164144..b2324935 100644 --- a/Modules/Repository/RepoTreeViewCtxMenu.hid +++ b/Modules/Repository/RepoTreeViewCtxMenu.hid @@ -32,9 +32,11 @@ Ui RepoTreeViewCtxMenu { Action Activate; Separator; + MergePlace RemotesMP; - MergePlace RemotesFetchMP; + MergePlace FetchMP; Separator; + Action Close; }; @@ -42,7 +44,11 @@ Ui RepoTreeViewCtxMenu { Menu CtxMenuSMRepo { Action Activate; + Separator; + MergePlace RemotesMP; + MergePlace FetchMP; + Separator; }; }; diff --git a/Modules/Repository/RepositoryModule.hid b/Modules/Repository/RepositoryModule.hid index 0e6fad0c..9e9fc17b 100644 --- a/Modules/Repository/RepositoryModule.hid +++ b/Modules/Repository/RepositoryModule.hid @@ -48,6 +48,9 @@ Ui RepositoryActions { MergePlace RemotesMP; Separator; + + MergePlace FetchMP; + MergePlace PushMP; }; Container RepositoryMenuAC { From 0d25b51003e4c3db43b42af2f34552f6a5788b3a Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 23:09:12 +0200 Subject: [PATCH 12/21] Remotes Module: remove unused class RemotesView and related code --- Modules/Remotes/CMakeLists.txt | 4 --- Modules/Remotes/RemotesModule.cpp | 9 ----- Modules/Remotes/RemotesModule.h | 3 -- Modules/Remotes/RemotesView.cpp | 48 -------------------------- Modules/Remotes/RemotesView.h | 38 -------------------- Modules/Remotes/RemotesViewContext.cpp | 36 ------------------- Modules/Remotes/RemotesViewContext.h | 39 --------------------- 7 files changed, 177 deletions(-) delete mode 100644 Modules/Remotes/RemotesView.cpp delete mode 100644 Modules/Remotes/RemotesView.h delete mode 100644 Modules/Remotes/RemotesViewContext.cpp delete mode 100644 Modules/Remotes/RemotesViewContext.h diff --git a/Modules/Remotes/CMakeLists.txt b/Modules/Remotes/CMakeLists.txt index f76cf72a..4716e1e0 100644 --- a/Modules/Remotes/CMakeLists.txt +++ b/Modules/Remotes/CMakeLists.txt @@ -11,16 +11,12 @@ INCLUDE_DIRECTORIES( BEFORE SET( SRC_FILES RemotesModule.cpp - RemotesView.cpp - RemotesViewContext.cpp RemoteCreateEditDlg.cpp ) SET( HDR_FILES RemotesModule.h - RemotesView.h - RemotesViewContext.h RemoteCreateEditDlg.h ) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 2caa2f8e..399623b2 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -25,17 +25,11 @@ #include "RemoteCreateEditDlg.h" #include "RemotesModule.h" -#include "RemotesView.h" RemotesModule::RemotesModule() { } -BlueSky::View* RemotesModule::createRemotesView() -{ - return new RemotesView; -} - void RemotesModule::initialize() { setupActions( this ); @@ -43,9 +37,6 @@ void RemotesModule::initialize() acRemotesAC->mergeInto( "RemotesMP" ); acFetchAC->mergeInto( "FetchMP" ); acPushAC->mergeInto( "PushMP" ); - - MacGitver::self().registerView( "Remotes", tr( "Remotes" ), - &RemotesModule::createRemotesView ); } void RemotesModule::deinitialize() diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index 36f39539..f8e95014 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -33,9 +33,6 @@ class RemotesModule : public Module, public RemotesModuleActions void initialize(); void deinitialize(); -private: - static BlueSky::View* createRemotesView(); - private slots: // RemotesAC void onRemoteCreateEdit(); diff --git a/Modules/Remotes/RemotesView.cpp b/Modules/Remotes/RemotesView.cpp deleted file mode 100644 index b7f56836..00000000 --- a/Modules/Remotes/RemotesView.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012 Sascha Cunz - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * 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, see . - * - */ - -#include - -#include "RemotesView.h" -#include "RemotesViewContext.h" - -RemotesView::RemotesView() - : View( "Remotes" ) - , mCtx( NULL ) -{ - mTreeView = new QTreeView(); - mTreeView->setFrameShape( QFrame::NoFrame ); - - setWidget( mTreeView ); - - setViewName( trUtf8( "Remotes" ) ); -} - -/* -Heaven::ViewContext* RemotesView::createContext() -{ - return new RemotesViewContext; -} - -void RemotesView::setContext( Heaven::ViewContext* context ) -{ - //GlobalView::setContext( context ); - mCtx = qobject_cast< RemotesViewContext* >( context ); - Q_ASSERT( mCtx ); - - mTreeView->setModel( mCtx->model() ); -} -*/ diff --git a/Modules/Remotes/RemotesView.h b/Modules/Remotes/RemotesView.h deleted file mode 100644 index f42b9656..00000000 --- a/Modules/Remotes/RemotesView.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012 Sascha Cunz - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * 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, see . - * - */ - -#pragma once - -#include "libBlueSky/Views.hpp" - -class QTreeView; - -class RemotesViewContext; - -class RemotesView : public BlueSky::View -{ - Q_OBJECT -public: - RemotesView(); - -protected: - //Heaven::ViewContext* createContext(); - //void setContext( Heaven::ViewContext* context ); - -private: - RemotesViewContext* mCtx; - QTreeView* mTreeView; -}; diff --git a/Modules/Remotes/RemotesViewContext.cpp b/Modules/Remotes/RemotesViewContext.cpp deleted file mode 100644 index 734d060c..00000000 --- a/Modules/Remotes/RemotesViewContext.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012 Sascha Cunz - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * 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, see . - * - */ - -#include - -#include "libMacGitverCore/App/MacGitver.hpp" - -#include "RemotesViewContext.h" - -RemotesViewContext::RemotesViewContext() - : ViewContext() - , mModel( NULL ) -{ - connect( &MacGitver::self(), SIGNAL(repositoryChanged(Git::Repository)), - this, SLOT(repositoryChanged(Git::Repository)) ); - - mModel = new QStandardItemModel( 0, 1, this ); -} - -QAbstractItemModel* RemotesViewContext::model() -{ - return mModel; -} diff --git a/Modules/Remotes/RemotesViewContext.h b/Modules/Remotes/RemotesViewContext.h deleted file mode 100644 index 83e30155..00000000 --- a/Modules/Remotes/RemotesViewContext.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * MacGitver - * Copyright (C) 2012 Sascha Cunz - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License (Version 2) as published by the Free Software Foundation. - * - * 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, see . - * - */ - -#ifndef MGV_REMOTES_VIEW_CONTEXT_H -#define MGV_REMOTES_VIEW_CONTEXT_H - -#include "libBlueSky/Contexts.hpp" - -class QAbstractItemModel; -class QStandardItem; -class QStandardItemModel; - -class RemotesViewContext : public BlueSky::ViewContext -{ - Q_OBJECT -public: - RemotesViewContext(); - -public: - QAbstractItemModel* model(); - -private: - QStandardItemModel* mModel; -}; - -#endif From 9025dc9819e97a19223aec5db95560038c605c38 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 30 Mar 2015 23:31:20 +0200 Subject: [PATCH 13/21] Remotes Module: add skeletons for the action slots and a dialog to edit Remotes --- Modules/Remotes/RemoteCreateEditDlg.cpp | 214 ++++++++++++++++++++---- Modules/Remotes/RemoteCreateEditDlg.h | 42 ++++- Modules/Remotes/RemoteCreateEditDlg.ui | 192 ++++++++++++--------- Modules/Remotes/RemotesModule.cpp | 31 ++-- Modules/Remotes/RemotesModule.h | 11 +- 5 files changed, 354 insertions(+), 136 deletions(-) diff --git a/Modules/Remotes/RemoteCreateEditDlg.cpp b/Modules/Remotes/RemoteCreateEditDlg.cpp index eb1b152a..be25817a 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.cpp +++ b/Modules/Remotes/RemoteCreateEditDlg.cpp @@ -16,60 +16,216 @@ #include "RemoteCreateEditDlg.h" -RemoteCreateEditDlg::RemoteCreateEditDlg() +#include "libMacGitverCore/RepoMan/Remote.hpp" +#include "libMacGitverCore/RepoMan/Repo.hpp" + +#include + + +RemoteCreateEditDlg::RemoteCreateEditDlg(RM::Repo* repo) { - setupUi( this ); - setWindowTitle( trUtf8( "Create remote" ) ); + setupUi(this); init(); + + if (!repo) { + // TODO: this should never happen and we should assert out here. + setEnabled(false); + setWindowTitle( tr("Error: Needs a repository context!") ); + return; + } + + setWindowTitle( tr("Manage the Remotes in \"%1\"").arg(repo->displayName()) ); + + txtRemotes->installEventFilter(this); } -RemoteCreateEditDlg::RemoteCreateEditDlg( Git::Remote remote ) +void RemoteCreateEditDlg::init() { - setupUi( this ); - setWindowTitle( trUtf8( "Edit remote" ) ); - init(); + connect( txtPushUrl, &QLineEdit::textChanged, + this, &RemoteCreateEditDlg::checkValid ); +} - mRemote = remote; - txtName->setText( mRemote.name() ); - txtUrl->setText( mRemote.url() ); +void RemoteCreateEditDlg::updateValues(const QString& remoteAlias) +{ + // TODO: implement dialog update + //RM::Remote* remote = mRepoContext->remotes(remoteName); + //txtUrl->setText( remote ? remote->url() : QString() ); + //txtPushUrl->setText( remote ? remote->pushUrl() : QString() ); + //treeRefSpecs->model()->setRemote(remote); } -void RemoteCreateEditDlg::init() +/** + * @internal + * @brief Clear the fields for the current selected Remote. + */ +void RemoteCreateEditDlg::clear() { - connect( txtName, SIGNAL(textChanged(QString)), this, SLOT(onNameChanged(QString)) ); - connect( txtUrl, SIGNAL(textChanged(QString)), this, SLOT(onUrlChanged(QString)) ); - connect( txtPushUrl, SIGNAL(textChanged(QString)), this, SLOT(checkValid()) ); + txtEditRefSpec->clear(); + txtUrl->clear(); + txtPushUrl->clear(); + treeRefSpecs->setModel(nullptr); } -void RemoteCreateEditDlg::onNameChanged( const QString& newName ) +bool RemoteCreateEditDlg::modeCanEnter(RemoteCreateEditDlg::EditMode mode) const { - if( !chkRefSpecs->isChecked() ) - { - // ... + if (mode == EditMode::Rename) { + return txtRemotes->currentIndex() > -1; } - checkValid(); + + return true; } -void RemoteCreateEditDlg::onUrlChanged( const QString& newUrl ) +void RemoteCreateEditDlg::modeEnter(EditMode mode) { - if( !chkPushUrl->isChecked() ) - { - txtPushUrl->setText( newUrl ); + Q_ASSERT(mMode == EditMode::Edit); + if (!modeCanEnter(mode)) { + return; } - checkValid(); + + mMode = mode; + + btnAddRemote->setEnabled(false); + btnDeleteRemote->setEnabled(false); + txtRemotes->setEditable(true); + + switch (mMode) { + case EditMode::Create: + + txtRemotes->lineEdit()->setPlaceholderText(tr("Enter a name ...")); + //txtRemotes->lineEdit()->clear(); + txtUrl->setPlaceholderText(tr("Enter a URL for the new Remote ...")); + clear(); + + break; + + case EditMode::Rename: + txtRemotes->lineEdit()->setText(txtRemotes->currentText()); + txtRemotes->lineEdit()->selectAll(); + + break; + + case EditMode::Edit: + default: + break; + } + + txtRemotes->setFocus(); +} + +void RemoteCreateEditDlg::modeLeave(bool accept) +{ + if (accept) { + switch (mMode) { + case EditMode::Create: + { + QString remoteAlias = txtRemotes->lineEdit()->text(); + // TODO: implementation to create an RM::Remote + qCritical("Not implemented yet: Create a Remote via RepoMan."); + break; + } + + case EditMode::Rename: + { + QString oldRemoteAlias = txtRemotes->currentText(); + QString newRemoteAlias = txtRemotes->lineEdit()->text(); + // TODO: implementation to rename an RM::Remote + qCritical("Not implemented yet: Rename a Remote via RepoMan."); + break; + } + + case EditMode::Edit: + default: + break; + } + } + + txtUrl->setPlaceholderText(QString()); + btnAddRemote->setEnabled(true); + btnDeleteRemote->setEnabled(true); + txtRemotes->setEditable(false); + txtRemotes->update(); + + // switch to default mode + mMode = EditMode::Edit; } void RemoteCreateEditDlg::checkValid() { - bool okay = - !txtName->text().isEmpty() && - !txtUrl->text().isEmpty() && - ( !chkPushUrl->isChecked() || - ( chkPushUrl->isChecked() && !txtPushUrl->text().isEmpty() ) ); + bool okay = !txtRemotes->currentText().isEmpty(); + okay &= !txtUrl->text().isEmpty(); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( okay ); + buttonBox->button( QDialogButtonBox::Apply )->setEnabled( okay ); } void RemoteCreateEditDlg::accept() { + if (mMode == EditMode::Edit) { + QDialog::accept(); + } + else { + modeLeave(true); + } +} + +void RemoteCreateEditDlg::on_btnAddRemote_clicked() +{ + modeEnter(EditMode::Create); +} + +void RemoteCreateEditDlg::on_btnDeleteRemote_clicked() +{ + int r = QMessageBox::question(this, tr("Delete selected Remote?"), + tr("Delete the Remote \"%1\" from the repository \"%2\"?") + .arg(txtRemotes->currentText()).arg(mRepoContext->displayName())); + if (r == QMessageBox::Yes) { + // TODO: implement deletion of selected Remote + } +} + +void RemoteCreateEditDlg::on_txtRemotes_currentIndexChanged(const QString &remoteAlias) +{ + btnDeleteRemote->setEnabled( txtRemotes->currentIndex() > -1 ); + updateValues(remoteAlias); +} + +void RemoteCreateEditDlg::on_txtUrl_textChanged( const QString& newUrl ) +{ + if( !chkPushUrl->isChecked() ) { + txtPushUrl->setText( newUrl ); + } + checkValid(); +} + +void RemoteCreateEditDlg::reject() +{ + if (mMode != EditMode::Edit) { + modeLeave(false); + } + else { + QDialog::reject(); + } +} + +/** + * @internal + * + * @brief Handles the double-click for the remotes combo box. + * + * @param o the event sender + * + * @param e the event + * + * @return + */ +bool RemoteCreateEditDlg::eventFilter(QObject* o, QEvent* e) +{ + if (Q_LIKELY(o == txtRemotes)) { + if (e->type() == QEvent::MouseButtonDblClick) { + modeEnter(EditMode::Rename); + return true; + } + } + + return QObject::eventFilter(o, e); } diff --git a/Modules/Remotes/RemoteCreateEditDlg.h b/Modules/Remotes/RemoteCreateEditDlg.h index 9fb964c2..8b99c9c4 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.h +++ b/Modules/Remotes/RemoteCreateEditDlg.h @@ -18,27 +18,55 @@ #include "ui_RemoteCreateEditDlg.h" -#include "libGitWrap/Remote.hpp" +namespace RM +{ + class Repo; +} class RemoteCreateEditDlg : public QDialog, private Ui::RemoteCreateEditDlg { Q_OBJECT + +public: + enum EditMode + { + Edit = 0, + Create, + Rename + }; + public: - RemoteCreateEditDlg(); - RemoteCreateEditDlg( Git::Remote remote ); + RemoteCreateEditDlg(RM::Repo* repo); private: void init(); private: + // virtual slots void accept(); + void reject(); -private slots: - void onNameChanged( const QString& newName ); - void onUrlChanged( const QString& newUrl ); +private: + bool eventFilter(QObject* o, QEvent* e); + void updateValues(const QString &remoteAlias); + void clear(); + + bool modeCanEnter(EditMode mode) const; + void modeEnter(EditMode mode); + void modeLeave(bool accept); + +private slots: void checkValid(); +private slots: + // auto-connected ui slots + void on_btnAddRemote_clicked(); + void on_btnDeleteRemote_clicked(); + void on_txtRemotes_currentIndexChanged(const QString &remoteAlias); + void on_txtUrl_textChanged(const QString& newUrl); + private: - Git::Remote mRemote; + RM::Repo* mRepoContext = nullptr; + EditMode mMode = EditMode::Edit; }; diff --git a/Modules/Remotes/RemoteCreateEditDlg.ui b/Modules/Remotes/RemoteCreateEditDlg.ui index 29f40538..ec346c67 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.ui +++ b/Modules/Remotes/RemoteCreateEditDlg.ui @@ -6,13 +6,78 @@ 0 0 - 438 - 340 + 381 + 332 - + + + + + + + 0 + 0 + + + + Git Remote + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <p>Select the Git Remote, you like to edit.<br/></p> +<p>Tip: Double-Click to rename a selected Remote.</b> + + + + + + + + Add a new Remote. + + + + + + + + + + + false + + + Delete this Remote. + + + - + + + + + + + + + Qt::Horizontal + + + + + + + 0 + 0 + + URL @@ -24,17 +89,27 @@ - + - - Enter the full URI to the remote repository - true - + + + + + 0 + 0 + + + + Push URL + + + + false @@ -44,17 +119,7 @@ - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + Custom refspecs for Fetch @@ -66,6 +131,23 @@ false + + + + + + + Update + + + + + + + Remove + + + @@ -73,9 +155,6 @@ - - - @@ -92,66 +171,13 @@ - - - - Remove - - - - - - - Update - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Alias - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - txtName - - - - - - - - - - Enter an alias for the Git Remote ... - - - true - - - - - - - Push URL + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -214,12 +240,12 @@ setEnabled(bool) - 61 - 103 + 70 + 128 - 106 - 99 + 203 + 129 diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 399623b2..5190c2d2 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -21,7 +21,7 @@ #include "libGitWrap/Operations/RemoteOperations.hpp" #include "libMacGitverCore/App/MacGitver.hpp" -#include "libMacGitverCore/RepoMan/Repo.hpp" +#include "libMacGitverCore/RepoMan/RepoMan.hpp" #include "RemoteCreateEditDlg.h" #include "RemotesModule.h" @@ -47,24 +47,23 @@ void RemotesModule::deinitialize() /** * @brief Menu action to create a remote and add it to a repository. */ -void RemotesModule::onRemoteCreateEdit() +void RemotesModule::onManageRemotes() { - // TODO: requires a repository context (the repo to add the remote to) - // To edit an existing remote, the remote context is required - RemoteCreateEditDlg dlg; - //TODO: dlg.setContext( ctx ); - dlg.exec(); -} + Heaven::Action* a = qobject_cast( sender() ); + Q_ASSERT(a); -void RemotesModule::onRemoteDelete() -{ - // TODO: requires the remote context (the remote to delete) + // TODO: reliably determine the repository context + QObject* actionCtx = a->activatedBy(); + RM::Repo* repoCtx = actionCtx ? static_cast( actionCtx ) + : MacGitver::repoMan().activeRepository(); + + RemoteCreateEditDlg( repoCtx ).exec(); } /** * @brief Menu action to fetch all remotes of a repository. */ -void RemotesModule::onRemotesFetchAll() +void RemotesModule::onFetchAllRemotes() { // TODO: requires a repository context (the repo to fetch all remotes from) // A sub-context (i.e. a branch) can further restrict, what is fetched @@ -96,13 +95,19 @@ void RemotesModule::onRemotesFetchAll() Git::FetchOperation* op = new Git::FetchOperation( repo->gitRepo() ); op->setRemoteAlias( alias ); op->setBackgroundMode( true ); - connect( op, SIGNAL(finished()), this, SLOT(fetchOperationFinished()) ); + connect( op, &Git::FetchOperation::finished, + this, &RemotesModule::onOperationFinished ); // TODO: create a central dialog to show progress of parallel operations op->execute(); } } } +void RemotesModule::onPushToAllRemotes() +{ + // TODO: implementation +} + /** * @brief Called, when an non-blocking Git::Operation finished. */ diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index f8e95014..858c8c1f 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -35,12 +35,15 @@ class RemotesModule : public Module, public RemotesModuleActions private slots: // RemotesAC - void onRemoteCreateEdit(); - void onRemoteDelete(); + void onManageRemotes(); private slots: - // RemotesFetchAC - void onRemotesFetchAll(); + // FetchAC + void onFetchAllRemotes(); + +private slots: + // PushAC + void onPushToAllRemotes(); private slots: void onOperationFinished(); From 634d26075f35c9f891693ce67247565c8d11617c Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Tue, 31 Mar 2015 10:06:10 +0200 Subject: [PATCH 14/21] Remotes Module: fixed minor crash due to invalid "apply" button --- Modules/Remotes/RemoteCreateEditDlg.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/Remotes/RemoteCreateEditDlg.cpp b/Modules/Remotes/RemoteCreateEditDlg.cpp index be25817a..118e25a0 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.cpp +++ b/Modules/Remotes/RemoteCreateEditDlg.cpp @@ -155,7 +155,6 @@ void RemoteCreateEditDlg::checkValid() okay &= !txtUrl->text().isEmpty(); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( okay ); - buttonBox->button( QDialogButtonBox::Apply )->setEnabled( okay ); } void RemoteCreateEditDlg::accept() From e53d07a146e9fd6138bd3b82040866195eef4c6e Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Wed, 1 Apr 2015 12:36:05 +0200 Subject: [PATCH 15/21] Remotes Module: added "FetchThis" action container This is meant to limit the fetch context and thus requires a single "Remote" or "remote branch" context. --- Modules/Remotes/RemotesModule.cpp | 7 +++++++ Modules/Remotes/RemotesModule.h | 3 +++ Modules/Remotes/RemotesModuleActions.hid | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 5190c2d2..cb636034 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -36,6 +36,7 @@ void RemotesModule::initialize() acRemotesAC->mergeInto( "RemotesMP" ); acFetchAC->mergeInto( "FetchMP" ); + acFetchThisAC->mergeInto( "FetchThisMP" ); acPushAC->mergeInto( "PushMP" ); } @@ -103,6 +104,12 @@ void RemotesModule::onFetchAllRemotes() } } +void RemotesModule::onFetchThis() +{ + // TODO: implementation + // Requires a "remote" or "remote branch" context. +} + void RemotesModule::onPushToAllRemotes() { // TODO: implementation diff --git a/Modules/Remotes/RemotesModule.h b/Modules/Remotes/RemotesModule.h index 858c8c1f..e1979bae 100644 --- a/Modules/Remotes/RemotesModule.h +++ b/Modules/Remotes/RemotesModule.h @@ -41,6 +41,9 @@ private slots: // FetchAC void onFetchAllRemotes(); + // FetchThisAC + void onFetchThis(); + private slots: // PushAC void onPushToAllRemotes(); diff --git a/Modules/Remotes/RemotesModuleActions.hid b/Modules/Remotes/RemotesModuleActions.hid index e8587557..2c07f6e9 100644 --- a/Modules/Remotes/RemotesModuleActions.hid +++ b/Modules/Remotes/RemotesModuleActions.hid @@ -42,6 +42,15 @@ Ui RemotesModuleActions { }; + Container FetchThisAC { + + Action FetchThis { + Text "Fetch This"; + _ConnectTo onFetchThis(); + }; + + }; + Container PushAC { Menu MnuPush { From 6efaa96ff88148a6725602cdc0179858d0a1ae32 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Thu, 2 Apr 2015 10:49:00 +0200 Subject: [PATCH 16/21] Remotes Module: renamed class "RemotesCreateEditDlg" -> "RemotesDlg" --- Modules/Remotes/CMakeLists.txt | 6 ++-- ...RemoteCreateEditDlg.cpp => RemotesDlg.cpp} | 34 +++++++++---------- .../{RemoteCreateEditDlg.h => RemotesDlg.h} | 6 ++-- .../{RemoteCreateEditDlg.ui => RemotesDlg.ui} | 8 ++--- Modules/Remotes/RemotesModule.cpp | 4 +-- 5 files changed, 29 insertions(+), 29 deletions(-) rename Modules/Remotes/{RemoteCreateEditDlg.cpp => RemotesDlg.cpp} (84%) rename Modules/Remotes/{RemoteCreateEditDlg.h => RemotesDlg.h} (90%) rename Modules/Remotes/{RemoteCreateEditDlg.ui => RemotesDlg.ui} (97%) diff --git a/Modules/Remotes/CMakeLists.txt b/Modules/Remotes/CMakeLists.txt index 4716e1e0..c1ad82e4 100644 --- a/Modules/Remotes/CMakeLists.txt +++ b/Modules/Remotes/CMakeLists.txt @@ -11,18 +11,18 @@ INCLUDE_DIRECTORIES( BEFORE SET( SRC_FILES RemotesModule.cpp - RemoteCreateEditDlg.cpp + RemotesDlg.cpp ) SET( HDR_FILES RemotesModule.h - RemoteCreateEditDlg.h + RemotesDlg.h ) SET( UI_FILES - RemoteCreateEditDlg.ui + RemotesDlg.ui ) SET( HID_FILES diff --git a/Modules/Remotes/RemoteCreateEditDlg.cpp b/Modules/Remotes/RemotesDlg.cpp similarity index 84% rename from Modules/Remotes/RemoteCreateEditDlg.cpp rename to Modules/Remotes/RemotesDlg.cpp index 118e25a0..17238467 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.cpp +++ b/Modules/Remotes/RemotesDlg.cpp @@ -14,7 +14,7 @@ * */ -#include "RemoteCreateEditDlg.h" +#include "RemotesDlg.h" #include "libMacGitverCore/RepoMan/Remote.hpp" #include "libMacGitverCore/RepoMan/Repo.hpp" @@ -22,7 +22,7 @@ #include -RemoteCreateEditDlg::RemoteCreateEditDlg(RM::Repo* repo) +RemotesDlg::RemotesDlg(RM::Repo* repo) { setupUi(this); init(); @@ -39,13 +39,13 @@ RemoteCreateEditDlg::RemoteCreateEditDlg(RM::Repo* repo) txtRemotes->installEventFilter(this); } -void RemoteCreateEditDlg::init() +void RemotesDlg::init() { connect( txtPushUrl, &QLineEdit::textChanged, - this, &RemoteCreateEditDlg::checkValid ); + this, &RemotesDlg::checkValid ); } -void RemoteCreateEditDlg::updateValues(const QString& remoteAlias) +void RemotesDlg::updateValues(const QString& remoteAlias) { // TODO: implement dialog update //RM::Remote* remote = mRepoContext->remotes(remoteName); @@ -58,7 +58,7 @@ void RemoteCreateEditDlg::updateValues(const QString& remoteAlias) * @internal * @brief Clear the fields for the current selected Remote. */ -void RemoteCreateEditDlg::clear() +void RemotesDlg::clear() { txtEditRefSpec->clear(); txtUrl->clear(); @@ -66,7 +66,7 @@ void RemoteCreateEditDlg::clear() treeRefSpecs->setModel(nullptr); } -bool RemoteCreateEditDlg::modeCanEnter(RemoteCreateEditDlg::EditMode mode) const +bool RemotesDlg::modeCanEnter(RemotesDlg::EditMode mode) const { if (mode == EditMode::Rename) { return txtRemotes->currentIndex() > -1; @@ -75,7 +75,7 @@ bool RemoteCreateEditDlg::modeCanEnter(RemoteCreateEditDlg::EditMode mode) const return true; } -void RemoteCreateEditDlg::modeEnter(EditMode mode) +void RemotesDlg::modeEnter(EditMode mode) { Q_ASSERT(mMode == EditMode::Edit); if (!modeCanEnter(mode)) { @@ -112,7 +112,7 @@ void RemoteCreateEditDlg::modeEnter(EditMode mode) txtRemotes->setFocus(); } -void RemoteCreateEditDlg::modeLeave(bool accept) +void RemotesDlg::modeLeave(bool accept) { if (accept) { switch (mMode) { @@ -149,7 +149,7 @@ void RemoteCreateEditDlg::modeLeave(bool accept) mMode = EditMode::Edit; } -void RemoteCreateEditDlg::checkValid() +void RemotesDlg::checkValid() { bool okay = !txtRemotes->currentText().isEmpty(); okay &= !txtUrl->text().isEmpty(); @@ -157,7 +157,7 @@ void RemoteCreateEditDlg::checkValid() buttonBox->button( QDialogButtonBox::Ok )->setEnabled( okay ); } -void RemoteCreateEditDlg::accept() +void RemotesDlg::accept() { if (mMode == EditMode::Edit) { QDialog::accept(); @@ -167,12 +167,12 @@ void RemoteCreateEditDlg::accept() } } -void RemoteCreateEditDlg::on_btnAddRemote_clicked() +void RemotesDlg::on_btnAddRemote_clicked() { modeEnter(EditMode::Create); } -void RemoteCreateEditDlg::on_btnDeleteRemote_clicked() +void RemotesDlg::on_btnDeleteRemote_clicked() { int r = QMessageBox::question(this, tr("Delete selected Remote?"), tr("Delete the Remote \"%1\" from the repository \"%2\"?") @@ -182,13 +182,13 @@ void RemoteCreateEditDlg::on_btnDeleteRemote_clicked() } } -void RemoteCreateEditDlg::on_txtRemotes_currentIndexChanged(const QString &remoteAlias) +void RemotesDlg::on_txtRemotes_currentIndexChanged(const QString &remoteAlias) { btnDeleteRemote->setEnabled( txtRemotes->currentIndex() > -1 ); updateValues(remoteAlias); } -void RemoteCreateEditDlg::on_txtUrl_textChanged( const QString& newUrl ) +void RemotesDlg::on_txtUrl_textChanged( const QString& newUrl ) { if( !chkPushUrl->isChecked() ) { txtPushUrl->setText( newUrl ); @@ -196,7 +196,7 @@ void RemoteCreateEditDlg::on_txtUrl_textChanged( const QString& newUrl ) checkValid(); } -void RemoteCreateEditDlg::reject() +void RemotesDlg::reject() { if (mMode != EditMode::Edit) { modeLeave(false); @@ -217,7 +217,7 @@ void RemoteCreateEditDlg::reject() * * @return */ -bool RemoteCreateEditDlg::eventFilter(QObject* o, QEvent* e) +bool RemotesDlg::eventFilter(QObject* o, QEvent* e) { if (Q_LIKELY(o == txtRemotes)) { if (e->type() == QEvent::MouseButtonDblClick) { diff --git a/Modules/Remotes/RemoteCreateEditDlg.h b/Modules/Remotes/RemotesDlg.h similarity index 90% rename from Modules/Remotes/RemoteCreateEditDlg.h rename to Modules/Remotes/RemotesDlg.h index 8b99c9c4..6012df5b 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.h +++ b/Modules/Remotes/RemotesDlg.h @@ -16,14 +16,14 @@ #pragma once -#include "ui_RemoteCreateEditDlg.h" +#include "ui_RemotesDlg.h" namespace RM { class Repo; } -class RemoteCreateEditDlg : public QDialog, private Ui::RemoteCreateEditDlg +class RemotesDlg : public QDialog, private Ui::RemotesDlg { Q_OBJECT @@ -36,7 +36,7 @@ class RemoteCreateEditDlg : public QDialog, private Ui::RemoteCreateEditDlg }; public: - RemoteCreateEditDlg(RM::Repo* repo); + RemotesDlg(RM::Repo* repo); private: void init(); diff --git a/Modules/Remotes/RemoteCreateEditDlg.ui b/Modules/Remotes/RemotesDlg.ui similarity index 97% rename from Modules/Remotes/RemoteCreateEditDlg.ui rename to Modules/Remotes/RemotesDlg.ui index ec346c67..6b560d2a 100644 --- a/Modules/Remotes/RemoteCreateEditDlg.ui +++ b/Modules/Remotes/RemotesDlg.ui @@ -1,7 +1,7 @@ - RemoteCreateEditDlg - + RemotesDlg + 0 @@ -204,7 +204,7 @@ buttonBox accepted() - RemoteCreateEditDlg + RemotesDlg accept() @@ -220,7 +220,7 @@ buttonBox rejected() - RemoteCreateEditDlg + RemotesDlg reject() diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index cb636034..33df47bf 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -23,7 +23,7 @@ #include "libMacGitverCore/App/MacGitver.hpp" #include "libMacGitverCore/RepoMan/RepoMan.hpp" -#include "RemoteCreateEditDlg.h" +#include "RemotesDlg.h" #include "RemotesModule.h" RemotesModule::RemotesModule() @@ -58,7 +58,7 @@ void RemotesModule::onManageRemotes() RM::Repo* repoCtx = actionCtx ? static_cast( actionCtx ) : MacGitver::repoMan().activeRepository(); - RemoteCreateEditDlg( repoCtx ).exec(); + RemotesDlg( repoCtx ).exec(); } /** From 4b19af046b7f03fddb55098f126711079ffb49cd Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Mon, 6 Apr 2015 17:34:24 +0200 Subject: [PATCH 17/21] Remotes Module: inherit "Remotes" dialog from BlueSky::Dialog Sets the parent to the main window. --- Modules/Remotes/RemotesDlg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/Remotes/RemotesDlg.h b/Modules/Remotes/RemotesDlg.h index 6012df5b..bea3e717 100644 --- a/Modules/Remotes/RemotesDlg.h +++ b/Modules/Remotes/RemotesDlg.h @@ -16,6 +16,8 @@ #pragma once +#include "libBlueSky/Dialog.hpp" + #include "ui_RemotesDlg.h" namespace RM @@ -23,7 +25,7 @@ namespace RM class Repo; } -class RemotesDlg : public QDialog, private Ui::RemotesDlg +class RemotesDlg : public BlueSky::Dialog, private Ui::RemotesDlg { Q_OBJECT From c0da2a97774ea46a8a6176fe046d8dbed1d8a9e1 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Wed, 8 Apr 2015 15:55:17 +0200 Subject: [PATCH 18/21] Remotes Module: reimplement RemotesDlg based on ExpandableDlg --- Modules/Remotes/CMakeLists.txt | 3 +- Modules/Remotes/RemotesDlg.cpp | 105 ++++++----- Modules/Remotes/RemotesDlg.h | 43 ++++- Modules/Remotes/RemotesDlg.ui | 253 -------------------------- Modules/Remotes/RemotesOptionsWdgt.ui | 106 +++++++++++ Modules/Remotes/RemotesWdgt.ui | 113 ++++++++++++ 6 files changed, 316 insertions(+), 307 deletions(-) delete mode 100644 Modules/Remotes/RemotesDlg.ui create mode 100644 Modules/Remotes/RemotesOptionsWdgt.ui create mode 100644 Modules/Remotes/RemotesWdgt.ui diff --git a/Modules/Remotes/CMakeLists.txt b/Modules/Remotes/CMakeLists.txt index c1ad82e4..7a5604bd 100644 --- a/Modules/Remotes/CMakeLists.txt +++ b/Modules/Remotes/CMakeLists.txt @@ -22,7 +22,8 @@ SET( HDR_FILES SET( UI_FILES - RemotesDlg.ui + RemotesOptionsWdgt.ui + RemotesWdgt.ui ) SET( HID_FILES diff --git a/Modules/Remotes/RemotesDlg.cpp b/Modules/Remotes/RemotesDlg.cpp index 17238467..eb56e26e 100644 --- a/Modules/Remotes/RemotesDlg.cpp +++ b/Modules/Remotes/RemotesDlg.cpp @@ -21,11 +21,31 @@ #include +RemotesOptionsWdgt::RemotesOptionsWdgt() +{ + setupUi(this); +} -RemotesDlg::RemotesDlg(RM::Repo* repo) + +RemotesWdgt::RemotesWdgt() { setupUi(this); - init(); +} + + +RemotesDlg::RemotesDlg(RM::Repo* repo) +{ + setDialogWidgets(mRemotesWdgt, mRemotesOptsWdgt); + + connect(mRemotesWdgt->btnAddRemote, &QAbstractButton::clicked, + this, &RemotesDlg::onAddRemote); + connect(mRemotesWdgt->btnDeleteRemote, &QAbstractButton::clicked, + this, &RemotesDlg::onDeleteRemote); + connect(mRemotesWdgt->txtUrl, &QLineEdit::textChanged, + this, &RemotesDlg::onUrlChanged); + + connect( mRemotesOptsWdgt->txtPushUrl, &QLineEdit::textChanged, + this, &RemotesDlg::checkValid ); if (!repo) { // TODO: this should never happen and we should assert out here. @@ -36,13 +56,7 @@ RemotesDlg::RemotesDlg(RM::Repo* repo) setWindowTitle( tr("Manage the Remotes in \"%1\"").arg(repo->displayName()) ); - txtRemotes->installEventFilter(this); -} - -void RemotesDlg::init() -{ - connect( txtPushUrl, &QLineEdit::textChanged, - this, &RemotesDlg::checkValid ); + mRemotesWdgt->txtRemotes->installEventFilter(this); } void RemotesDlg::updateValues(const QString& remoteAlias) @@ -60,16 +74,17 @@ void RemotesDlg::updateValues(const QString& remoteAlias) */ void RemotesDlg::clear() { - txtEditRefSpec->clear(); - txtUrl->clear(); - txtPushUrl->clear(); - treeRefSpecs->setModel(nullptr); + mRemotesWdgt->txtUrl->clear(); + + mRemotesOptsWdgt->txtEditRefSpec->clear(); + mRemotesOptsWdgt->txtPushUrl->clear(); + mRemotesOptsWdgt->treeRefSpecs->setModel(nullptr); } bool RemotesDlg::modeCanEnter(RemotesDlg::EditMode mode) const { if (mode == EditMode::Rename) { - return txtRemotes->currentIndex() > -1; + return mRemotesWdgt->txtRemotes->currentIndex() > -1; } return true; @@ -84,23 +99,23 @@ void RemotesDlg::modeEnter(EditMode mode) mMode = mode; - btnAddRemote->setEnabled(false); - btnDeleteRemote->setEnabled(false); - txtRemotes->setEditable(true); + mRemotesWdgt->btnAddRemote->setEnabled(false); + mRemotesWdgt->btnDeleteRemote->setEnabled(false); + mRemotesWdgt->txtRemotes->setEditable(true); switch (mMode) { case EditMode::Create: - txtRemotes->lineEdit()->setPlaceholderText(tr("Enter a name ...")); + mRemotesWdgt->txtRemotes->lineEdit()->setPlaceholderText(tr("Enter a name ...")); //txtRemotes->lineEdit()->clear(); - txtUrl->setPlaceholderText(tr("Enter a URL for the new Remote ...")); + mRemotesWdgt->txtUrl->setPlaceholderText(tr("Enter a URL for the new Remote ...")); clear(); break; case EditMode::Rename: - txtRemotes->lineEdit()->setText(txtRemotes->currentText()); - txtRemotes->lineEdit()->selectAll(); + mRemotesWdgt->txtRemotes->lineEdit()->setText(mRemotesWdgt->txtRemotes->currentText()); + mRemotesWdgt->txtRemotes->lineEdit()->selectAll(); break; @@ -109,7 +124,7 @@ void RemotesDlg::modeEnter(EditMode mode) break; } - txtRemotes->setFocus(); + mRemotesWdgt->txtRemotes->setFocus(); } void RemotesDlg::modeLeave(bool accept) @@ -118,7 +133,7 @@ void RemotesDlg::modeLeave(bool accept) switch (mMode) { case EditMode::Create: { - QString remoteAlias = txtRemotes->lineEdit()->text(); + QString remoteAlias = mRemotesWdgt->txtRemotes->lineEdit()->text(); // TODO: implementation to create an RM::Remote qCritical("Not implemented yet: Create a Remote via RepoMan."); break; @@ -126,8 +141,8 @@ void RemotesDlg::modeLeave(bool accept) case EditMode::Rename: { - QString oldRemoteAlias = txtRemotes->currentText(); - QString newRemoteAlias = txtRemotes->lineEdit()->text(); + QString oldRemoteAlias = mRemotesWdgt->txtRemotes->currentText(); + QString newRemoteAlias = mRemotesWdgt->txtRemotes->lineEdit()->text(); // TODO: implementation to rename an RM::Remote qCritical("Not implemented yet: Rename a Remote via RepoMan."); break; @@ -139,11 +154,11 @@ void RemotesDlg::modeLeave(bool accept) } } - txtUrl->setPlaceholderText(QString()); - btnAddRemote->setEnabled(true); - btnDeleteRemote->setEnabled(true); - txtRemotes->setEditable(false); - txtRemotes->update(); + mRemotesWdgt->txtUrl->setPlaceholderText(QString()); + mRemotesWdgt->btnAddRemote->setEnabled(true); + mRemotesWdgt->btnDeleteRemote->setEnabled(true); + mRemotesWdgt->txtRemotes->setEditable(false); + mRemotesWdgt->txtRemotes->update(); // switch to default mode mMode = EditMode::Edit; @@ -151,10 +166,10 @@ void RemotesDlg::modeLeave(bool accept) void RemotesDlg::checkValid() { - bool okay = !txtRemotes->currentText().isEmpty(); - okay &= !txtUrl->text().isEmpty(); + bool okay = !mRemotesWdgt->txtRemotes->currentText().isEmpty(); + okay &= !mRemotesWdgt->txtUrl->text().isEmpty(); - buttonBox->button( QDialogButtonBox::Ok )->setEnabled( okay ); + setAcceptable(okay); } void RemotesDlg::accept() @@ -167,31 +182,33 @@ void RemotesDlg::accept() } } -void RemotesDlg::on_btnAddRemote_clicked() +void RemotesDlg::onAddRemote() { modeEnter(EditMode::Create); } -void RemotesDlg::on_btnDeleteRemote_clicked() +void RemotesDlg::onDeleteRemote() { int r = QMessageBox::question(this, tr("Delete selected Remote?"), - tr("Delete the Remote \"%1\" from the repository \"%2\"?") - .arg(txtRemotes->currentText()).arg(mRepoContext->displayName())); + tr("Delete the Remote \"%1\" from the " + "repository \"%2\"?") + .arg(mRemotesWdgt->txtRemotes->currentText()) + .arg(mRepoContext->displayName())); if (r == QMessageBox::Yes) { // TODO: implement deletion of selected Remote } } -void RemotesDlg::on_txtRemotes_currentIndexChanged(const QString &remoteAlias) +void RemotesDlg::onCurrentRemoteChanged(const QString &alias) { - btnDeleteRemote->setEnabled( txtRemotes->currentIndex() > -1 ); - updateValues(remoteAlias); + mRemotesWdgt->btnDeleteRemote->setEnabled(mRemotesWdgt->txtRemotes->currentIndex() > -1); + updateValues(alias); } -void RemotesDlg::on_txtUrl_textChanged( const QString& newUrl ) +void RemotesDlg::onUrlChanged(const QString& newUrl) { - if( !chkPushUrl->isChecked() ) { - txtPushUrl->setText( newUrl ); + if( !mRemotesOptsWdgt->chkPushUrl->isChecked() ) { + mRemotesOptsWdgt->txtPushUrl->setText( newUrl ); } checkValid(); } @@ -219,7 +236,7 @@ void RemotesDlg::reject() */ bool RemotesDlg::eventFilter(QObject* o, QEvent* e) { - if (Q_LIKELY(o == txtRemotes)) { + if (Q_LIKELY(o == mRemotesWdgt->txtRemotes)) { if (e->type() == QEvent::MouseButtonDblClick) { modeEnter(EditMode::Rename); return true; diff --git a/Modules/Remotes/RemotesDlg.h b/Modules/Remotes/RemotesDlg.h index bea3e717..104c0794 100644 --- a/Modules/Remotes/RemotesDlg.h +++ b/Modules/Remotes/RemotesDlg.h @@ -16,16 +16,39 @@ #pragma once -#include "libBlueSky/Dialog.hpp" +#include "libMacGitverCore/Widgets/ExpandableDlg.hpp" -#include "ui_RemotesDlg.h" +#include "ui_RemotesOptionsWdgt.h" +#include "ui_RemotesWdgt.h" + +#include namespace RM { class Repo; } -class RemotesDlg : public BlueSky::Dialog, private Ui::RemotesDlg +class RemotesOptionsWdgt : public QWidget, Ui::RemotesOptionsWdgt +{ + Q_OBJECT + + friend class RemotesDlg; + +public: + RemotesOptionsWdgt(); +}; + +class RemotesWdgt : public QWidget, Ui::RemotesWdgt +{ + Q_OBJECT + + friend class RemotesDlg; + +public: + RemotesWdgt(); +}; + +class RemotesDlg : public ExpandableDlg { Q_OBJECT @@ -61,12 +84,14 @@ class RemotesDlg : public BlueSky::Dialog, private Ui::RemotesDlg private slots: void checkValid(); -private slots: - // auto-connected ui slots - void on_btnAddRemote_clicked(); - void on_btnDeleteRemote_clicked(); - void on_txtRemotes_currentIndexChanged(const QString &remoteAlias); - void on_txtUrl_textChanged(const QString& newUrl); + void onAddRemote(); + void onDeleteRemote(); + void onCurrentRemoteChanged(const QString& alias); + void onUrlChanged(const QString& newUrl); + +private: + QPointer mRemotesOptsWdgt = new RemotesOptionsWdgt; + QPointer mRemotesWdgt = new RemotesWdgt; private: RM::Repo* mRepoContext = nullptr; diff --git a/Modules/Remotes/RemotesDlg.ui b/Modules/Remotes/RemotesDlg.ui deleted file mode 100644 index 6b560d2a..00000000 --- a/Modules/Remotes/RemotesDlg.ui +++ /dev/null @@ -1,253 +0,0 @@ - - - RemotesDlg - - - - 0 - 0 - 381 - 332 - - - - - - - - - - 0 - 0 - - - - Git Remote - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - <p>Select the Git Remote, you like to edit.<br/></p> -<p>Tip: Double-Click to rename a selected Remote.</b> - - - - - - - - Add a new Remote. - - - + - - - - - - - false - - - Delete this Remote. - - - - - - - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - URL - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - txtUrl - - - - - - - true - - - - - - - - 0 - 0 - - - - Push URL - - - - - - - false - - - true - - - - - - - Custom refspecs for Fetch - - - true - - - false - - - - - - - - - Update - - - - - - - Remove - - - - - - - Add - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - LineEdit - QLineEdit -
libMacGitverCore/Widgets/LineEdit.h
-
-
- - chkRefSpecs - treeRefSpecs - txtEditRefSpec - btnAddRefSpec - btnUpdateRefSpec - btnRemoveRefSpec - buttonBox - - - - - buttonBox - accepted() - RemotesDlg - accept() - - - 252 - 302 - - - 157 - 274 - - - - - buttonBox - rejected() - RemotesDlg - reject() - - - 320 - 302 - - - 286 - 274 - - - - - chkPushUrl - toggled(bool) - txtPushUrl - setEnabled(bool) - - - 70 - 128 - - - 203 - 129 - - - - -
diff --git a/Modules/Remotes/RemotesOptionsWdgt.ui b/Modules/Remotes/RemotesOptionsWdgt.ui new file mode 100644 index 00000000..3273203b --- /dev/null +++ b/Modules/Remotes/RemotesOptionsWdgt.ui @@ -0,0 +1,106 @@ + + + RemotesOptionsWdgt + + + + 0 + 0 + 371 + 205 + + + + Form + + + + + + + 0 + 0 + + + + Push URL + + + + + + + false + + + true + + + + + + + Custom refspecs for Fetch + + + true + + + false + + + + + + + + + Update + + + + + + + Remove + + + + + + + Add + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + + + + + + + + LineEdit + QLineEdit +
libMacGitverCore/Widgets/LineEdit.h
+
+
+ + +
diff --git a/Modules/Remotes/RemotesWdgt.ui b/Modules/Remotes/RemotesWdgt.ui new file mode 100644 index 00000000..e8802768 --- /dev/null +++ b/Modules/Remotes/RemotesWdgt.ui @@ -0,0 +1,113 @@ + + + RemotesWdgt + + + + 0 + 0 + 342 + 81 + + + + Form + + + + + + + + + 0 + 0 + + + + Git Remote + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <p>Select the Git Remote, you like to edit.<br/></p> +<p>Tip: Double-Click to rename a selected Remote.</b> + + + + + + + + Add a new Remote. + + + + + + + + + + + false + + + Delete this Remote. + + + - + + + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + URL + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtUrl + + + + + + + true + + + + + + + + LineEdit + QLineEdit +
libMacGitverCore/Widgets/LineEdit.h
+
+
+ + +
From 04cff93bc2e7faafd11210c738f5539221fd9b8c Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Wed, 8 Apr 2015 16:03:13 +0200 Subject: [PATCH 19/21] Remotes Module: minor cleanup --- Modules/Remotes/RemotesModule.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Remotes/RemotesModule.cpp b/Modules/Remotes/RemotesModule.cpp index 33df47bf..d4f627cf 100644 --- a/Modules/Remotes/RemotesModule.cpp +++ b/Modules/Remotes/RemotesModule.cpp @@ -14,10 +14,6 @@ * */ -#include -#include -#include - #include "libGitWrap/Operations/RemoteOperations.hpp" #include "libMacGitverCore/App/MacGitver.hpp" @@ -26,6 +22,10 @@ #include "RemotesDlg.h" #include "RemotesModule.h" +#include +#include +#include + RemotesModule::RemotesModule() { } @@ -34,9 +34,9 @@ void RemotesModule::initialize() { setupActions( this ); - acRemotesAC->mergeInto( "RemotesMP" ); acFetchAC->mergeInto( "FetchMP" ); acFetchThisAC->mergeInto( "FetchThisMP" ); + acRemotesAC->mergeInto( "RemotesMP" ); acPushAC->mergeInto( "PushMP" ); } From b89e4623f8f43506047b6da6489474d4da56d18c Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Sun, 12 Apr 2015 01:13:58 +0200 Subject: [PATCH 20/21] Remotes Module: Changed window title in "Remotes" dialog. --- Modules/Remotes/RemotesDlg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Remotes/RemotesDlg.cpp b/Modules/Remotes/RemotesDlg.cpp index eb56e26e..209bcd27 100644 --- a/Modules/Remotes/RemotesDlg.cpp +++ b/Modules/Remotes/RemotesDlg.cpp @@ -54,7 +54,7 @@ RemotesDlg::RemotesDlg(RM::Repo* repo) return; } - setWindowTitle( tr("Manage the Remotes in \"%1\"").arg(repo->displayName()) ); + setWindowTitle( tr("Remotes in \"%1\"").arg(repo->displayName()) ); mRemotesWdgt->txtRemotes->installEventFilter(this); } From ec327e634a2916b21717cdc37c018d230007b665 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Fri, 17 Apr 2015 13:25:08 +0200 Subject: [PATCH 21/21] Remotes Module: cleanup UI for "Remotes" dialog Extended options need some cleanup to appear correctly aligned. --- Modules/Remotes/RemotesWdgt.ui | 104 ++++++++++++++------------------- 1 file changed, 45 insertions(+), 59 deletions(-) diff --git a/Modules/Remotes/RemotesWdgt.ui b/Modules/Remotes/RemotesWdgt.ui index e8802768..ca3ec5b7 100644 --- a/Modules/Remotes/RemotesWdgt.ui +++ b/Modules/Remotes/RemotesWdgt.ui @@ -6,74 +6,60 @@ 0 0 - 342 + 328 81
- - Form - - - - - - - - 0 - 0 - - - - Git Remote - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - <p>Select the Git Remote, you like to edit.<br/></p> + + + + + 0 + 0 + + + + Git Remote + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <p>Select the Git Remote, you like to edit.<br/></p> <p>Tip: Double-Click to rename a selected Remote.</b> - - - - - - - Add a new Remote. - - - + - - - - - - - false - - - Delete this Remote. - - - - - - - - +
+
+
+ + + + Add a new Remote. + + + + + + - - - - Qt::Horizontal + + + + false + + + Delete this Remote. + + + - - + @@ -92,7 +78,7 @@ - + true