Skip to content

Commit

Permalink
Fix some cppcheck suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenDB committed Sep 26, 2022
1 parent 9e31d71 commit 769c9a9
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/AbstractTimeServiceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ QVector<QPair<QString, QString>> &AbstractTimeServiceManager::users()

QString AbstractTimeServiceManager::projectName(const QString &projectId)
{
for (auto &item : projects())
for (const auto &item : projects())
if (item.id() == projectId)
return item.name();

Expand Down
2 changes: 1 addition & 1 deletion src/ModifyJobDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ModifyJobDialog::ModifyJobDialog(AbstractTimeServiceManager *manager, const Time
auto layout = new QGridLayout{this};

QComboBox *project{new QComboBox{this}};
for (auto &p : m_availableProjects)
for (const auto &p : m_availableProjects)
project->addItem(p.name(), p.id());
project->setCurrentIndex(
m_availableProjects.indexOf(entry.project().id().isEmpty() ? m_availableProjects.first() : entry.project()));
Expand Down
2 changes: 1 addition & 1 deletion src/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SettingsDialog::SettingsDialog(AbstractTimeServiceManager *manager,
m_availableManagers{availableManagers},
m_tabWidget{new QTabWidget}
{
for (auto &project : m_manager->projects())
for (const auto &project : m_manager->projects())
{
m_availableProjects.first.push_back(project.id());
m_availableProjects.second.push_back(project.name());
Expand Down
9 changes: 0 additions & 9 deletions src/TrayIcons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,6 @@ void TrayIcons::updateRunningEntryTooltip()
(m_breakIcon ? m_breakIcon : m_trayIcon)->setToolTip(tooltip);
}

void TrayIcons::getNewProjectId()
{
SettingsDialog d{m_manager,
{{QStringLiteral("Clockify"), QStringLiteral("com.clockify")},
{QStringLiteral("TimeCamp"), QStringLiteral("com.timecamp")}}};
d.switchToPage(SettingsDialog::Pages::ProjectPage);
d.exec();
}

void TrayIcons::showAboutDialog()
{
// put this into a variable to handle this gonzo string more nicely
Expand Down
1 change: 0 additions & 1 deletion src/TrayIcons.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class TrayIcons : public QObject
private slots:
void updateTrayIcons();
void updateRunningEntryTooltip();
void getNewProjectId();

void showAboutDialog();
void showLicenseDialog(QWidget *parent = nullptr);
Expand Down

0 comments on commit 769c9a9

Please sign in to comment.