Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit dcb842b

Browse files
committed
Use Qt5-Style connects for RepoMan
1 parent 1ef6630 commit dcb842b

File tree

9 files changed

+43
-39
lines changed

9 files changed

+43
-39
lines changed

Libs/libMacGitverCore/App/MgvPrimaryWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ MgvPrimaryWindow::MgvPrimaryWindow()
6464
w->show();
6565
#endif
6666

67-
connect(&MacGitver::repoMan(), SIGNAL(firstRepositoryOpened()),
68-
this, SLOT(activateModeForRepo()));
67+
connect(&MacGitver::repoMan(), &RM::RepoMan::firstRepositoryOpened,
68+
this, &MgvPrimaryWindow::activateModeForRepo);
6969

70-
connect(&MacGitver::repoMan(), SIGNAL(lastRepositoryClosed()),
71-
this, SLOT(activateModeForRepo()));
70+
connect(&MacGitver::repoMan(), &RM::RepoMan::lastRepositoryClosed,
71+
this, &MgvPrimaryWindow::activateModeForRepo);
7272

7373
setupFonts();
7474

Libs/libMacGitverCore/Widgets/RepoStateWidget.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ RepoStateWidget::RepoStateWidget()
3535

3636
RM::RepoMan& rm = MacGitver::repoMan();
3737

38-
connect(&rm, SIGNAL(refMoved(RM::Repo*,RM::Ref*)),
39-
this, SLOT(onUpdateHEAD(RM::Repo*,RM::Ref*)));
38+
connect(&rm, &RM::RepoMan::refMoved,
39+
this, &RepoStateWidget::onUpdateHEAD);
4040

41-
connect(&rm, SIGNAL(repositoryActivated(RM::Repo*)),
42-
this, SLOT(repositoryActivated(RM::Repo*)) );
41+
connect(&rm, &RM::RepoMan::repositoryActivated,
42+
this, &RepoStateWidget::repositoryActivated);
4343

44-
connect(&rm, SIGNAL(repositoryDeactivated(RM::Repo*)),
45-
this, SLOT(repositoryDeactivated(RM::Repo*)) );
44+
connect(&rm, &RM::RepoMan::repositoryDeactivated,
45+
this, &RepoStateWidget::repositoryDeactivated);
4646
}
4747

4848
void RepoStateWidget::repositoryActivated(RM::Repo* info)

Modules/History/HistoryMode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ HistoryMode::HistoryMode(QObject *parent)
3131
setEnabled(false);
3232
setDisplayOrder(5);
3333

34-
connect(&MacGitver::self().repoMan(), SIGNAL(hasActiveRepositoryChanged(bool)),
35-
this, SLOT(setEnabled(bool)));
34+
connect(&MacGitver::self().repoMan(), &RM::RepoMan::hasActiveRepositoryChanged,
35+
this, &HistoryMode::setEnabled);
3636
}
3737

3838
QString HistoryMode::createDefaultState() const {

Modules/History/HistoryModel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ HistoryModel::HistoryModel( const Git::Repository& repo, QObject* parent )
4141
mDisplays = 0;
4242

4343
RM::RepoMan &rm = MacGitver::repoMan();
44-
connect( &rm, SIGNAL(refCreated(RM::Repo*,RM::Ref*)), this, SLOT(onRefCreated(RM::Repo*,RM::Ref*)) );
45-
connect( &rm, SIGNAL(refAboutToBeDeleted(RM::Repo*,RM::Ref*)), this, SLOT(onRefDestroyed(RM::Repo*,RM::Ref*)) );
46-
connect( &rm, SIGNAL(refMoved(RM::Repo*,RM::Ref*)), this, SLOT(onRefMoved(RM::Repo*,RM::Ref*)) );
44+
connect(&rm, &RM::RepoMan::refCreated, this, &HistoryModel::onRefCreated);
45+
connect(&rm, &RM::RepoMan::refAboutToBeDeleted, this, &HistoryModel::onRefDestroyed);
46+
connect(&rm, &RM::RepoMan::refMoved, this, &HistoryModel::onRefMoved);
4747
}
4848

4949
HistoryModel::~HistoryModel()

Modules/History/HistoryView.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ HistoryView::HistoryView()
6969

7070
initSplitters();
7171

72-
connect( &MacGitver::repoMan(), SIGNAL(repositoryActivated(RM::Repo*)),
73-
this, SLOT(repoActivated(RM::Repo*)));
72+
connect( &MacGitver::repoMan(), &RM::RepoMan::repositoryActivated,
73+
this, &HistoryView::repoActivated);
7474

7575
#if 0 // Missing feature in libHeaven:
7676

Modules/Logging/LoggingMode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ LoggingMode::LoggingMode(QObject *parent)
3131
setEnabled(false);
3232
setDisplayOrder(100);
3333

34-
connect(&MacGitver::self().repoMan(), SIGNAL(hasActiveRepositoryChanged(bool)),
35-
this, SLOT(setEnabled(bool)));
34+
connect(&MacGitver::self().repoMan(),
35+
&RM::RepoMan::hasActiveRepositoryChanged,
36+
this, &LoggingMode::setEnabled);
3637
}
3738

3839
QString LoggingMode::createDefaultState() const {

Modules/RefsViews/Branches/BranchesModel.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ BranchesModel::BranchesModel( BranchesViewData* parent )
4242
{
4343
RM::RepoMan& rm = MacGitver::repoMan();
4444

45-
connect(&rm, SIGNAL(refCreated(RM::Repo*,RM::Ref*)),
46-
this, SLOT(onRefCreated(RM::Repo*,RM::Ref*)));
45+
connect(&rm, &RM::RepoMan::refCreated,
46+
this, &BranchesModel::onRefCreated);
4747

48-
connect(&rm, SIGNAL(refAboutToBeDeleted(RM::Repo*,RM::Ref*)),
49-
this, SLOT(onRefDestroyed(RM::Repo*,RM::Ref*)));
48+
connect(&rm, &RM::RepoMan::refAboutToBeDeleted,
49+
this, &BranchesModel::onRefDestroyed);
5050

51-
connect(&rm, SIGNAL(refMoved(RM::Repo*,RM::Ref*)),
52-
this, SLOT(onRefMoved(RM::Repo*,RM::Ref*)));
51+
connect(&rm, &RM::RepoMan::refMoved,
52+
this, &BranchesModel::onRefMoved);
5353

54-
connect(&rm, SIGNAL(refTreeNodeAboutToBeDeleted(RM::Repo*,RM::RefTreeNode*)),
55-
this, SLOT(onRefTreeNodeAboutToBeDeleted(RM::Repo*,RM::RefTreeNode*)));
54+
connect(&rm, &RM::RepoMan::refTreeNodeAboutToBeDeleted,
55+
this, &BranchesModel::onRefTreeNodeAboutToBeDeleted);
5656
}
5757

5858
BranchesModel::~BranchesModel()

Modules/Repository/RepoInfoModel.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ RepoInfoModel::RepoInfoModel()
2727
{
2828
mRepoMan = &MacGitver::repoMan();
2929

30-
connect( mRepoMan, SIGNAL(repositoryDeactivated(RM::Repo*)),
31-
this, SLOT(invalidateRepository(RM::Repo*)) );
30+
connect( mRepoMan, &RM::RepoMan::repositoryDeactivated,
31+
this, &RepoInfoModel::invalidateRepository);
3232

33-
connect( mRepoMan, SIGNAL(repositoryActivated(RM::Repo*)),
34-
this, SLOT(invalidateRepository(RM::Repo*)) );
33+
connect( mRepoMan, &RM::RepoMan::repositoryActivated,
34+
this, &RepoInfoModel::invalidateRepository);
3535

36-
connect( mRepoMan, SIGNAL(repositoryOpened(RM::Repo*)),
37-
this, SLOT(repositoryOpened(RM::Repo*)));
36+
connect( mRepoMan, &RM::RepoMan::repositoryOpened,
37+
this, &RepoInfoModel::invalidateRepository);
3838
}
3939

4040
int RepoInfoModel::rowCount( const QModelIndex& parent ) const
@@ -197,8 +197,11 @@ void RepoInfoModel::repositoryOpened(RM::Repo *info)
197197
return;
198198
}
199199

200-
connect(info, SIGNAL(childAdded(RM::Repo*,RM::Repo*)),
201-
this, SLOT(repositoryChildAdded(RM::Repo*,RM::Repo*)));
200+
// This connection is wrong. There could be any children added below the repository (i.e.
201+
// HEAD, SubModule, CollectionNode). But the slot will unconditionally reserve a new space
202+
// for a submodule...
203+
connect(info, &RM::Repo::childAdded,
204+
this, &RepoInfoModel::repositoryChildAdded);
202205

203206
// we add a row just at the end of the root. This is stupid. But that's the way it works when
204207
// a model actually isn't a model...

Modules/Repository/RepoTreeView.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ RepoTreeView::RepoTreeView()
5656
connect( mRepos, SIGNAL(contextMenu(QModelIndex,QPoint)),
5757
this, SLOT(contextMenu(QModelIndex,QPoint)) );
5858

59-
connect( &MacGitver::repoMan(), SIGNAL(repositoryActivated(RM::Repo*)),
60-
this, SLOT(onRepoActivated(RM::Repo*)) );
59+
connect( &MacGitver::repoMan(), &RM::RepoMan::repositoryActivated,
60+
this, &RepoTreeView::onRepoActivated);
6161

62-
connect( &MacGitver::repoMan(), SIGNAL(repositoryDeactivated(RM::Repo*)),
63-
this, SLOT(onRepoDeactivated(RM::Repo*)) );
62+
connect( &MacGitver::repoMan(), &RM::RepoMan::repositoryDeactivated,
63+
this, &RepoTreeView::onRepoDeactivated);
6464
}
6565

6666
QModelIndex RepoTreeView::deeplyMapToSource( QModelIndex current ) const

0 commit comments

Comments
 (0)