🚨 Fixed some clang warnings
This commit is contained in:
parent
25b78bd8d8
commit
7503db9059
@ -123,7 +123,7 @@ void Settings::SetFossilValue(const QString &name, const QVariant &value)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool Settings::SupportsLang(const QString &langId) const
|
bool Settings::SupportsLang(const QString &langId) const
|
||||||
{
|
{
|
||||||
QString locale_path = QString(":intl/intl/%0.qm").arg(langId);
|
QString locale_path = QString(":intl/%0.qm").arg(langId);
|
||||||
QResource res(locale_path);
|
QResource res(locale_path);
|
||||||
return res.isValid();
|
return res.isValid();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ bool CloneDialog::run(QWidget *parent, QUrl &url, QString &repository, QUrl &url
|
|||||||
QString urltext = dlg.ui->lineURL->text();
|
QString urltext = dlg.ui->lineURL->text();
|
||||||
|
|
||||||
// Check if the url is a local file
|
// Check if the url is a local file
|
||||||
if (QFileInfo(urltext).exists())
|
if (QFileInfo::exists(urltext))
|
||||||
url = QUrl::fromLocalFile(urltext);
|
url = QUrl::fromLocalFile(urltext);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -36,14 +36,14 @@ WorkspaceState Fossil::getWorkspaceState()
|
|||||||
bool run_ok = exit_code == EXIT_SUCCESS;
|
bool run_ok = exit_code == EXIT_SUCCESS;
|
||||||
|
|
||||||
activeTags.clear();
|
activeTags.clear();
|
||||||
for (QStringList::iterator it = res.begin(); it != res.end(); ++it)
|
for (auto &re : res)
|
||||||
{
|
{
|
||||||
int col_index = it->indexOf(':');
|
int col_index = re.indexOf(':');
|
||||||
if (col_index == -1)
|
if (col_index == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString key = it->left(col_index).trimmed();
|
QString key = re.left(col_index).trimmed();
|
||||||
QString value = it->mid(col_index + 1).trimmed();
|
QString value = re.mid(col_index + 1).trimmed();
|
||||||
|
|
||||||
if (key == "fossil")
|
if (key == "fossil")
|
||||||
{
|
{
|
||||||
@ -363,7 +363,7 @@ bool Fossil::revertFiles(const QStringList &fileList)
|
|||||||
bool Fossil::renameFile(const QString &beforePath, const QString &afterPath, bool renameLocal)
|
bool Fossil::renameFile(const QString &beforePath, const QString &afterPath, bool renameLocal)
|
||||||
{
|
{
|
||||||
// Ensure we can rename the file
|
// Ensure we can rename the file
|
||||||
if (!QFileInfo(beforePath).exists() || QFileInfo(afterPath).exists())
|
if (!QFileInfo::exists(beforePath) || QFileInfo::exists(afterPath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Do Rename
|
// Do Rename
|
||||||
@ -449,7 +449,7 @@ bool Fossil::setRemoteUrl(const QUrl &url)
|
|||||||
|
|
||||||
// FIXME: Fossil ignores any password passed via the URL
|
// FIXME: Fossil ignores any password passed via the URL
|
||||||
// Run as silent to avoid displaying credentials in the log
|
// Run as silent to avoid displaying credentials in the log
|
||||||
bool ok = runFossil(QStringList() << "remote-url" << u, 0, RUNFLAGS_SILENT_INPUT);
|
bool ok = runFossil(QStringList() << "remote-url" << u, nullptr, RUNFLAGS_SILENT_INPUT);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -817,7 +817,7 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
|||||||
// Create fossil process
|
// Create fossil process
|
||||||
// FIXME: when we are sure this works delete this
|
// FIXME: when we are sure this works delete this
|
||||||
// LoggedProcess process(parentWidget*/);
|
// LoggedProcess process(parentWidget*/);
|
||||||
LoggedProcess process(0);
|
LoggedProcess process(nullptr);
|
||||||
|
|
||||||
process.setWorkingDirectory(wkdir);
|
process.setWorkingDirectory(wkdir);
|
||||||
|
|
||||||
@ -860,11 +860,7 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
|||||||
|
|
||||||
if (uiCallback->processAborted())
|
if (uiCallback->processAborted())
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN // Verify this is still true on Qt5
|
|
||||||
process.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
|
|
||||||
#else
|
|
||||||
process.terminate();
|
process.terminate();
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,7 +1105,7 @@ bool Fossil::isWorkspace(const QString &path)
|
|||||||
QString checkout_file1 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT1;
|
QString checkout_file1 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT1;
|
||||||
QString checkout_file2 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT2;
|
QString checkout_file2 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT2;
|
||||||
|
|
||||||
return (QFileInfo(checkout_file1).exists() || QFileInfo(checkout_file2).exists());
|
return (QFileInfo::exists(checkout_file1) || QFileInfo::exists(checkout_file2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1204,11 +1200,7 @@ void Fossil::stopUI()
|
|||||||
{
|
{
|
||||||
if (uiRunning())
|
if (uiRunning())
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_WIN
|
|
||||||
fossilUI.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
|
|
||||||
#else
|
|
||||||
fossilUI.terminate();
|
fossilUI.terminate();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
fossilUI.close();
|
fossilUI.close();
|
||||||
fossilUIPort.clear();
|
fossilUIPort.clear();
|
||||||
|
@ -199,12 +199,12 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Q_ASSERT(recent_sep);
|
Q_ASSERT(recent_sep);
|
||||||
for (int i = 0; i < MAX_RECENT; ++i)
|
for (auto &recentWorkspaceAct : recentWorkspaceActs)
|
||||||
{
|
{
|
||||||
recentWorkspaceActs[i] = new QAction(this);
|
recentWorkspaceAct = new QAction(this);
|
||||||
recentWorkspaceActs[i]->setVisible(false);
|
recentWorkspaceAct->setVisible(false);
|
||||||
connect(recentWorkspaceActs[i], SIGNAL(triggered()), this, SLOT(onOpenRecent()));
|
connect(recentWorkspaceAct, SIGNAL(triggered()), this, SLOT(onOpenRecent()));
|
||||||
ui->menuFile->insertAction(recent_sep, recentWorkspaceActs[i]);
|
ui->menuFile->insertAction(recent_sep, recentWorkspaceAct);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom Actions
|
// Custom Actions
|
||||||
@ -368,7 +368,7 @@ bool MainWindow::openWorkspace(const QString &path)
|
|||||||
QString checkout_file1 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT1;
|
QString checkout_file1 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT1;
|
||||||
QString checkout_file2 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT2;
|
QString checkout_file2 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT2;
|
||||||
|
|
||||||
if (!(QFileInfo(checkout_file1).exists() || QFileInfo(checkout_file2).exists()))
|
if (!(QFileInfo::exists(checkout_file1) || QFileInfo::exists(checkout_file2)))
|
||||||
{
|
{
|
||||||
if (QMessageBox::Yes != DialogQuery(this, tr("Open Workspace"), tr("A workspace does not exist in this folder.\nWould you like to create one here?")))
|
if (QMessageBox::Yes != DialogQuery(this, tr("Open Workspace"), tr("A workspace does not exist in this folder.\nWould you like to create one here?")))
|
||||||
{
|
{
|
||||||
@ -569,8 +569,8 @@ void MainWindow::on_actionCloneRepository_triggered()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::rebuildRecent()
|
void MainWindow::rebuildRecent()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_RECENT; ++i)
|
for (auto &recentWorkspaceAct : recentWorkspaceActs)
|
||||||
recentWorkspaceActs[i]->setVisible(false);
|
recentWorkspaceAct->setVisible(false);
|
||||||
|
|
||||||
int enabled_acts = qMin<int>(MAX_RECENT, workspaceHistory.size());
|
int enabled_acts = qMin<int>(MAX_RECENT, workspaceHistory.size());
|
||||||
|
|
||||||
@ -610,8 +610,8 @@ void MainWindow::enableActions(bool on)
|
|||||||
ui->actionViewIgnored, ui->actionViewModifedOnly, ui->actionViewModified, ui->actionViewUnchanged,
|
ui->actionViewIgnored, ui->actionViewModifedOnly, ui->actionViewModified, ui->actionViewUnchanged,
|
||||||
ui->actionViewUnknown};
|
ui->actionViewUnknown};
|
||||||
|
|
||||||
for (size_t i = 0; i < COUNTOF(actions); ++i)
|
for (auto &action : actions)
|
||||||
actions[i]->setEnabled(on);
|
action->setEnabled(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -710,9 +710,8 @@ static void addPathToTree(QStandardItem &root, const QString &path, const QIcon
|
|||||||
QStandardItem *parent = &root;
|
QStandardItem *parent = &root;
|
||||||
|
|
||||||
QString fullpath;
|
QString fullpath;
|
||||||
for (QStringList::iterator it = dirs.begin(); it != dirs.end(); ++it)
|
for (auto &dir : dirs)
|
||||||
{
|
{
|
||||||
const QString &dir = *it;
|
|
||||||
fullpath += dir;
|
fullpath += dir;
|
||||||
|
|
||||||
// Find the child that matches this subdirectory
|
// Find the child that matches this subdirectory
|
||||||
@ -810,7 +809,7 @@ void MainWindow::updateWorkspaceView()
|
|||||||
if (viewMode == VIEWMODE_TREE)
|
if (viewMode == VIEWMODE_TREE)
|
||||||
{
|
{
|
||||||
// FIXME: Change paths to map to allow for automatic sorting
|
// FIXME: Change paths to map to allow for automatic sorting
|
||||||
QStringList paths = getWorkspace().getPaths().toList();
|
QStringList paths = getWorkspace().getPaths().values();
|
||||||
paths.sort();
|
paths.sort();
|
||||||
|
|
||||||
foreach (const QString &dir, paths)
|
foreach (const QString &dir, paths)
|
||||||
@ -885,15 +884,15 @@ void MainWindow::updateWorkspaceView()
|
|||||||
remotes->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTES, ""), ROLE_WORKSPACE_ITEM);
|
remotes->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTES, ""), ROLE_WORKSPACE_ITEM);
|
||||||
remotes->setEditable(false);
|
remotes->setEditable(false);
|
||||||
getWorkspace().getTreeModel().appendRow(remotes);
|
getWorkspace().getTreeModel().appendRow(remotes);
|
||||||
for (remote_map_t::const_iterator it = getWorkspace().getRemotes().begin(); it != getWorkspace().getRemotes().end(); ++it)
|
for (const auto &it : getWorkspace().getRemotes())
|
||||||
{
|
{
|
||||||
QStandardItem *remote_item = new QStandardItem(getCachedIcon(":icons/icon-item-remote"), it->name);
|
QStandardItem *remote_item = new QStandardItem(getCachedIcon(":icons/icon-item-remote"), it.name);
|
||||||
remote_item->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTE, it->url.toString()), ROLE_WORKSPACE_ITEM);
|
remote_item->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTE, it.url.toString()), ROLE_WORKSPACE_ITEM);
|
||||||
|
|
||||||
remote_item->setToolTip(UrlToStringDisplay(it->url));
|
remote_item->setToolTip(UrlToStringDisplay(it.url));
|
||||||
|
|
||||||
// Mark the default url as bold
|
// Mark the default url as bold
|
||||||
if (it->isDefault)
|
if (it.isDefault)
|
||||||
{
|
{
|
||||||
QFont font = remote_item->font();
|
QFont font = remote_item->font();
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
@ -972,12 +971,12 @@ void MainWindow::updateFileView()
|
|||||||
const QString *status_text = &status_unknown;
|
const QString *status_text = &status_unknown;
|
||||||
const char *status_icon_path = ":icons/icon-item-unknown"; // Default icon
|
const char *status_icon_path = ":icons/icon-item-unknown"; // Default icon
|
||||||
|
|
||||||
for (size_t t = 0; t < COUNTOF(stats); ++t)
|
for (auto &stat : stats)
|
||||||
{
|
{
|
||||||
if (e.getType() == stats[t].type)
|
if (e.getType() == stat.type)
|
||||||
{
|
{
|
||||||
status_text = &stats[t].text;
|
status_text = &stat.text;
|
||||||
status_icon_path = stats[t].icon;
|
status_icon_path = stat.icon;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1188,9 +1187,8 @@ void MainWindow::updateSettings()
|
|||||||
Settings::custom_actions_t &actions = settings.GetCustomActions();
|
Settings::custom_actions_t &actions = settings.GetCustomActions();
|
||||||
store->beginWriteArray("CustomActions", actions.size());
|
store->beginWriteArray("CustomActions", actions.size());
|
||||||
int active_actions = 0;
|
int active_actions = 0;
|
||||||
for (int i = 0; i < actions.size(); ++i)
|
for (auto &action : actions)
|
||||||
{
|
{
|
||||||
CustomAction &action = actions[i];
|
|
||||||
if (!action.IsValid())
|
if (!action.IsValid())
|
||||||
continue;
|
continue;
|
||||||
store->setArrayIndex(active_actions);
|
store->setArrayIndex(active_actions);
|
||||||
|
@ -41,9 +41,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, Settings &_settings) : QDialog(p
|
|||||||
|
|
||||||
GetCustomAction(0);
|
GetCustomAction(0);
|
||||||
|
|
||||||
for (int i = 0; i < currentCustomActions.size(); ++i)
|
for (auto &a : currentCustomActions)
|
||||||
{
|
{
|
||||||
CustomAction &a = currentCustomActions[i];
|
|
||||||
ui->cmbCustomAction->addItem(a.Id);
|
ui->cmbCustomAction->addItem(a.Id);
|
||||||
}
|
}
|
||||||
ui->cmbCustomAction->setCurrentIndex(0);
|
ui->cmbCustomAction->setCurrentIndex(0);
|
||||||
@ -79,9 +78,8 @@ void SettingsDialog::on_buttonBox_accepted()
|
|||||||
if (curr_langid != new_langid)
|
if (curr_langid != new_langid)
|
||||||
QMessageBox::information(this, tr("Restart required"), tr("The language change will take effect after restarting the application"), QMessageBox::Ok);
|
QMessageBox::information(this, tr("Restart required"), tr("The language change will take effect after restarting the application"), QMessageBox::Ok);
|
||||||
|
|
||||||
for (int i = 0; i < currentCustomActions.size(); ++i)
|
for (auto &a : currentCustomActions)
|
||||||
{
|
{
|
||||||
CustomAction &a = currentCustomActions[i];
|
|
||||||
a.Description = a.Description.trimmed();
|
a.Description = a.Description.trimmed();
|
||||||
a.Command = a.Command.trimmed();
|
a.Command = a.Command.trimmed();
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,15 @@ void Workspace::storeWorkspace(QSettings &store)
|
|||||||
|
|
||||||
store.beginWriteArray(workspace_hash);
|
store.beginWriteArray(workspace_hash);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (remote_map_t::iterator it = remotes.begin(); it != remotes.end(); ++it, ++index)
|
for (auto &re : remotes)
|
||||||
{
|
{
|
||||||
store.setArrayIndex(index);
|
store.setArrayIndex(index);
|
||||||
store.setValue("Name", it->name);
|
store.setValue("Name", re.name);
|
||||||
QUrl url = it->url;
|
QUrl url = re.url;
|
||||||
url.setPassword("");
|
url.setPassword("");
|
||||||
store.setValue("Url", url);
|
store.setValue("Url", url);
|
||||||
if (it->isDefault)
|
if (re.isDefault)
|
||||||
store.setValue("Default", it->isDefault);
|
store.setValue("Default", re.isDefault);
|
||||||
else
|
else
|
||||||
store.remove("Default");
|
store.remove("Default");
|
||||||
}
|
}
|
||||||
@ -77,10 +77,7 @@ bool Workspace::switchWorkspace(const QString &workspace, QSettings &store)
|
|||||||
// Load Remotes
|
// Load Remotes
|
||||||
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
|
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
|
||||||
|
|
||||||
QString gr = store.group();
|
|
||||||
|
|
||||||
store.beginGroup("Remotes");
|
store.beginGroup("Remotes");
|
||||||
gr = store.group();
|
|
||||||
int num_remotes = store.beginReadArray(workspace_hash);
|
int num_remotes = store.beginReadArray(workspace_hash);
|
||||||
for (int i = 0; i < num_remotes; ++i)
|
for (int i = 0; i < num_remotes; ++i)
|
||||||
{
|
{
|
||||||
@ -124,12 +121,11 @@ bool Workspace::scanDirectory(QFileInfoList &entries, const QString &dirPath, co
|
|||||||
uiCallback.updateProcess(dirPath);
|
uiCallback.updateProcess(dirPath);
|
||||||
|
|
||||||
QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
|
QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
|
||||||
for (int i = 0; i < list.count(); ++i)
|
for (auto &info : list)
|
||||||
{
|
{
|
||||||
if (uiCallback.processAborted())
|
if (uiCallback.processAborted())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QFileInfo info = list[i];
|
|
||||||
QString filepath = info.filePath();
|
QString filepath = info.filePath();
|
||||||
QString rel_path = filepath;
|
QString rel_path = filepath;
|
||||||
rel_path.remove(baseDir + PATH_SEPARATOR);
|
rel_path.remove(baseDir + PATH_SEPARATOR);
|
||||||
@ -188,10 +184,10 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
|||||||
if (!scanDirectory(all_files, wkdir, wkdir, ignore, uiCallback))
|
if (!scanDirectory(all_files, wkdir, wkdir, ignore, uiCallback))
|
||||||
goto _done;
|
goto _done;
|
||||||
|
|
||||||
for (QFileInfoList::iterator it = all_files.begin(); it != all_files.end(); ++it)
|
for (auto &all_file : all_files)
|
||||||
{
|
{
|
||||||
QString filename = it->fileName();
|
QString filename = all_file.fileName();
|
||||||
QString fullpath = it->absoluteFilePath();
|
QString fullpath = all_file.absoluteFilePath();
|
||||||
|
|
||||||
// Skip fossil files
|
// Skip fossil files
|
||||||
if (filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!fossil().getRepositoryFile().isEmpty() && QFileInfo(fullpath) == QFileInfo(fossil().getRepositoryFile())))
|
if (filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!fossil().getRepositoryFile().isEmpty() && QFileInfo(fullpath) == QFileInfo(fossil().getRepositoryFile())))
|
||||||
@ -199,7 +195,7 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
|||||||
|
|
||||||
WorkspaceFile::Type type = WorkspaceFile::TYPE_UNKNOWN;
|
WorkspaceFile::Type type = WorkspaceFile::TYPE_UNKNOWN;
|
||||||
|
|
||||||
WorkspaceFile *rf = new WorkspaceFile(*it, type, wkdir);
|
WorkspaceFile *rf = new WorkspaceFile(all_file, type, wkdir);
|
||||||
const QString &path = rf->getPath();
|
const QString &path = rf->getPath();
|
||||||
getFiles().insert(rf->getFilePath(), rf);
|
getFiles().insert(rf->getFilePath(), rf);
|
||||||
getPaths().insert(path);
|
getPaths().insert(path);
|
||||||
@ -220,9 +216,9 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
|||||||
uiCallback.beginProcess(QObject::tr("Updating..."));
|
uiCallback.beginProcess(QObject::tr("Updating..."));
|
||||||
|
|
||||||
// Update Files and Directories
|
// Update Files and Directories
|
||||||
for (QStringList::iterator line_it = res.begin(); line_it != res.end(); ++line_it)
|
for (auto &re : res)
|
||||||
{
|
{
|
||||||
QString line = (*line_it).trimmed();
|
QString line = re.trimmed();
|
||||||
if (line.length() == 0)
|
if (line.length() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -323,9 +319,9 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
|||||||
parent_path = "";
|
parent_path = "";
|
||||||
|
|
||||||
// Merge path of child to parent
|
// Merge path of child to parent
|
||||||
pathstate_map_t::iterator state_it = pathState.find(parent_path);
|
pathstate_map_t::iterator state_it2 = pathState.find(parent_path);
|
||||||
if (state_it != pathState.end())
|
if (state_it2 != pathState.end())
|
||||||
state_it.value() = static_cast<WorkspaceFile::Type>(state_it.value() | state);
|
state_it2.value() = static_cast<WorkspaceFile::Type>(state_it2.value() | state);
|
||||||
else
|
else
|
||||||
pathState.insert(parent_path, state);
|
pathState.insert(parent_path, state);
|
||||||
}
|
}
|
||||||
@ -386,15 +382,15 @@ bool Workspace::setRemoteDefault(const QUrl &url)
|
|||||||
const QString &url_str = url.toString();
|
const QString &url_str = url.toString();
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (remote_map_t::iterator it = remotes.begin(); it != remotes.end(); ++it)
|
for (auto &remote : remotes)
|
||||||
{
|
{
|
||||||
if (it->url.toString() == url_str) // FIXME: Use strings as QUrl to QUrl comparisons sometime fail!?
|
if (remote.url.toString() == url_str) // FIXME: Use strings as QUrl to QUrl comparisons sometime fail!?
|
||||||
{
|
{
|
||||||
it->isDefault = true;
|
remote.isDefault = true;
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
it->isDefault = false;
|
remote.isDefault = false;
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
@ -402,10 +398,10 @@ bool Workspace::setRemoteDefault(const QUrl &url)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
QUrl Workspace::getRemoteDefault() const
|
QUrl Workspace::getRemoteDefault() const
|
||||||
{
|
{
|
||||||
for (remote_map_t::const_iterator it = remotes.begin(); it != remotes.end(); ++it)
|
for (const auto &remote : remotes)
|
||||||
{
|
{
|
||||||
if (it->isDefault)
|
if (remote.isDefault)
|
||||||
return it->url;
|
return remote.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QUrl();
|
return QUrl();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user