Compare commits

...

11 Commits

Author SHA1 Message Date
dependabot[bot]
4045938bb7
Bump actions/cache from 2.1.7 to 3 (#19) 2022-03-22 15:34:37 +00:00
dependabot[bot]
26c10b8ccc
Bump actions/checkout from 2.4.0 to 3 (#18) 2022-03-22 15:33:15 +00:00
4c18fa3944 👷 Fixed installing build tools 2022-03-22 16:26:08 +01:00
8e2ff6c116 ⬆️ Update qtkeychain to 0.13.2 2021-12-05 16:24:28 +01:00
2408dc32ea 👷 Install qtkeychain from artifactory 2021-12-05 16:24:28 +01:00
dependabot[bot]
0a6c764ce3
Bump actions/cache from 2.1.6 to 2.1.7 (#16) 2021-11-29 15:57:32 +00:00
dependabot[bot]
dc38809146
Bump actions/checkout from 2.3.5 to 2.4.0 (#15) 2021-11-08 15:31:19 +00:00
f308c6845e 📦 Switch to makedeb for packaging deb 2021-10-19 11:07:42 +02:00
bfbb45d5cc 📦 Use NSIS for packaging instead of WiX 2021-10-18 18:24:40 +02:00
7503db9059 🚨 Fixed some clang warnings 2021-10-18 18:24:40 +02:00
dependabot[bot]
25b78bd8d8
Bump actions/checkout from 2.3.4 to 2.3.5 (#12) 2021-10-18 15:10:08 +00:00
21 changed files with 132 additions and 204 deletions

View File

@ -7,29 +7,34 @@ jobs:
build-msvc:
name: Build Windows
runs-on: windows-latest
env:
BUILD_TOOLS_PATH: C:\apps\build-tools\
steps:
- name: Add Conan to path
run: echo "C:\Program Files\Conan\conan\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- run: echo $env:BUILD_TOOLS_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v3
with:
submodules: true
- name: Install deps
run: choco install jom conan -y
- name: Install Build tools
shell: cmake -P {0}
run: |
file(MAKE_DIRECTORY $ENV{BUILD_TOOLS_PATH})
file(DOWNLOAD https://cdn.anotherfoxguy.com/build-tools.zip "$ENV{TMP}/build-tools.zip" SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "$ENV{TMP}/build-tools.zip" WORKING_DIRECTORY "$ENV{BUILD_TOOLS_PATH}")
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.10.0
- name: Cache conan packages
uses: actions/cache@v2.1.6
uses: actions/cache@v3
with:
key: win-conan-${{ hashFiles('**/conanfile.txt') }}
path: ~/.conan/
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2.1.6
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/qt/"
key: ${{ runner.os }}-QtCache
@ -41,23 +46,22 @@ jobs:
modules: qtwebengine
dir: "${{ github.workspace }}/qt/"
- name: Export qtkeychain
run: |
conan export recipes/qtkeychain
- name: Add conan remote
run: conan remote add fuel-scm https://artifactory.anotherfoxguy.com/artifactory/api/conan/fuel-scm -f
- name: Build
run: |
mkdir build
cd build
conan install .. --build=missing
cmake -G"NMake Makefiles JOM" -DCMAKE_INSTALL_PREFIX=redist ..
jom
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=redist ..
ninja
shell: cmd
- name: Install
run: |
cd build
jom install
ninja install
shell: cmd
- name: Upload redist folder
@ -70,7 +74,7 @@ jobs:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v3
with:
submodules: true
@ -85,4 +89,4 @@ jobs:
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
shell: bash
shell: bash

3
.gitignore vendored
View File

@ -44,4 +44,5 @@ CMakeLists.txt.user*
*.qm
/build*
.idea/
.idea/
test-pr

View File

@ -155,7 +155,9 @@ endif ()
# ------------------------------------------------------------------------------------------------#
include(GNUInstallDirs)
include(FetchContent)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}")
set(CPACK_PACKAGE_DESCRIPTION "A GUI front-end for the Fossil SCM")
@ -191,22 +193,34 @@ if (WIN32)
install(CODE "execute_process(COMMAND ${QT_BIN_DIR}/windeployqt.exe $<TARGET_FILE:${PROJECT_NAME}> --release --no-opengl-sw --dir \${CMAKE_INSTALL_PREFIX})")
FetchContent_Declare(
fossil
URL https://fossil-scm.org/home/uv/fossil-w64-2.17.zip
URL_MD5 f62b6e28846871741e057cfd09acdfc8
)
FetchContent_MakeAvailable(fossil)
install(
PROGRAMS ${fossil_SOURCE_DIR}/fossil.exe
DESTINATION .
COMPONENT Fossil
EXCLUDE_FROM_ALL
)
# For Windows Desktop shortcuts
set(CPACK_CREATE_DESKTOP_LINKS "${PROJECT_NAME}" "${PROJECT_NAME}")
# Windows Add or Remove Program properties
set(CPACK_WIX_PROGRAM_MENU_FOLDER "${PROJECT_NAME}")
set(CPACK_WIX_PROPERTY_ARPCOMMENTS "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "https://fuel-scm.org")
set(CPACK_WIX_PROPERTY_URLUPDATEINFO "https://fuel-scm.org")
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/rsrc/icons/fuel.ico")
set(CPACK_WIX_LICENSE_RTF "${CPACK_RESOURCE_FILE_LICENSE}")
set(CPACK_WIX_UPGRADE_GUID "462522bf-36e4-4ce9-93e1-a4200f23096e")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_NSIS_MODIFY_PATH "ON")
set(CPACK_NSIS_HELP_LINK "https://fuel-scm.org")
set(CPACK_NSIS_URL_INFO_ABOUT "https://fuel-scm.org")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "Fuel.exe")
SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/rsrc/icons/fuel.ico")
SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/rsrc/icons/fuel.ico")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
set(CPACK_GENERATOR ${CPACK_GENERATOR};WIX)
set(CPACK_GENERATOR ${CPACK_GENERATOR} NSIS)
set(CPACK_MODULE_PATH "")
endif ()

View File

@ -1,5 +1,5 @@
[requires]
qtkeychain/0.12.0
qtkeychain/0.13.2
[generators]
qmake

View File

@ -1,8 +0,0 @@
fuel (1.0.0-1) unstable; urgency=low
* Feature: Long Operations can now be aborted by pressing the Escape key
* Improvement: Better support for commit messages with international characters
* Improvement: Fossil queries about CR/NL inconsistencies are now handled better
* Improvement: Files in Conflicted state are now shown
* Added localisations: Russia, Portuguese
-- Kostas <karanikolas@gmail.com> Sat, 28 Mar 2015 12:00:00 +0200

1
dist/debian/compat vendored
View File

@ -1 +0,0 @@
9

17
dist/debian/control vendored
View File

@ -1,17 +0,0 @@
Source: fuel
Section: x11
Priority: optional
Maintainer: Kostas Karanikolas <karanikolas@gmail.com>
Build-Depends: cdbs, debhelper (>= 8.0.0), qtbase5-dev, qttools5-dev-tools,
libqt5webkit5-dev
Standards-Version: 3.9.4
Homepage: http://fuelscm.org
#Vcs-Git: git://git.debian.org/collab-maint/fuel.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/fuel.git;a=summary
Package: fuel
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: fossil
Description: Fossil SCM GUI
Fuel is cross-platform GUI front-end for the Fossil SCM tool written in Qt.

38
dist/debian/copyright vendored
View File

@ -1,38 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: fuel
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2014 Kostas <kostas@unknown>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package 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 <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

View File

@ -1 +0,0 @@
rsrc/icons/fuel.png usr/share/pixmaps

6
dist/debian/menu vendored
View File

@ -1,6 +0,0 @@
?package(fuel):\
needs="X11"\
section="Applications/File Management"\
title="Fuel"\
icon32x32="/usr/share/pixmaps/fuel.png"\
command="/usr/bin/fuel"

6
dist/debian/rules vendored
View File

@ -1,6 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/qmake.mk

View File

@ -1 +0,0 @@
3.0 (quilt)

24
dist/debian/watch vendored
View File

@ -1,24 +0,0 @@
# Example watch control file for uscan
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# See uscan(1) for format
# Compulsory line, this is a version 3 file
version=3
# Uncomment to examine a Webpage
# <Webpage URL> <string match>
#http://www.example.com/downloads.php fuel-(.*)\.tar\.gz
http://fuelscm.org/files/releases fuel-(.*)\.tar\.gz
# Uncomment to examine a Webserver directory
#http://www.example.com/pub/fuel-(.*)\.tar\.gz
# Uncommment to examine a FTP server
#ftp://ftp.example.com/pub/fuel-(.*)\.tar\.gz debian uupdate
# Uncomment to find new files on sourceforge, for devscripts >= 2.9
# http://sf.net/fuel/fuel-(.*)\.tar\.gz
# Uncomment to find new files on GooglePages
# http://example.googlepages.com/foo.html fuel-(.*)\.tar\.gz

27
dist/makedeb/PKGBUILD vendored Normal file
View File

@ -0,0 +1,27 @@
# Maintainer: Edgar <Edgar{at}AnotherFoxGuy.com>
pkgname=fuel-git
pkgver=2.0.0
pkgrel=1
pkgdesc="A GUI front-end to Fossil SCM"
arch=(i686 x86_64)
url="https://fuel-scm.org/"
license=('GPL2')
depends=('qtbase5-dev' 'qtwebengine5-dev' 'qttools5-dev' 'fossil' 'qt5keychain-dev')
makedepends=('git' 'cmake')
source=("git://github.com/AnotherFoxGuy/fuel-scm")
md5sums=('SKIP')
build() {
cd "$srcdir/fuel-scm"
[ -d build ] && rm -r build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
make -j$(nproc)
}
package() {
cd "$srcdir/fuel-scm/build"
make DESTDIR="${pkgdir}" install
}

View File

@ -3,7 +3,7 @@ from conans import ConanFile, CMake, tools
class QtkeychainConan(ConanFile):
name = "qtkeychain"
version = "0.12.0"
version = "0.13.2"
license = "BSD-3"
author = "Edgar"
url = "https://github.com/AnotherFoxGuy/fuel-scm"
@ -14,7 +14,7 @@ class QtkeychainConan(ConanFile):
scm = {
"type": "git",
"url": "https://github.com/frankosterfeld/qtkeychain.git",
"revision": "v0.12.0"
"revision": "v0.13.2"
}
def build(self):

View File

@ -123,7 +123,7 @@ void Settings::SetFossilValue(const QString &name, const QVariant &value)
//-----------------------------------------------------------------------------
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);
return res.isValid();
}

View File

@ -48,7 +48,7 @@ bool CloneDialog::run(QWidget *parent, QUrl &url, QString &repository, QUrl &url
QString urltext = dlg.ui->lineURL->text();
// Check if the url is a local file
if (QFileInfo(urltext).exists())
if (QFileInfo::exists(urltext))
url = QUrl::fromLocalFile(urltext);
else
{

View File

@ -36,14 +36,14 @@ WorkspaceState Fossil::getWorkspaceState()
bool run_ok = exit_code == EXIT_SUCCESS;
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)
continue;
QString key = it->left(col_index).trimmed();
QString value = it->mid(col_index + 1).trimmed();
QString key = re.left(col_index).trimmed();
QString value = re.mid(col_index + 1).trimmed();
if (key == "fossil")
{
@ -363,7 +363,7 @@ bool Fossil::revertFiles(const QStringList &fileList)
bool Fossil::renameFile(const QString &beforePath, const QString &afterPath, bool renameLocal)
{
// Ensure we can rename the file
if (!QFileInfo(beforePath).exists() || QFileInfo(afterPath).exists())
if (!QFileInfo::exists(beforePath) || QFileInfo::exists(afterPath))
return false;
// Do Rename
@ -449,7 +449,7 @@ bool Fossil::setRemoteUrl(const QUrl &url)
// FIXME: Fossil ignores any password passed via the URL
// 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;
}
@ -817,7 +817,7 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
// Create fossil process
// FIXME: when we are sure this works delete this
// LoggedProcess process(parentWidget*/);
LoggedProcess process(0);
LoggedProcess process(nullptr);
process.setWorkingDirectory(wkdir);
@ -860,11 +860,7 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
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();
#endif
break;
}
@ -1109,7 +1105,7 @@ bool Fossil::isWorkspace(const QString &path)
QString checkout_file1 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT1;
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())
{
#ifdef Q_WS_WIN
fossilUI.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
#else
fossilUI.terminate();
#endif
}
fossilUI.close();
fossilUIPort.clear();

View File

@ -199,12 +199,12 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
}
}
Q_ASSERT(recent_sep);
for (int i = 0; i < MAX_RECENT; ++i)
for (auto &recentWorkspaceAct : recentWorkspaceActs)
{
recentWorkspaceActs[i] = new QAction(this);
recentWorkspaceActs[i]->setVisible(false);
connect(recentWorkspaceActs[i], SIGNAL(triggered()), this, SLOT(onOpenRecent()));
ui->menuFile->insertAction(recent_sep, recentWorkspaceActs[i]);
recentWorkspaceAct = new QAction(this);
recentWorkspaceAct->setVisible(false);
connect(recentWorkspaceAct, SIGNAL(triggered()), this, SLOT(onOpenRecent()));
ui->menuFile->insertAction(recent_sep, recentWorkspaceAct);
}
// Custom Actions
@ -368,7 +368,7 @@ bool MainWindow::openWorkspace(const QString &path)
QString checkout_file1 = wkspace + PATH_SEPARATOR + FOSSIL_CHECKOUT1;
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?")))
{
@ -569,8 +569,8 @@ void MainWindow::on_actionCloneRepository_triggered()
//------------------------------------------------------------------------------
void MainWindow::rebuildRecent()
{
for (int i = 0; i < MAX_RECENT; ++i)
recentWorkspaceActs[i]->setVisible(false);
for (auto &recentWorkspaceAct : recentWorkspaceActs)
recentWorkspaceAct->setVisible(false);
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->actionViewUnknown};
for (size_t i = 0; i < COUNTOF(actions); ++i)
actions[i]->setEnabled(on);
for (auto &action : actions)
action->setEnabled(on);
}
//------------------------------------------------------------------------------
@ -710,9 +710,8 @@ static void addPathToTree(QStandardItem &root, const QString &path, const QIcon
QStandardItem *parent = &root;
QString fullpath;
for (QStringList::iterator it = dirs.begin(); it != dirs.end(); ++it)
for (auto &dir : dirs)
{
const QString &dir = *it;
fullpath += dir;
// Find the child that matches this subdirectory
@ -810,7 +809,7 @@ void MainWindow::updateWorkspaceView()
if (viewMode == VIEWMODE_TREE)
{
// FIXME: Change paths to map to allow for automatic sorting
QStringList paths = getWorkspace().getPaths().toList();
QStringList paths = getWorkspace().getPaths().values();
paths.sort();
foreach (const QString &dir, paths)
@ -885,15 +884,15 @@ void MainWindow::updateWorkspaceView()
remotes->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTES, ""), ROLE_WORKSPACE_ITEM);
remotes->setEditable(false);
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);
remote_item->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTE, it->url.toString()), ROLE_WORKSPACE_ITEM);
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->setToolTip(UrlToStringDisplay(it->url));
remote_item->setToolTip(UrlToStringDisplay(it.url));
// Mark the default url as bold
if (it->isDefault)
if (it.isDefault)
{
QFont font = remote_item->font();
font.setBold(true);
@ -972,12 +971,12 @@ void MainWindow::updateFileView()
const QString *status_text = &status_unknown;
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_icon_path = stats[t].icon;
status_text = &stat.text;
status_icon_path = stat.icon;
break;
}
}
@ -1188,9 +1187,8 @@ void MainWindow::updateSettings()
Settings::custom_actions_t &actions = settings.GetCustomActions();
store->beginWriteArray("CustomActions", actions.size());
int active_actions = 0;
for (int i = 0; i < actions.size(); ++i)
for (auto &action : actions)
{
CustomAction &action = actions[i];
if (!action.IsValid())
continue;
store->setArrayIndex(active_actions);

View File

@ -41,9 +41,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, Settings &_settings) : QDialog(p
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->setCurrentIndex(0);
@ -79,9 +78,8 @@ void SettingsDialog::on_buttonBox_accepted()
if (curr_langid != new_langid)
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.Command = a.Command.trimmed();
}

View File

@ -39,15 +39,15 @@ void Workspace::storeWorkspace(QSettings &store)
store.beginWriteArray(workspace_hash);
int index = 0;
for (remote_map_t::iterator it = remotes.begin(); it != remotes.end(); ++it, ++index)
for (auto &re : remotes)
{
store.setArrayIndex(index);
store.setValue("Name", it->name);
QUrl url = it->url;
store.setValue("Name", re.name);
QUrl url = re.url;
url.setPassword("");
store.setValue("Url", url);
if (it->isDefault)
store.setValue("Default", it->isDefault);
if (re.isDefault)
store.setValue("Default", re.isDefault);
else
store.remove("Default");
}
@ -77,10 +77,7 @@ bool Workspace::switchWorkspace(const QString &workspace, QSettings &store)
// Load Remotes
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
QString gr = store.group();
store.beginGroup("Remotes");
gr = store.group();
int num_remotes = store.beginReadArray(workspace_hash);
for (int i = 0; i < num_remotes; ++i)
{
@ -124,12 +121,11 @@ bool Workspace::scanDirectory(QFileInfoList &entries, const QString &dirPath, co
uiCallback.updateProcess(dirPath);
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())
return false;
QFileInfo info = list[i];
QString filepath = info.filePath();
QString rel_path = filepath;
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))
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 fullpath = it->absoluteFilePath();
QString filename = all_file.fileName();
QString fullpath = all_file.absoluteFilePath();
// Skip fossil files
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 *rf = new WorkspaceFile(*it, type, wkdir);
WorkspaceFile *rf = new WorkspaceFile(all_file, type, wkdir);
const QString &path = rf->getPath();
getFiles().insert(rf->getFilePath(), rf);
getPaths().insert(path);
@ -220,9 +216,9 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
uiCallback.beginProcess(QObject::tr("Updating..."));
// 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)
continue;
@ -323,9 +319,9 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
parent_path = "";
// Merge path of child to parent
pathstate_map_t::iterator state_it = pathState.find(parent_path);
if (state_it != pathState.end())
state_it.value() = static_cast<WorkspaceFile::Type>(state_it.value() | state);
pathstate_map_t::iterator state_it2 = pathState.find(parent_path);
if (state_it2 != pathState.end())
state_it2.value() = static_cast<WorkspaceFile::Type>(state_it2.value() | state);
else
pathState.insert(parent_path, state);
}
@ -386,15 +382,15 @@ bool Workspace::setRemoteDefault(const QUrl &url)
const QString &url_str = url.toString();
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;
}
else
it->isDefault = false;
remote.isDefault = false;
}
return found;
}
@ -402,10 +398,10 @@ bool Workspace::setRemoteDefault(const QUrl &url)
//------------------------------------------------------------------------------
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)
return it->url;
if (remote.isDefault)
return remote.url;
}
return QUrl();