diff --git a/MainWindow/Window.cpp b/MainWindow/Window.cpp
index 15982245..ff3b8d0c 100644
--- a/MainWindow/Window.cpp
+++ b/MainWindow/Window.cpp
@@ -1,1838 +1,1838 @@
/* Copyright (C) 2003-2020 The KPhotoAlbum Development Team
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 of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "Window.h"
#include
#include
#ifdef HAVE_STDLIB_H
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include // for #if KIO_VERSION...
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef KF5Purpose_FOUND
#include
#endif
#include "AutoStackImages.h"
#include "BreadcrumbViewer.h"
#include "CopyPopup.h"
#include "DeleteDialog.h"
#include "DirtyIndicator.h"
#include "DuplicateMerger/DuplicateMerger.h"
#include "ExternalPopup.h"
#include "FeatureDialog.h"
#include "ImageCounter.h"
#include "InvalidDateFinder.h"
#include "Logging.h"
#include "Options.h"
#include "SearchBar.h"
#include "SplashScreen.h"
#include "StatisticsDialog.h"
#include "StatusBar.h"
#include "TokenEditor.h"
#include "UpdateVideoThumbnail.h"
#include "WelcomeDialog.h"
#ifdef HAVE_MARBLE
#include
"),
i18n("Feature has not been configured"));
}
}
void MainWindow::Window::setupStatusBar()
{
m_statusBar = new MainWindow::StatusBar;
setStatusBar(m_statusBar);
setLocked(Settings::SettingsData::instance()->locked(), true, false);
connect(m_statusBar, &StatusBar::thumbnailSettingsRequested, [this]() { this->slotOptions(); m_settingsDialog->activatePage(Settings::SettingsPage::ThumbnailsPage); });
}
void MainWindow::Window::slotRecreateExifDB()
{
Exif::Database::instance()->recreate();
}
void MainWindow::Window::useNextVideoThumbnail()
{
UpdateVideoThumbnail::useNext(selected());
}
void MainWindow::Window::usePreviousVideoThumbnail()
{
UpdateVideoThumbnail::usePrevious(selected());
}
void MainWindow::Window::mergeDuplicates()
{
DuplicateMerger *merger = new DuplicateMerger;
merger->show();
}
void MainWindow::Window::slotThumbnailSizeChanged()
{
QString thumbnailSizeMsg = i18nc("@info:status",
//xgettext:no-c-format
"Thumbnail width: %1px (storage size: %2px)",
Settings::SettingsData::instance()->actualThumbnailSize(),
Settings::SettingsData::instance()->thumbnailSize());
m_statusBar->showMessage(thumbnailSizeMsg, 4000);
}
void MainWindow::Window::createSearchBar()
{
// Set up the search tool bar
SearchBar *searchBar = new SearchBar(this);
searchBar->setLineEditEnabled(false);
searchBar->setObjectName(QString::fromUtf8("searchBar"));
connect(searchBar, &SearchBar::textChanged, m_browser, &Browser::BrowserWidget::slotLimitToMatch);
connect(searchBar, &SearchBar::returnPressed, m_browser, &Browser::BrowserWidget::slotInvokeSeleted);
connect(searchBar, &SearchBar::keyPressed, m_browser, &Browser::BrowserWidget::scrollKeyPressed);
connect(m_browser, &Browser::BrowserWidget::viewChanged, searchBar, &SearchBar::reset);
connect(m_browser, &Browser::BrowserWidget::isSearchable, searchBar, &SearchBar::setLineEditEnabled);
m_filterWidget = m_thumbnailView->createFilterWidget(this);
addToolBar(m_filterWidget);
m_filterWidget->setObjectName(QString::fromUtf8("filterBar"));
connect(m_browser, &Browser::BrowserWidget::viewChanged, ThumbnailView::ThumbnailFacade::instance(), &ThumbnailView::ThumbnailFacade::clearFilter);
connect(m_browser, &Browser::BrowserWidget::isFilterable, m_filterWidget, &ThumbnailView::FilterWidget::setEnabled);
}
void MainWindow::Window::executeStartupActions()
{
Q_ASSERT(m_thumbnailCache);
new ImageManager::ThumbnailBuilder(m_statusBar, this, m_thumbnailCache);
if (!Settings::SettingsData::instance()->incrementalThumbnails())
ImageManager::ThumbnailBuilder::instance()->buildMissing();
connect(Settings::SettingsData::instance(), &Settings::SettingsData::thumbnailSizeChanged,
this, &Window::slotBuildThumbnailsIfWanted);
if (!FeatureDialog::hasVideoThumbnailer()) {
BackgroundTaskManager::JobManager::instance()->addJob(
new BackgroundJobs::SearchForVideosWithoutLengthInfo);
BackgroundTaskManager::JobManager::instance()->addJob(
new BackgroundJobs::SearchForVideosWithoutVideoThumbnailsJob);
}
}
void MainWindow::Window::checkIfVideoThumbnailerIsInstalled()
{
if (Options::the()->demoMode())
return;
if (!FeatureDialog::hasVideoThumbnailer()) {
KMessageBox::information(this,
i18n("Unable to find ffmpeg on the system.
"
"Without it, KPhotoAlbum will not be able to display video thumbnails and video lengths. "
"Please install the ffmpeg package
"),
i18n("Video thumbnails are not available"), QString::fromLatin1("VideoThumbnailerNotInstalled"));
}
}
bool MainWindow::Window::anyVideosSelected() const
{
const auto selectedFiles = selected();
for (const DB::FileName &fileName : selectedFiles) {
if (Utilities::isVideo(fileName))
return true;
}
return false;
}
void MainWindow::Window::setHistogramVisibilty(bool visible) const
{
if (visible) {
m_dateBar->show();
m_dateBarLine->show();
} else {
m_dateBar->hide();
m_dateBarLine->hide();
}
}
void MainWindow::Window::slotImageRotated(const DB::FileName &fileName)
{
// An image has been rotated by the annotation dialog or the viewer.
// We have to reload the respective thumbnail to get it in the right angle
- ImageManager::ThumbnailCache::instance()->removeThumbnail(fileName);
+ thumbnailCache()->removeThumbnail(fileName);
}
bool MainWindow::Window::dbIsDirty() const
{
return m_statusBar->mp_dirtyIndicator->isSaveDirty();
}
#ifdef HAVE_MARBLE
void MainWindow::Window::showPositionBrowser()
{
auto positionBrowser = positionBrowserWidget();
m_stack->setCurrentWidget(positionBrowser);
updateStates(false);
}
Map::MapView *MainWindow::Window::positionBrowserWidget()
{
if (!m_positionBrowser) {
m_positionBrowser = new Map::MapView(m_stack, Map::UsageType::InlineMapView);
m_stack->addWidget(m_positionBrowser);
}
return m_positionBrowser;
}
#endif
UserFeedback MainWindow::Window::askWarningContinueCancel(const QString &msg, const QString &title, const QString &dialogId)
{
auto answer = KMessageBox::warningContinueCancel(this, msg, title, KStandardGuiItem::cont(), KStandardGuiItem::cancel(), dialogId);
return (answer == KMessageBox::Continue) ? UserFeedback::Confirm : UserFeedback::Deny;
}
UserFeedback MainWindow::Window::askQuestionYesNo(const QString &msg, const QString &title, const QString &dialogId)
{
auto answer = KMessageBox::questionYesNo(this, msg, title, KStandardGuiItem::yes(), KStandardGuiItem::no(), dialogId);
return (answer == KMessageBox::Yes) ? UserFeedback::Confirm : UserFeedback::Deny;
}
void MainWindow::Window::showInformation(const QString &msg, const QString &title, const QString &dialogId)
{
KMessageBox::information(this, msg, title, dialogId);
}
void MainWindow::Window::showSorry(const QString &msg, const QString &title, const QString &)
{
KMessageBox::sorry(this, msg, title);
}
void MainWindow::Window::showError(const QString &msg, const QString &title, const QString &)
{
KMessageBox::error(this, msg, title);
}
bool MainWindow::Window::isDialogDisabled(const QString &dialogId)
{
// Note(jzarl): there are different methods for different kinds of dialogs.
// However, all these methods share exactly the same code in KMessageBox.
// If that ever changes, we can still update our implementation - until then I won't just copy a stupid API...
return !KMessageBox::shouldBeShownContinue(dialogId);
}
// vi:expandtab:tabstop=4 shiftwidth=4: