diff --git a/core/utilities/firstrun/collectionpage.cpp b/core/utilities/firstrun/collectionpage.cpp
index d3f08a6a2e..ff4b8cb66f 100644
--- a/core/utilities/firstrun/collectionpage.cpp
+++ b/core/utilities/firstrun/collectionpage.cpp
@@ -1,227 +1,234 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "collectionpage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "dlayoutbox.h"
#include "dfileselector.h"
#include "digikam_debug.h"
#include "digikam_version.h"
namespace Digikam
{
class Q_DECL_HIDDEN CollectionPage::Private
{
public:
explicit Private()
: rootAlbumPathRequester(nullptr)
{
}
QString rootAlbum;
DFileSelector* rootAlbumPathRequester;
};
CollectionPage::CollectionPage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Configure where you keep your images")),
d(new Private)
{
- QWidget* const widget = new QWidget(this);
- QVBoxLayout* const vlayout = new QVBoxLayout(widget);
+ QWidget* const widget = new QWidget(this);
+ QVBoxLayout* const vlayout = new QVBoxLayout(widget);
- QString picturesPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
+ QString picturesPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
qCDebug(DIGIKAM_GENERAL_LOG) << picturesPath;
if (picturesPath.isEmpty())
{
picturesPath = QDir::homePath() + i18nc("This is a path name so you should "
"include the slash in the translation", "/Pictures");
}
- QLabel* const textLabel1 = new QLabel(widget);
+ QLabel* const textLabel1 = new QLabel(widget);
textLabel1->setWordWrap(true);
- QString message = i18n("Please enter a location where you keep your images.
"
- "You can choose any local folder, even one that already contains images."
- "
"
- "More folders can be added later under the Settings menu. "
- "
");
+ QString message = i18n("Please enter a location where you keep your images.
"
+ "You can choose any local folder, even one that already contains images."
+ "
"
+ "More folders can be added later under the Settings menu. "
+ "
");
#ifndef Q_OS_WIN
+
message.append(i18n("Note: removable media (such as USB drives or DVDs) and remote file systems "
"(such as NFS, or Samba mounted with cifs/smbfs) are supported.
"));
+
#endif
textLabel1->setText(message);
- d->rootAlbumPathRequester = new DFileSelector(widget);
+ d->rootAlbumPathRequester = new DFileSelector(widget);
d->rootAlbumPathRequester->setFileDlgMode(QFileDialog::Directory);
d->rootAlbumPathRequester->setFileDlgOptions(QFileDialog::ShowDirsOnly);
d->rootAlbumPathRequester->setFileDlgPath(picturesPath);
vlayout->addWidget(textLabel1);
vlayout->addWidget(d->rootAlbumPathRequester);
vlayout->setContentsMargins(QMargins());
vlayout->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
setPageWidget(widget);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("folder-pictures")));
}
CollectionPage::~CollectionPage()
{
delete d;
}
QString CollectionPage::firstAlbumPath() const
{
return d->rootAlbum;
}
void CollectionPage::saveSettings()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup group = config->group("General Settings");
group.writeEntry("Version", digikam_version);
config->sync();
}
bool CollectionPage::checkSettings()
{
QString rootAlbumFolder;
if (!checkRootAlbum(rootAlbumFolder))
{
return false;
}
d->rootAlbum = rootAlbumFolder;
return true;
}
bool CollectionPage::checkRootAlbum(QString& rootAlbumFolder)
{
rootAlbumFolder = d->rootAlbumPathRequester->fileDlgPath();
qCDebug(DIGIKAM_GENERAL_LOG) << "Root album is : " << rootAlbumFolder;
if (rootAlbumFolder.isEmpty())
{
QMessageBox::information(this, qApp->applicationName(),
i18n("You must select a folder for digiKam to "
"use as the root album. All of your images will go there."));
return false;
}
#ifndef Q_OS_WIN
if (!QDir::isAbsolutePath(rootAlbumFolder))
{
rootAlbumFolder.prepend(QDir::homePath());
}
#endif
/*
if (QUrl::fromLocalFile(rootAlbumFolder).equals(QUrl::fromLocalFile(QDir::homePath()), QUrl::CompareWithoutFragment))
{
QMessageBox::information(this, qApp->applicationName(),
i18n("digiKam will not use your home folder as the "
"root album. Please select another location."));
return false;
}
*/
QDir targetPath(rootAlbumFolder);
if (!targetPath.exists())
{
int rc = QMessageBox::question(this, i18n("Create Root Album Folder?"),
i18n("The folder to use as the root album path does not exist:
"
"%1
"
"Would you like digiKam to create it for you?",
QDir::toNativeSeparators(rootAlbumFolder)));
if (rc == QMessageBox::No)
{
return false;
}
if (!targetPath.mkpath(rootAlbumFolder))
{
QMessageBox::information(this, i18n("Create Root Album Folder Failed"),
i18n("digiKam could not create the folder to use as the root album.\n"
"Please select a different location.
"
"%1
", QDir::toNativeSeparators(rootAlbumFolder)));
return false;
}
}
QFileInfo path(rootAlbumFolder);
#ifdef Q_OS_WIN
+
// Work around bug #189168
+
QTemporaryFile temp;
temp.setFileTemplate(rootAlbumFolder + QLatin1String("XXXXXX"));
if (!temp.open())
+
#else
+
if (!path.isWritable())
+
#endif
{
QMessageBox::information(this, qApp->applicationName(),
i18n("You do not seem to have write access for the folder "
"selected to be the root album.\n"
"Warning: Without write access, items cannot be edited."));
}
return true;
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/databasepage.cpp b/core/utilities/firstrun/databasepage.cpp
index d45b14978b..4819164554 100644
--- a/core/utilities/firstrun/databasepage.cpp
+++ b/core/utilities/firstrun/databasepage.cpp
@@ -1,100 +1,101 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "databasepage.h"
// Qt includes
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "dlayoutbox.h"
#include "digikam_debug.h"
#include "dbengineparameters.h"
#include "dbsettingswidget.h"
namespace Digikam
{
class Q_DECL_HIDDEN DatabasePage::Private
{
public:
explicit Private()
: dbsettingswidget(nullptr)
{
}
DatabaseSettingsWidget* dbsettingswidget;
};
DatabasePage::DatabasePage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Configure where you will store databases")),
d(new Private)
{
d->dbsettingswidget = new DatabaseSettingsWidget(this);
setPageWidget(d->dbsettingswidget);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("network-server-database")));
}
DatabasePage::~DatabasePage()
{
delete d;
}
void DatabasePage::setDatabasePath(const QString& path)
{
d->dbsettingswidget->setDatabasePath(path);
}
DbEngineParameters DatabasePage::getDbEngineParameters() const
{
return d->dbsettingswidget->getDbEngineParameters();
}
void DatabasePage::saveSettings()
{
DbEngineParameters params = d->dbsettingswidget->getDbEngineParameters();
params.writeToConfig();
KSharedConfig::openConfig()->sync();
}
bool DatabasePage::checkSettings()
{
// TODO : add checks for Mysql Server.
+
return d->dbsettingswidget->checkDatabaseSettings();
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/firstrundlg.cpp b/core/utilities/firstrun/firstrundlg.cpp
index a262b8581d..419aac58bb 100644
--- a/core/utilities/firstrun/firstrundlg.cpp
+++ b/core/utilities/firstrun/firstrundlg.cpp
@@ -1,181 +1,183 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "firstrundlg.h"
// Qt includes
#include
// Local includes
#include "dxmlguiwindow.h"
#include "welcomepage.h"
#include "migratefromdigikam4page.h"
#include "collectionpage.h"
#include "databasepage.h"
#include "rawpage.h"
#include "metadatapage.h"
#include "previewpage.h"
#include "openfilepage.h"
#include "tooltipspage.h"
#include "startscanpage.h"
namespace Digikam
{
class Q_DECL_HIDDEN FirstRunDlg::Private
{
public:
explicit Private()
: welcomePage(nullptr),
migrateFromDigikam4Page(nullptr),
collectionPage(nullptr),
databasePage(nullptr),
rawPage(nullptr),
metadataPage(nullptr),
previewPage(nullptr),
openFilePage(nullptr),
tooltipsPage(nullptr),
startScanPage(nullptr)
{
}
WelcomePage* welcomePage;
MigrateFromDigikam4Page* migrateFromDigikam4Page;
CollectionPage* collectionPage;
DatabasePage* databasePage;
RawPage* rawPage;
MetadataPage* metadataPage;
PreviewPage* previewPage;
OpenFilePage* openFilePage;
TooltipsPage* tooltipsPage;
StartScanPage* startScanPage;
};
FirstRunDlg::FirstRunDlg(QWidget* const parent)
: QWizard(parent),
d(new Private)
{
setWizardStyle(QWizard::ClassicStyle);
setButtonLayout(QList() << QWizard::HelpButton
<< QWizard::BackButton
<< QWizard::CancelButton
<< QWizard::NextButton
<< QWizard::FinishButton);
- d->welcomePage = new WelcomePage(this); // First assistant page
+ d->welcomePage = new WelcomePage(this); // First assistant page
if (MigrateFromDigikam4Page::checkForMigration())
{
d->migrateFromDigikam4Page = new MigrateFromDigikam4Page(this);
}
d->collectionPage = new CollectionPage(this);
d->databasePage = new DatabasePage(this);
d->rawPage = new RawPage(this);
d->metadataPage = new MetadataPage(this);
d->previewPage = new PreviewPage(this);
d->openFilePage = new OpenFilePage(this);
d->tooltipsPage = new TooltipsPage(this);
// NOTE: Added here new assistant pages...
d->startScanPage = new StartScanPage(this); // Last assistant page
resize(600, 600);
connect(button(QWizard::FinishButton), SIGNAL(clicked()),
this, SLOT(slotFinishPressed()));
connect(this, SIGNAL(helpRequested()),
this, SLOT(slotHelp()));
}
FirstRunDlg::~FirstRunDlg()
{
delete d;
}
void FirstRunDlg::slotHelp()
{
DXmlGuiWindow::openHandbook();
}
QString FirstRunDlg::firstAlbumPath() const
{
return d->collectionPage->firstAlbumPath();
}
DbEngineParameters FirstRunDlg::getDbEngineParameters() const
{
return d->databasePage->getDbEngineParameters();
}
bool FirstRunDlg::validateCurrentPage()
{
if (currentPage() == d->collectionPage)
{
if (!d->collectionPage->checkSettings())
{
return false;
}
else
{
d->databasePage->setDatabasePath(firstAlbumPath());
}
}
if (currentPage() == d->databasePage)
{
if (!d->databasePage->checkSettings())
{
return false;
}
}
return true;
}
void FirstRunDlg::slotFinishPressed()
{
if (d->migrateFromDigikam4Page && d->migrateFromDigikam4Page->isMigrationChecked())
{
// The user choose to do a migration from digikam4
+
d->migrateFromDigikam4Page->doMigration();
}
else
{
// Save settings to rc files.
+
d->collectionPage->saveSettings();
d->databasePage->saveSettings();
d->rawPage->saveSettings();
d->metadataPage->saveSettings();
d->previewPage->saveSettings();
d->openFilePage->saveSettings();
d->tooltipsPage->saveSettings();
}
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/metadatapage.cpp b/core/utilities/firstrun/metadatapage.cpp
index c99bc88e8e..04d97ddf61 100644
--- a/core/utilities/firstrun/metadatapage.cpp
+++ b/core/utilities/firstrun/metadatapage.cpp
@@ -1,124 +1,124 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "metadatapage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
// KDE includes
#include
// Local includes
#include "dlayoutbox.h"
#include "metaenginesettings.h"
namespace Digikam
{
class Q_DECL_HIDDEN MetadataPage::Private
{
public:
explicit Private()
: doNothing(nullptr),
storeInFiles(nullptr),
metadataStorage(nullptr)
{
}
QRadioButton* doNothing;
QRadioButton* storeInFiles;
QButtonGroup* metadataStorage;
};
MetadataPage::MetadataPage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Configure Metadata Storage to Files")),
d(new Private)
{
- const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
+ const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- DVBox* const vbox = new DVBox(this);
- QLabel* const label1 = new QLabel(vbox);
+ DVBox* const vbox = new DVBox(this);
+ QLabel* const label1 = new QLabel(vbox);
label1->setWordWrap(true);
label1->setText(i18n(""
"Set here if you want to store the information assigned to items in digiKam in the files' "
"metadata, to improve interoperability with other photo management programs:
"
""));
QWidget* const btns = new QWidget(vbox);
QVBoxLayout* const vlay = new QVBoxLayout(btns);
- d->metadataStorage = new QButtonGroup(btns);
- d->doNothing = new QRadioButton(btns);
+ d->metadataStorage = new QButtonGroup(btns);
+ d->doNothing = new QRadioButton(btns);
d->doNothing->setText(i18n("Do nothing"));
d->doNothing->setChecked(true);
d->metadataStorage->addButton(d->doNothing);
- d->storeInFiles = new QRadioButton(btns);
+ d->storeInFiles = new QRadioButton(btns);
d->storeInFiles->setText(i18n("Add information to files"));
d->metadataStorage->addButton(d->storeInFiles);
vlay->addWidget(d->doNothing);
vlay->addWidget(d->storeInFiles);
vlay->setContentsMargins(spacing, spacing, spacing, spacing);
vlay->setSpacing(spacing);
- QLabel* const label2 = new QLabel(vbox);
+ QLabel* const label2 = new QLabel(vbox);
label2->setWordWrap(true);
label2->setText(i18n(""
"Note: recording information to the files' metadata can slow down photo "
"management operations.
"
""));
setPageWidget(vbox);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("format-text-code")));
}
MetadataPage::~MetadataPage()
{
delete d;
}
void MetadataPage::saveSettings()
{
MetaEngineSettingsContainer settings;
settings.saveTags = d->storeInFiles->isChecked();
settings.saveComments = d->storeInFiles->isChecked();
settings.saveDateTime = d->storeInFiles->isChecked();
settings.saveRating = d->storeInFiles->isChecked();
settings.savePickLabel = d->storeInFiles->isChecked();
settings.saveColorLabel = d->storeInFiles->isChecked();
settings.saveTemplate = d->storeInFiles->isChecked();
MetaEngineSettings::instance()->setSettings(settings);
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/migratefromdigikam4page.cpp b/core/utilities/firstrun/migratefromdigikam4page.cpp
index 541c826de4..63e55527ab 100644
--- a/core/utilities/firstrun/migratefromdigikam4page.cpp
+++ b/core/utilities/firstrun/migratefromdigikam4page.cpp
@@ -1,265 +1,276 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2016-09-29
* Description : migration page from digikam4
*
* Copyright (C) 2016 by Antonio Larrosa
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "migratefromdigikam4page.h"
// Qt includes
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "digikam_debug.h"
#include "dbengineparameters.h"
#include "dlayoutbox.h"
namespace Digikam
{
class Q_DECL_HIDDEN MigrateFromDigikam4Page::Private
{
public:
explicit Private()
: migrateBehavior(nullptr),
migrate(nullptr),
createnew(nullptr)
{
}
QButtonGroup* migrateBehavior;
QRadioButton* migrate;
QRadioButton* createnew;
};
MigrateFromDigikam4Page::MigrateFromDigikam4Page(QWizard* const dlg)
: DWizardPage(dlg, i18n("Migration from digiKam 4")),
d(new Private)
{
- const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- DVBox* const vbox = new DVBox(this);
- QLabel* const title = new QLabel(vbox);
+ const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
+ DVBox* const vbox = new DVBox(this);
+ QLabel* const title = new QLabel(vbox);
title->setWordWrap(true);
title->setText(i18n(""
"Migrate configuration and metadata from digiKam 4
"
"You can choose here if you want to use the configuration and albums from digiKam 4 in new digiKam. "
"Please note the following warnings:
"
"Migration is done at your own risk. digiKam developers "
"do not recommend it and do not support it. On the other hand, creating "
"a new configuration might result in loss of tags and other metadata that was not embedded inside "
"the pictures and was only available in digiKam 4's database.
"
"In either case you are recommended to backup "
"the configuration files and databases before proceeding.
"
""));
- QWidget* const btns = new QWidget(vbox);
- QVBoxLayout* const vlay = new QVBoxLayout(btns);
+ QWidget* const btns = new QWidget(vbox);
+ QVBoxLayout* const vlay = new QVBoxLayout(btns);
d->migrateBehavior = new QButtonGroup(btns);
d->migrate = new QRadioButton(btns);
d->migrate->setText(i18n("Migrate configuration from digiKam 4"));
d->migrate->setChecked(true);
connect(d->migrate, SIGNAL(toggled(bool)),
this, SLOT(migrationToggled(bool)));
d->migrateBehavior->addButton(d->migrate);
d->createnew = new QRadioButton(btns);
d->createnew->setText(i18n("Create a new configuration"));
d->migrateBehavior->addButton(d->createnew);
vlay->addWidget(d->migrate);
vlay->addWidget(d->createnew);
vlay->setContentsMargins(spacing, spacing, spacing, spacing);
vlay->setSpacing(spacing);
connect(d->migrateBehavior, SIGNAL(buttonClicked(int)),
this, SIGNAL(completeChanged()));
setPageWidget(vbox);
}
MigrateFromDigikam4Page::~MigrateFromDigikam4Page()
{
delete d;
}
void MigrateFromDigikam4Page::doMigration()
{
// Migrate digiKam config files from $KDEHOME/share/config/
+
Kdelibs4ConfigMigrator migrator(QLatin1String("digikam"));
QStringList configFiles;
configFiles << QLatin1String("digikamrc")
<< QLatin1String("digikam_tagsmanagerrc")
<< QLatin1String("showfotorc");
migrator.setConfigFiles(configFiles);
migrator.migrate();
// Migrate digiKam config files from $KDEHOME/share/apps/digikam/
+
Kdelibs4Migration migration;
QString oldappdatadir = migration.locateLocal("data", QLatin1String("digikam"));
QStringList oldAppFiles = QDir(oldappdatadir).entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
foreach (const QString& configFileName, oldAppFiles)
{
const QString newConfigLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
QLatin1Char('/') + configFileName + QLatin1Char('5');
if (QFile(newConfigLocation).exists())
{
qCDebug(DIGIKAM_GENERAL_LOG) << newConfigLocation << " already exists. Skipping";
continue;
}
QFileInfo fileInfo(newConfigLocation);
QDir().mkpath(fileInfo.absolutePath());
const QString oldConfigFile = oldappdatadir + QLatin1Char('/') + configFileName;
if (!oldConfigFile.isEmpty())
{
if (QFile(oldConfigFile).copy(newConfigLocation))
{
qCDebug(DIGIKAM_GENERAL_LOG) << "Config file" << oldConfigFile << "was migrated to" << newConfigLocation;
}
}
}
// Migrate $KDEHOME/share/apps/kipi/geobookmarks.xml to ./.local/share/digikam/geobookmarks.xml
+
QString oldGeobookmarksFile = migration.locateLocal("data", QLatin1String("kipi/geobookmarks.xml"));
- const QString newGeobookmarksFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation)
- + QLatin1String("/geobookmarks.xml");
+ const QString newGeobookmarksFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
+ QLatin1String("/geobookmarks.xml");
if (QFile(newGeobookmarksFile).exists())
{
qCDebug(DIGIKAM_GENERAL_LOG) << newGeobookmarksFile << " already exists. Skipping";
}
else
{
QFileInfo fileInfo(newGeobookmarksFile);
QDir().mkpath(fileInfo.absolutePath());
if (!oldGeobookmarksFile.isEmpty())
{
if (QFile(oldGeobookmarksFile).copy(newGeobookmarksFile))
{
qCDebug(DIGIKAM_GENERAL_LOG) << "Config file" << oldGeobookmarksFile << "was migrated to" << newGeobookmarksFile;
}
}
}
// Fix albumroot identifier since digiKam 5 doesn't interpret correctly
// values like volumeid:?path=%2Fhome%2Fantonio%2FPictures and it needs
// to be url-decoded.
+
DbEngineParameters parameters = DbEngineParameters::parametersFromConfig();
QSqlDatabase databaseHandler = QSqlDatabase::addDatabase(parameters.databaseType, QLatin1String("digikam4migration"));
databaseHandler.setHostName(parameters.hostName);
databaseHandler.setPort(parameters.port);
databaseHandler.setDatabaseName(parameters.databaseNameCore);
databaseHandler.setUserName(parameters.userName);
databaseHandler.setPassword(parameters.password);
databaseHandler.setConnectOptions(parameters.connectOptions);
if (!databaseHandler.open())
{
qCDebug(DIGIKAM_GENERAL_LOG) << "Cannot open database:" << databaseHandler.lastError().text();
return;
}
QSqlQuery query(QLatin1String("SELECT id,identifier FROM albumroots"), databaseHandler);
while (query.next())
{
- int id = query.value(0).toInt();
+ int id = query.value(0).toInt();
QString identifier = query.value(1).toString();
if (identifier.startsWith(QLatin1String("volumeid:?path=%2F")))
{
QUrl url(identifier);
url.setQuery(url.query(QUrl::FullyDecoded), QUrl::DecodedMode);
qCDebug(DIGIKAM_GENERAL_LOG) << "Updating albumroot " << id << " from " << identifier << " to " << url.toString();
QSqlQuery uquery(QLatin1String("UPDATE albumroots SET identifier=? WHERE id=?"), databaseHandler);
uquery.bindValue(0, url.toString());
uquery.bindValue(1, id);
uquery.exec();
}
}
databaseHandler.close();
qCDebug(DIGIKAM_GENERAL_LOG) << "Migration finished";
}
bool MigrateFromDigikam4Page::isMigrationChecked() const
{
return d->migrate->isChecked();
}
void MigrateFromDigikam4Page::migrationToggled(bool b)
{
setFinalPage(b);
}
int MigrateFromDigikam4Page::nextId() const
{
if (d->migrate->isChecked())
- return -1;
+ {
+ return (-1);
+ }
else
+ {
return QWizardPage::nextId();
+ }
}
bool MigrateFromDigikam4Page::checkForMigration()
{
#ifdef Q_OS_LINUX
+
::Kdelibs4Migration migration;
// If there's a digikamrc file in $KDEHOME/share/config,
// then we create the migration page in the wizard
+
return (!migration.locateLocal("config", QLatin1String("digikamrc")).isEmpty());
+
#endif
return false;
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/migratefromdigikam4page.h b/core/utilities/firstrun/migratefromdigikam4page.h
index 5981520f43..562df3d320 100644
--- a/core/utilities/firstrun/migratefromdigikam4page.h
+++ b/core/utilities/firstrun/migratefromdigikam4page.h
@@ -1,67 +1,67 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2016-09-29
* Description : migration page from digikam4
*
* Copyright (C) 2016 by Antonio Larrosa
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#ifndef DIGIKAM_MIGRATE_FROM_DIGIKAM4_PAGE_H
#define DIGIKAM_MIGRATE_FROM_DIGIKAM4_PAGE_H
// Local includes
#include "dwizardpage.h"
namespace Digikam
{
class MigrateFromDigikam4Page : public DWizardPage
{
Q_OBJECT
public:
explicit MigrateFromDigikam4Page(QWizard* const dlg);
~MigrateFromDigikam4Page();
/**
* Returns true if the user selected to do a migration
*/
bool isMigrationChecked() const;
void doMigration();
- int nextId() const;
+ int nextId() const;
/**
* Return true if migration data are available on the system
*/
static bool checkForMigration();
public Q_SLOTS:
void migrationToggled(bool b);
private:
class Private;
Private* const d;
};
} // namespace Digikam
#endif // DIGIKAM_MIGRATE_FROM_DIGIKAM4_PAGE_H
diff --git a/core/utilities/firstrun/openfilepage.cpp b/core/utilities/firstrun/openfilepage.cpp
index a3e25c0fcc..4eda46f509 100644
--- a/core/utilities/firstrun/openfilepage.cpp
+++ b/core/utilities/firstrun/openfilepage.cpp
@@ -1,125 +1,125 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "openfilepage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "dlayoutbox.h"
#include "applicationsettings.h"
namespace Digikam
{
class Q_DECL_HIDDEN OpenFilePage::Private
{
public:
explicit Private()
: openAsPreview(nullptr),
openInEditor(nullptr),
openFileBehavior(nullptr)
{
}
QRadioButton* openAsPreview;
QRadioButton* openInEditor;
QButtonGroup* openFileBehavior;
};
OpenFilePage::OpenFilePage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Configure Open File Behavior")),
d(new Private)
{
- const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
+ const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- DVBox* const vbox = new DVBox(this);
- QLabel* const label1 = new QLabel(vbox);
+ DVBox* const vbox = new DVBox(this);
+ QLabel* const label1 = new QLabel(vbox);
label1->setWordWrap(true);
label1->setText(i18n(""
"Specify how images should be opened when left-clicked on in the icon view:
"
""));
QWidget* const btns = new QWidget(vbox);
QVBoxLayout* const vlay = new QVBoxLayout(btns);
- d->openFileBehavior = new QButtonGroup(btns);
- d->openAsPreview = new QRadioButton(btns);
+ d->openFileBehavior = new QButtonGroup(btns);
+ d->openAsPreview = new QRadioButton(btns);
d->openAsPreview->setText(i18n("Open a preview"));
d->openAsPreview->setChecked(true);
d->openFileBehavior->addButton(d->openAsPreview);
- d->openInEditor = new QRadioButton(btns);
+ d->openInEditor = new QRadioButton(btns);
d->openInEditor->setText(i18n("Open in the editor"));
d->openFileBehavior->addButton(d->openInEditor);
vlay->addWidget(d->openAsPreview);
vlay->addWidget(d->openInEditor);
vlay->setContentsMargins(spacing, spacing, spacing, spacing);
vlay->setSpacing(spacing);
- QLabel* const label2 = new QLabel(vbox);
+ QLabel* const label2 = new QLabel(vbox);
label2->setWordWrap(true);
label2->setText(i18n(""
"Note: using a preview is always faster than using the editor, "
"especially when checking a series of shots. However, you cannot change or fix the image "
"in preview mode. "
"Note that if you want to compare images quickly, it is often better to use the light table: "
"images can be displayed side-by-side, and synchronized zooming and panning can be performed.
"
""));
setPageWidget(vbox);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("folder-pictures"))); //image-stack
}
OpenFilePage::~OpenFilePage()
{
delete d;
}
void OpenFilePage::saveSettings()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup group = config->group(QLatin1String("Album Settings"));
group.writeEntry(QLatin1String("Item Left Click Action"), (int)(d->openInEditor->isChecked() ?
ApplicationSettings::StartEditor : ApplicationSettings::ShowPreview));
config->sync();
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/previewpage.cpp b/core/utilities/firstrun/previewpage.cpp
index 5f185716be..9bc7534376 100644
--- a/core/utilities/firstrun/previewpage.cpp
+++ b/core/utilities/firstrun/previewpage.cpp
@@ -1,124 +1,124 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "previewpage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "dlayoutbox.h"
namespace Digikam
{
class Q_DECL_HIDDEN PreviewPage::Private
{
public:
explicit Private()
: loadReduced(nullptr),
loadimage(nullptr),
previewBehavior(nullptr)
{
}
QRadioButton* loadReduced;
QRadioButton* loadimage;
QButtonGroup* previewBehavior;
};
PreviewPage::PreviewPage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Configure Preview Behavior")),
d(new Private)
{
const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
DVBox* const vbox = new DVBox(this);
QLabel* const label1 = new QLabel(vbox);
label1->setWordWrap(true);
label1->setText(i18n(""
"Set here how images are displayed in preview mode and on the light table:
"
""));
QWidget* const btns = new QWidget(vbox);
QVBoxLayout* const vlay = new QVBoxLayout(btns);
d->previewBehavior = new QButtonGroup(btns);
d->loadReduced = new QRadioButton(btns);
d->loadReduced->setText(i18n("Load reduced version of image"));
d->loadReduced->setChecked(true);
d->previewBehavior->addButton(d->loadReduced);
d->loadimage = new QRadioButton(btns);
d->loadimage->setText(i18n("Load image"));
d->previewBehavior->addButton(d->loadimage);
vlay->addWidget(d->loadReduced);
vlay->addWidget(d->loadimage);
vlay->setContentsMargins(spacing, spacing, spacing, spacing);
vlay->setSpacing(spacing);
- QLabel* const label2 = new QLabel(vbox);
+ QLabel* const label2 = new QLabel(vbox);
label2->setWordWrap(true);
label2->setText(i18n(""
"Note: loading a reduced version of an image is faster but can differ "
"from the original, especially with Raw. In this case, a JPEG version "
"of Raw pre-processed by camera is loaded, instead of the real image data. This JPEG "
"image is embedded in the file metadata and is used by the camera to display "
"a Raw image faster to a TV screen.
"
""));
setPageWidget(vbox);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("view-preview")));
}
PreviewPage::~PreviewPage()
{
delete d;
}
void PreviewPage::saveSettings()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup group = config->group(QLatin1String("Album Settings"));
group.writeEntry(QLatin1String("Preview Load Full Image Size"), d->loadimage->isChecked());
config->sync();
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/rawpage.cpp b/core/utilities/firstrun/rawpage.cpp
index bbee787227..107fcba293 100644
--- a/core/utilities/firstrun/rawpage.cpp
+++ b/core/utilities/firstrun/rawpage.cpp
@@ -1,120 +1,120 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "rawpage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "dlayoutbox.h"
namespace Digikam
{
class Q_DECL_HIDDEN RawPage::Private
{
public:
explicit Private()
: openDirectly(nullptr),
useRawImport(nullptr),
rawHandling(nullptr)
{
}
QRadioButton* openDirectly;
QRadioButton* useRawImport;
QButtonGroup* rawHandling;
};
RawPage::RawPage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Configure Raw File Handling")),
d(new Private)
{
- const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
+ const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- DVBox* const vbox = new DVBox(this);
- QLabel* const label1 = new QLabel(vbox);
+ DVBox* const vbox = new DVBox(this);
+ QLabel* const label1 = new QLabel(vbox);
label1->setWordWrap(true);
label1->setText(i18n(""
"Set here how you want to open Raw images in the editor:
"
""));
QWidget* const btns = new QWidget(vbox);
QVBoxLayout* const vlay = new QVBoxLayout(btns);
- d->rawHandling = new QButtonGroup(btns);
- d->openDirectly = new QRadioButton(btns);
+ d->rawHandling = new QButtonGroup(btns);
+ d->openDirectly = new QRadioButton(btns);
d->openDirectly->setText(i18n("Open directly, with adjustments made automatically"));
d->openDirectly->setChecked(true);
d->rawHandling->addButton(d->openDirectly);
- d->useRawImport = new QRadioButton(btns);
+ d->useRawImport = new QRadioButton(btns);
d->useRawImport->setText(i18n("Use the Raw import tool to adjust corrections manually"));
d->rawHandling->addButton(d->useRawImport);
vlay->addWidget(d->openDirectly);
vlay->addWidget(d->useRawImport);
vlay->setContentsMargins(spacing, spacing, spacing, spacing);
vlay->setSpacing(spacing);
- QLabel* const label2 = new QLabel(vbox);
+ QLabel* const label2 = new QLabel(vbox);
label2->setWordWrap(true);
label2->setText(i18n(""
"Note: the Raw import tool is designed for advanced users who "
"want to have the best control over the image. "
"This requires more time in your workflow.
"
""));
setPageWidget(vbox);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("image-x-adobe-dng")));
}
RawPage::~RawPage()
{
delete d;
}
void RawPage::saveSettings()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup group = config->group(QLatin1String("ImageViewer Settings"));
group.writeEntry(QLatin1String("UseRawImportTool"), d->useRawImport->isChecked());
config->sync();
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/tooltipspage.cpp b/core/utilities/firstrun/tooltipspage.cpp
index f95e56d413..fd0e6539ae 100644
--- a/core/utilities/firstrun/tooltipspage.cpp
+++ b/core/utilities/firstrun/tooltipspage.cpp
@@ -1,126 +1,126 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "tooltipspage.h"
// Qt includes
#include
#include
#include
#include
#include
#include
// KDE includes
#include
#include
#include
// Local includes
#include "dlayoutbox.h"
namespace Digikam
{
class Q_DECL_HIDDEN TooltipsPage::Private
{
public:
explicit Private()
: showTooltips(nullptr),
hideTooltips(nullptr),
tooltipsBehavior(nullptr)
{
}
QRadioButton* showTooltips;
QRadioButton* hideTooltips;
QButtonGroup* tooltipsBehavior;
};
TooltipsPage::TooltipsPage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Enabled Contextual Tooltips")),
d(new Private)
{
- const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
+ const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- DVBox* const vbox = new DVBox(this);
- QLabel* const label1 = new QLabel(vbox);
+ DVBox* const vbox = new DVBox(this);
+ QLabel* const label1 = new QLabel(vbox);
label1->setWordWrap(true);
label1->setText(i18n(""
"Set here if you want to show contextual tooltips in icon-view and folder-view:
"
""));
QWidget* const btns = new QWidget(vbox);
QVBoxLayout* const vlay = new QVBoxLayout(btns);
- d->tooltipsBehavior = new QButtonGroup(btns);
- d->hideTooltips = new QRadioButton(btns);
+ d->tooltipsBehavior = new QButtonGroup(btns);
+ d->hideTooltips = new QRadioButton(btns);
d->hideTooltips->setText(i18n("Do not show tooltips"));
d->hideTooltips->setChecked(true);
d->tooltipsBehavior->addButton(d->hideTooltips);
- d->showTooltips = new QRadioButton(btns);
+ d->showTooltips = new QRadioButton(btns);
d->showTooltips->setText(i18n("Use Tooltips"));
d->tooltipsBehavior->addButton(d->showTooltips);
vlay->addWidget(d->hideTooltips);
vlay->addWidget(d->showTooltips);
vlay->setContentsMargins(spacing, spacing, spacing, spacing);
vlay->setSpacing(spacing);
- QLabel* const label2 = new QLabel(vbox);
+ QLabel* const label2 = new QLabel(vbox);
label2->setWordWrap(true);
label2->setText(i18n(""
"Note: tooltips show photograph and digiKam metadata on the fly, "
"as the mouse moves over items. This can be useful when selecting items. "
"Tooltips are displayed in the album folder view, "
"album icon view, camera icon view, batch queue list, and thumb bar. "
"From the digiKam configuration dialog, you can customize the contents of these "
"tooltips and the fonts used.
"
""));
setPageWidget(vbox);
setLeftBottomPix(QIcon::fromTheme(QLatin1String("dialog-information")));
}
TooltipsPage::~TooltipsPage()
{
delete d;
}
void TooltipsPage::saveSettings()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup group = config->group(QLatin1String("Album Settings"));
group.writeEntry(QLatin1String("Show ToolTips"), d->showTooltips->isChecked());
group.writeEntry(QLatin1String("Show Album ToolTips"), d->showTooltips->isChecked());
config->sync();
}
} // namespace Digikam
diff --git a/core/utilities/firstrun/welcomepage.cpp b/core/utilities/firstrun/welcomepage.cpp
index 1035d77144..ffad81eaa8 100644
--- a/core/utilities/firstrun/welcomepage.cpp
+++ b/core/utilities/firstrun/welcomepage.cpp
@@ -1,101 +1,104 @@
/* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2009-28-04
* Description : first run assistant dialog
*
* Copyright (C) 2009-2020 by Gilles Caulier
*
* This program 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, or (at your option)
* any later version.
*
* 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.
*
* ============================================================ */
#include "welcomepage.h"
// Qt includes
#include
// KDE includes
#include
// Local includes
#include "dlayoutbox.h"
#include "digikam_version.h"
namespace Digikam
{
WelcomePage::WelcomePage(QWizard* const dlg)
: DWizardPage(dlg, i18n("Welcome to digiKam %1",
QLatin1String(digikam_version_short)))
{
DVBox* const vbox = new DVBox(this);
QLabel* const title = new QLabel(vbox);
title->setWordWrap(true);
QString text = i18n(""
"Welcome to digiKam %1
"
"digiKam is an advanced digital photo management "
"application published as open-source.
"
"This assistant will help you to configure first "
"run settings to be able to use digiKam quickly.
"
"",
QLatin1String(digikam_version_short));
#if defined Q_OS_WIN || defined Q_OS_OSX
// Windows settings place.
+
QString newPlace = QLatin1String("~/Local Settings/");
QString oldPlace = QLatin1String("~/AppData/Local/");
#if defined Q_OS_OSX
// MacOS settings place.
+
newPlace = QLatin1String("~/Library/Preferences/");
oldPlace = QLatin1String("~/Library/Preferences/KDE/share/config/");
+
#endif
text.append(i18n(
"
"
"You can ignore the following if you use digiKam "
"for the first time:
"
"Transition from digiKam 4
"
"Configuration files from digiKam 4 are not "
"migrated. The old database can still be used, you "
"just need to choose the same locations for "
"collections and database in the following dialogs. "
"It is recommended to create a backup of your database "
"before proceeding.
"
"The new location for configuration files is "
"%1 (old %2). "
"There are unresolved problems reported when re-using old "
"configuration files, so it is not recommended to do it "
"for the moment, and at your own risk.
"
"",
newPlace,
- oldPlace
- ));
+ oldPlace));
+
#endif
title->setText(text);
setPageWidget(vbox);
}
WelcomePage::~WelcomePage()
{
}
} // namespace Digikam