diff --git a/core/app/main/digikamapp_import.cpp b/core/app/main/digikamapp_import.cpp index 51902e76fb..90d0b38e90 100644 --- a/core/app/main/digikamapp_import.cpp +++ b/core/app/main/digikamapp_import.cpp @@ -1,236 +1,219 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2002-16-10 * Description : main digiKam interface implementation - Import tools * * Copyright (C) 2002-2018 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 "digikamapp.h" #include "digikamapp_p.h" namespace Digikam { QString DigikamApp::scannerTargetPlace() { QString place = QDir::homePath(); QStringList pics = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); if (!pics.isEmpty()) place = pics.first(); Album* const album = AlbumManager::instance()->currentAlbums().first(); if (album->type() == Album::PHYSICAL) { PAlbum* const p = dynamic_cast(album); if (p) { place = p->folderPath(); } } else { QStringList cols = CollectionManager::instance()->allAvailableAlbumRootPaths(); if (!cols.isEmpty()) place = cols.first(); } return place; } void DigikamApp::updateQuickImportAction() { d->quickImportMenu->clear(); foreach(QAction* const action, d->solidCameraActionGroup->actions()) { d->quickImportMenu->addAction(action); } foreach(QAction* const action, d->solidUsmActionGroup->actions()) { d->quickImportMenu->addAction(action); } foreach(QAction* const action, d->manualCameraActionGroup->actions()) { d->quickImportMenu->addAction(action); } if (d->quickImportMenu->actions().isEmpty()) { d->quickImportMenu->setEnabled(false); } else { disconnect(d->quickImportMenu->menuAction(), SIGNAL(triggered()), 0, 0); QAction* primaryAction = 0; QDateTime latest; foreach(QAction* const action, d->quickImportMenu->actions()) { QDateTime appearanceTime = d->cameraAppearanceTimes.value(action->data().toString()); if (latest.isNull() || appearanceTime > latest) { primaryAction = action; latest = appearanceTime; } } if (!primaryAction) { primaryAction = d->quickImportMenu->actions().first(); } connect(d->quickImportMenu->menuAction(), SIGNAL(triggered()), primaryAction, SLOT(trigger())); d->quickImportMenu->setEnabled(true); } } void DigikamApp::slotImportAddImages() { QString startingPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation); QUrl url = DFileDialog::getExistingDirectoryUrl(this, i18n("Select folder to parse"), QUrl::fromLocalFile(startingPath)); if (url.isEmpty() || !url.isLocalFile()) { return; } // The folder contents will be parsed by Camera interface in "Directory Browse" mode. downloadFrom(url.toLocalFile()); } void DigikamApp::slotImportAddFolders() { // NOTE: QFileDialog don't have an option to permit multiple selection of directories. // This work around is inspired from http://www.qtcentre.org/threads/34226-QFileDialog-select-multiple-directories // Check Later Qt 5.4 if a new native Qt way have been introduced. QPointer dlg = new DFileDialog(this); dlg->setWindowTitle(i18n("Select folders to import into album")); dlg->setFileMode(QFileDialog::Directory); dlg->setOptions(QFileDialog::ShowDirsOnly); QListView* const l = dlg->findChild(QLatin1String("listView")); if (l) { l->setSelectionMode(QAbstractItemView::MultiSelection); } QTreeView* const t = dlg->findChild(); if (t) { t->setSelectionMode(QAbstractItemView::MultiSelection); } if (dlg->exec() != QDialog::Accepted) { delete dlg; return; } QList urls = dlg->selectedUrls(); delete dlg; if (urls.isEmpty()) { return; } QList albumList = AlbumManager::instance()->currentAlbums(); Album* album = 0; if (!albumList.isEmpty()) { album = albumList.first(); } if (album && album->type() != Album::PHYSICAL) { album = 0; } QString header(i18n("

Please select the destination album from the digiKam library to " "import folders into.

")); album = AlbumSelectDialog::selectAlbum(this, (PAlbum*)album, header); if (!album) { return; } PAlbum* const pAlbum = dynamic_cast(album); if (!pAlbum) { return; } DIO::copy(urls, pAlbum); } void DigikamApp::slotImportFromScanner() { #ifdef HAVE_KSANE m_ksaneAction->activate(scannerTargetPlace(), configGroupName()); #endif } void DigikamApp::slotImportTool() { - QAction* const tool = dynamic_cast(sender()); + QAction* const action = dynamic_cast(sender()); + int tool = actionToWebService(action); - if (tool == m_importGphotoAction) + if (tool != WSStarter::Unknown) { - QPointer w = new GSWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this, QLatin1String("googlephotoimport")); - w->exec(); - delete w; + WSStarter::importFromWebService(tool, new DBInfoIface(this, QList(), + ApplicationSettings::ImportExport), this); } - else if (tool == m_importSmugmugAction) - { - QPointer w = new SmugWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this, true); - w->exec(); - delete w; - } - -#ifdef HAVE_KIO - else if (tool == m_importFileTransferAction) - { - QPointer w = new FTImportWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), this); - w->exec(); - delete w; - } -#endif } } // namespace Digikam diff --git a/core/app/main/digikamapp_p.h b/core/app/main/digikamapp_p.h index 8d36eafc25..615c06521e 100644 --- a/core/app/main/digikamapp_p.h +++ b/core/app/main/digikamapp_p.h @@ -1,447 +1,441 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2007-31-01 * Description : main digiKam interface implementation * * Copyright (C) 2007-2018 by Gilles Caulier * Copyright (C) 2014 by Mohamed_Anwer * * 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_APP_PRIVATE_H #define DIGIKAM_APP_PRIVATE_H // Qt includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE includes #include #include #include #include #include #include // Local includes #include "digikam_config.h" #include "digikam_debug.h" #include "albummanager.h" #include "applicationsettings.h" #include "cameralist.h" #include "cameratype.h" #include "cameranamehelper.h" #include "dsplashscreen.h" #include "dzoombar.h" #include "digikamview.h" #include "metadatastatusbar.h" #include "imagepropertiestab.h" #include "importui.h" #include "setup.h" #include "actioncategorizedview.h" #include "drawdecoder.h" #include "dlayoutbox.h" #include "album.h" #include "coredb.h" #include "albummodel.h" #include "albumselectdialog.h" #include "albumthumbnailloader.h" #include "dbinfoiface.h" #include "imagegps.h" #include "categorizeditemmodel.h" #include "collectionscanner.h" #include "collectionmanager.h" #include "componentsinfo.h" #include "coredbthumbinfoprovider.h" #include "dio.h" #include "dlogoaction.h" #include "fileactionmngr.h" #include "filterstatusbar.h" #include "iccsettings.h" #include "imageattributeswatch.h" #include "imageinfo.h" #include "imagewindow.h" #include "lighttablewindow.h" #include "queuemgrwindow.h" #include "loadingcache.h" #include "loadingcacheinterface.h" #include "loadsavethread.h" #include "metaengine_rotation.h" #include "scancontroller.h" #include "setupeditor.h" #include "setupicc.h" #include "thememanager.h" #include "thumbnailloadthread.h" #include "thumbnailsize.h" #include "dmetadata.h" #include "tagscache.h" #include "tagsactionmngr.h" #include "databaseserverstarter.h" #include "metadatasettings.h" #include "statusbarprogresswidget.h" #include "dbmigrationdlg.h" #include "progressmanager.h" #include "progressview.h" #include "maintenancedlg.h" #include "maintenancemngr.h" #include "newitemsfinder.h" #include "dbcleaner.h" #include "tagsmanager.h" #include "imagesortsettings.h" #include "metadatahubmngr.h" #include "metadataedit.h" #include "expoblendingmanager.h" #include "calwizard.h" #include "mailwizard.h" #include "advprintwizard.h" #include "dfiledialog.h" #include "dmediaservermngr.h" #include "dmediaserverdlg.h" #include "wsstarter.h" -#include "gswindow.h" -#include "smugwindow.h" - -#ifdef HAVE_KIO -# include "ftimportwindow.h" -#endif #ifdef HAVE_MARBLE # include "geolocationedit.h" #endif #ifdef HAVE_HTMLGALLERY # include "htmlwizard.h" #endif #ifdef HAVE_DBUS # include "digikamadaptor.h" #endif #ifdef HAVE_PANORAMA # include "panomanager.h" #endif #ifdef HAVE_MEDIAPLAYER # include "vidslidewizard.h" #endif #ifdef HAVE_KFILEMETADATA # include "baloowrap.h" #endif class KToolBarPopupAction; namespace Digikam { class SearchTextBar; class FilterStatusBar; class TagsActionMngr; class DAdjustableLabel; class Q_DECL_HIDDEN ProgressEntry { public: explicit ProgressEntry() : progress(0), canCancel(false) { } QString message; float progress; bool canCancel; }; // ------------------------------------------------------------------------------ class Q_DECL_HIDDEN DigikamApp::Private { public: explicit Private() : autoShowZoomToolTip(false), validIccPath(true), cameraMenu(0), usbMediaMenu(0), cardReaderMenu(0), quickImportMenu(0), config(0), newAction(0), moveSelectionToAlbumAction(0), deleteAction(0), renameAction(0), imageDeletePermanentlyAction(0), imageDeletePermanentlyDirectlyAction(0), imageTrashDirectlyAction(0), backwardActionMenu(0), forwardActionMenu(0), addImagesAction(0), propsEditAction(0), addFoldersAction(0), openInFileManagerAction(0), refreshAction(0), writeAlbumMetadataAction(0), readAlbumMetadataAction(0), browseTagsAction(0), openTagMngrAction(0), newTagAction(0), deleteTagAction(0), editTagAction(0), assignTagAction(0), imageViewSelectionAction(0), imagePreviewAction(0), #ifdef HAVE_MARBLE imageMapViewAction(0), #endif // HAVE_MARBLE imageTableViewAction(0), imageIconViewAction(0), imageLightTableAction(0), imageAddLightTableAction(0), imageAddCurrentQueueAction(0), imageAddNewQueueAction(0), imageViewAction(0), imageWriteMetadataAction(0), imageReadMetadataAction(0), imageScanForFacesAction(0), imageFindSimilarAction(0), imageSetExifOrientation1Action(0), imageSetExifOrientation2Action(0), imageSetExifOrientation3Action(0), imageSetExifOrientation4Action(0), imageSetExifOrientation5Action(0), imageSetExifOrientation6Action(0), imageSetExifOrientation7Action(0), imageSetExifOrientation8Action(0), imageRenameAction(0), imageRotateActionMenu(0), imageFlipActionMenu(0), imageAutoExifActionMenu(0), imageDeleteAction(0), imageExifOrientationActionMenu(0), openWithAction(0), ieAction(0), ltAction(0), cutItemsAction(0), copyItemsAction(0), pasteItemsAction(0), selectAllAction(0), selectNoneAction(0), selectInvertAction(0), zoomPlusAction(0), zoomMinusAction(0), zoomFitToWindowAction(0), zoomTo100percents(0), imageSortAction(0), imageSortOrderAction(0), imageSeparationAction(0), imageSeparationSortOrderAction(0), albumSortAction(0), recurseAlbumsAction(0), recurseTagsAction(0), showBarAction(0), viewCMViewAction(0), slideShowAction(0), slideShowAllAction(0), slideShowSelectionAction(0), slideShowRecursiveAction(0), bqmAction(0), maintenanceAction(0), qualityAction(0), advSearchAction(0), addCameraSeparatorAction(0), quitAction(0), tipAction(0), backwardSignalMapper(0), forwardSignalMapper(0), manualCameraActionGroup(0), solidCameraActionGroup(0), solidUsmActionGroup(0), exifOrientationActionGroup(0), eventLoop(0), metadataStatusBar(0), filterStatusBar(0), splashScreen(0), view(0), cameraList(0), tagsActionManager(0), zoomBar(0), statusLabel(0), modelCollection(0) { } bool autoShowZoomToolTip; bool validIccPath; QMenu* cameraMenu; QMenu* usbMediaMenu; QMenu* cardReaderMenu; QMenu* quickImportMenu; QHash cameraAppearanceTimes; KSharedConfig::Ptr config; // Album Actions QAction* newAction; QAction* moveSelectionToAlbumAction; QAction* deleteAction; QAction* renameAction; QAction* imageDeletePermanentlyAction; QAction* imageDeletePermanentlyDirectlyAction; QAction* imageTrashDirectlyAction; KToolBarPopupAction* backwardActionMenu; KToolBarPopupAction* forwardActionMenu; QAction* addImagesAction; QAction* propsEditAction; QAction* addFoldersAction; QAction* openInFileManagerAction; QAction* refreshAction; QAction* writeAlbumMetadataAction; QAction* readAlbumMetadataAction; // Tag Actions QAction* browseTagsAction; QAction* openTagMngrAction; QAction* newTagAction; QAction* deleteTagAction; QAction* editTagAction; QAction* assignTagAction; // Image Actions KSelectAction* imageViewSelectionAction; QAction* imagePreviewAction; #ifdef HAVE_MARBLE QAction* imageMapViewAction; #endif // HAVE_MARBLE QAction* imageTableViewAction; QAction* imageIconViewAction; QAction* imageLightTableAction; QAction* imageAddLightTableAction; QAction* imageAddCurrentQueueAction; QAction* imageAddNewQueueAction; QAction* imageViewAction; QAction* imageWriteMetadataAction; QAction* imageReadMetadataAction; QAction* imageScanForFacesAction; QAction* imageFindSimilarAction; QAction* imageSetExifOrientation1Action; QAction* imageSetExifOrientation2Action; QAction* imageSetExifOrientation3Action; QAction* imageSetExifOrientation4Action; QAction* imageSetExifOrientation5Action; QAction* imageSetExifOrientation6Action; QAction* imageSetExifOrientation7Action; QAction* imageSetExifOrientation8Action; QAction* imageRenameAction; QMenu* imageRotateActionMenu; QMenu* imageFlipActionMenu; QAction* imageAutoExifActionMenu; QAction* imageDeleteAction; QMenu* imageExifOrientationActionMenu; QAction* openWithAction; QAction* ieAction; QAction* ltAction; // Edit Actions QAction* cutItemsAction; QAction* copyItemsAction; QAction* pasteItemsAction; QAction* selectAllAction; QAction* selectNoneAction; QAction* selectInvertAction; // View Actions QAction* zoomPlusAction; QAction* zoomMinusAction; QAction* zoomFitToWindowAction; QAction* zoomTo100percents; KSelectAction* imageSortAction; KSelectAction* imageSortOrderAction; KSelectAction* imageSeparationAction; KSelectAction* imageSeparationSortOrderAction; KSelectAction* albumSortAction; QAction* recurseAlbumsAction; QAction* recurseTagsAction; QAction* showBarAction; QAction* viewCMViewAction; // Tools Actions QMenu* slideShowAction; QAction* slideShowAllAction; QAction* slideShowSelectionAction; QAction* slideShowRecursiveAction; QAction* bqmAction; QAction* maintenanceAction; QAction* qualityAction; QAction* advSearchAction; // Application Actions QAction* addCameraSeparatorAction; QAction* quitAction; QAction* tipAction; QSignalMapper* backwardSignalMapper; QSignalMapper* forwardSignalMapper; QActionGroup* manualCameraActionGroup; QActionGroup* solidCameraActionGroup; QActionGroup* solidUsmActionGroup; QActionGroup* exifOrientationActionGroup; QMap > cameraUIMap; QEventLoop* eventLoop; QString solidErrorMessage; MetadataStatusBar* metadataStatusBar; FilterStatusBar* filterStatusBar; DSplashScreen* splashScreen; DigikamView* view; CameraList* cameraList; TagsActionMngr* tagsActionManager; DZoomBar* zoomBar; DAdjustableLabel* statusLabel; DigikamModelCollection* modelCollection; }; } // namespace Digikam #endif // DIGIKAM_APP_PRIVATE_H diff --git a/core/libs/widgets/mainview/dxmlguiwindow.cpp b/core/libs/widgets/mainview/dxmlguiwindow.cpp index 9262bcb4ec..e6f35449fc 100644 --- a/core/libs/widgets/mainview/dxmlguiwindow.cpp +++ b/core/libs/widgets/mainview/dxmlguiwindow.cpp @@ -1,1338 +1,1350 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2013-04-29 * Description : digiKam XML GUI window * * Copyright (C) 2013-2018 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 "dxmlguiwindow.h" // Qt includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE includes #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_KNOTIFYCONFIG # include #endif // Local includes #include "digikam_debug.h" #include "digikam_globals.h" #include "daboutdata.h" #include "webbrowserdlg.h" #include "wsstarter.h" namespace Digikam { class Q_DECL_HIDDEN DXmlGuiWindow::Private { public: explicit Private() { fsOptions = FS_NONE; fullScreenAction = 0; fullScreenBtn = 0; dirtyMainToolBar = false; fullScreenHideToolBars = false; fullScreenHideThumbBar = true; fullScreenHideSideBars = false; thumbbarVisibility = true; menubarVisibility = true; statusbarVisibility = true; libsInfoAction = 0; showMenuBarAction = 0; showStatusBarAction = 0; about = 0; dbStatAction = 0; anim = 0; } public: /** * Settings taken from managed window configuration to handle toolbar visibility in full-screen mode */ bool fullScreenHideToolBars; /** * Settings taken from managed window configuration to handle thumbbar visibility in full-screen mode */ bool fullScreenHideThumbBar; /** * Settings taken from managed window configuration to handle toolbar visibility in full-screen mode */ bool fullScreenHideSideBars; /** * Full-Screen options. See FullScreenOptions enum and setFullScreenOptions() for details. */ int fsOptions; /** * Action plug in managed window to switch fullscreen state */ KToggleFullScreenAction* fullScreenAction; /** * Show only if toolbar is hidden */ QToolButton* fullScreenBtn; /** * Used by slotToggleFullScreen() to manage state of full-screen button on managed window */ bool dirtyMainToolBar; /** * Store previous visibility of toolbars before ful-screen mode. */ QMap toolbarsVisibility; /** * Store previous visibility of thumbbar before ful-screen mode. */ bool thumbbarVisibility; /** * Store previous visibility of menubar before ful-screen mode. */ bool menubarVisibility; /** * Store previous visibility of statusbar before ful-screen mode. */ bool statusbarVisibility; // Common Help actions QAction* dbStatAction; QAction* libsInfoAction; QAction* showMenuBarAction; QAction* showStatusBarAction; DAboutData* about; DLogoAction* anim; QString configGroupName; }; // -------------------------------------------------------------------------------------------------- DXmlGuiWindow::DXmlGuiWindow(QWidget* const parent, Qt::WindowFlags f) : KXmlGuiWindow(parent, f), d(new Private) { m_expoBlendingAction = 0; m_panoramaAction = 0; m_videoslideshowAction = 0; m_htmlGalleryAction = 0; m_sendByMailAction = 0; m_printCreatorAction = 0; m_calendarAction = 0; m_presentationAction = 0; m_metadataEditAction = 0; m_geolocationEditAction = 0; m_mediaServerAction = 0; m_animLogo = 0; // Export tools m_exportDropboxAction = 0; m_exportOnedriveAction = 0; m_exportPinterestAction = 0; m_exportBoxAction = 0; m_exportFacebookAction = 0; m_exportFlickrAction = 0; m_exportGdriveAction = 0; m_exportGphotoAction = 0; m_exportImageshackAction = 0; m_exportImgurAction = 0; m_exportPiwigoAction = 0; m_exportRajceAction = 0; m_exportSmugmugAction = 0; m_exportYandexfotkiAction = 0; m_exportMediawikiAction = 0; #ifdef HAVE_VKONTAKTE m_exportVkontakteAction = 0; #endif #ifdef HAVE_KIO m_exportFileTransferAction = 0; #endif // Import tools m_importGphotoAction = 0; m_importSmugmugAction = 0; #ifdef HAVE_KIO m_importFileTransferAction = 0; #endif #ifdef HAVE_KSANE m_ksaneAction = 0; #endif installEventFilter(this); } DXmlGuiWindow::~DXmlGuiWindow() { delete d; } void DXmlGuiWindow::setConfigGroupName(const QString& name) { d->configGroupName = name; } QString DXmlGuiWindow::configGroupName() const { return d->configGroupName; } void DXmlGuiWindow::closeEvent(QCloseEvent* e) { if (fullScreenIsActive()) slotToggleFullScreen(false); if (!testAttribute(Qt::WA_DeleteOnClose)) { setVisible(false); e->ignore(); return; } KXmlGuiWindow::closeEvent(e); e->accept(); } void DXmlGuiWindow::setFullScreenOptions(int options) { d->fsOptions = options; } void DXmlGuiWindow::createHelpActions(bool coreOptions) { d->libsInfoAction = new QAction(QIcon::fromTheme(QLatin1String("help-about")), i18n("Components Information"), this); connect(d->libsInfoAction, SIGNAL(triggered()), this, SLOT(slotComponentsInfo())); actionCollection()->addAction(QLatin1String("help_librariesinfo"), d->libsInfoAction); d->about = new DAboutData(this); QAction* const rawCameraListAction = new QAction(QIcon::fromTheme(QLatin1String("image-x-adobe-dng")), i18n("Supported RAW Cameras"), this); connect(rawCameraListAction, SIGNAL(triggered()), this, SLOT(slotRawCameraList())); actionCollection()->addAction(QLatin1String("help_rawcameralist"), rawCameraListAction); QAction* const donateMoneyAction = new QAction(QIcon::fromTheme(QLatin1String("globe")), i18n("Donate..."), this); connect(donateMoneyAction, SIGNAL(triggered()), this, SLOT(slotDonateMoney())); actionCollection()->addAction(QLatin1String("help_donatemoney"), donateMoneyAction); QAction* const recipesBookAction = new QAction(QIcon::fromTheme(QLatin1String("globe")), i18n("Recipes Book..."), this); connect(recipesBookAction, SIGNAL(triggered()), this, SLOT(slotRecipesBook())); actionCollection()->addAction(QLatin1String("help_recipesbook"), recipesBookAction); QAction* const contributeAction = new QAction(QIcon::fromTheme(QLatin1String("globe")), i18n("Contribute..."), this); connect(contributeAction, SIGNAL(triggered()), this, SLOT(slotContribute())); actionCollection()->addAction(QLatin1String("help_contribute"), contributeAction); QAction* const helpAction = new QAction(QIcon::fromTheme(QLatin1String("help-contents")), i18n("Online Handbook..."), this); connect(helpAction, SIGNAL(triggered()), this, SLOT(slotHelpContents())); actionCollection()->addAction(QLatin1String("help_handbook"), helpAction); m_animLogo = new DLogoAction(this); actionCollection()->addAction(QLatin1String("logo_action"), m_animLogo); // Add options only for core components (typically all excepted Showfoto) if (coreOptions) { d->dbStatAction = new QAction(QIcon::fromTheme(QLatin1String("network-server-database")), i18n("Database Statistics"), this); connect(d->dbStatAction, SIGNAL(triggered()), this, SLOT(slotDBStat())); actionCollection()->addAction(QLatin1String("help_dbstat"), d->dbStatAction); } } void DXmlGuiWindow::cleanupActions() { QAction* ac = actionCollection()->action(QLatin1String("help_about_kde")); if (ac) actionCollection()->removeAction(ac); ac = actionCollection()->action(QLatin1String("help_donate")); if (ac) actionCollection()->removeAction(ac); ac = actionCollection()->action(QLatin1String("help_contents")); if (ac) actionCollection()->removeAction(ac); /* QList lst = actionCollection()->actions(); foreach(QAction* const act, lst) qCDebug(DIGIKAM_WIDGETS_LOG) << "action: " << act->objectName(); */ } void DXmlGuiWindow::createSidebarActions() { KActionCollection* const ac = actionCollection(); QAction* const tlsb = new QAction(i18n("Toggle Left Side-bar"), this); connect(tlsb, SIGNAL(triggered()), this, SLOT(slotToggleLeftSideBar())); ac->addAction(QLatin1String("toggle-left-sidebar"), tlsb); ac->setDefaultShortcut(tlsb, Qt::CTRL + Qt::META + Qt::Key_Left); QAction* const trsb = new QAction(i18n("Toggle Right Side-bar"), this); connect(trsb, SIGNAL(triggered()), this, SLOT(slotToggleRightSideBar())); ac->addAction(QLatin1String("toggle-right-sidebar"), trsb); ac->setDefaultShortcut(trsb, Qt::CTRL + Qt::META + Qt::Key_Right); QAction* const plsb = new QAction(i18n("Previous Left Side-bar Tab"), this); connect(plsb, SIGNAL(triggered()), this, SLOT(slotPreviousLeftSideBarTab())); ac->addAction(QLatin1String("previous-left-sidebar-tab"), plsb); ac->setDefaultShortcut(plsb, Qt::CTRL + Qt::META + Qt::Key_Home); QAction* const nlsb = new QAction(i18n("Next Left Side-bar Tab"), this); connect(nlsb, SIGNAL(triggered()), this, SLOT(slotNextLeftSideBarTab())); ac->addAction(QLatin1String("next-left-sidebar-tab"), nlsb); ac->setDefaultShortcut(nlsb, Qt::CTRL + Qt::META + Qt::Key_End); QAction* const prsb = new QAction(i18n("Previous Right Side-bar Tab"), this); connect(prsb, SIGNAL(triggered()), this, SLOT(slotPreviousRightSideBarTab())); ac->addAction(QLatin1String("previous-right-sidebar-tab"), prsb); ac->setDefaultShortcut(prsb, Qt::CTRL + Qt::META + Qt::Key_PageUp); QAction* const nrsb = new QAction(i18n("Next Right Side-bar Tab"), this); connect(nrsb, SIGNAL(triggered()), this, SLOT(slotNextRightSideBarTab())); ac->addAction(QLatin1String("next-right-sidebar-tab"), nrsb); ac->setDefaultShortcut(nrsb, Qt::CTRL + Qt::META + Qt::Key_PageDown); } void DXmlGuiWindow::createSettingsActions() { d->showMenuBarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenuBar()), actionCollection()); #ifdef Q_OS_OSX // Under MacOS the menu bar visibility is managed by desktop. d->showMenuBarAction->setVisible(false); #endif d->showStatusBarAction = actionCollection()->action(QLatin1String("options_show_statusbar")); if (!d->showStatusBarAction) { qCWarning(DIGIKAM_WIDGETS_LOG) << "Status bar menu action cannot be found in action collection"; d->showStatusBarAction = new QAction(i18n("Show Statusbar"), this); d->showStatusBarAction->setCheckable(true); d->showStatusBarAction->setChecked(true); connect(d->showStatusBarAction, SIGNAL(toggled(bool)), this, SLOT(slotShowStatusBar())); actionCollection()->addAction(QLatin1String("options_show_statusbar"), d->showStatusBarAction); } KStandardAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection()); KStandardAction::preferences(this, SLOT(slotSetup()), actionCollection()); KStandardAction::configureToolbars(this, SLOT(slotConfToolbars()), actionCollection()); #ifdef HAVE_KNOTIFYCONFIG KStandardAction::configureNotifications(this, SLOT(slotConfNotifications()), actionCollection()); #endif } QAction* DXmlGuiWindow::showMenuBarAction() const { return d->showMenuBarAction; } QAction* DXmlGuiWindow::showStatusBarAction() const { return d->showStatusBarAction; } void DXmlGuiWindow::slotShowMenuBar() { menuBar()->setVisible(d->showMenuBarAction->isChecked()); } void DXmlGuiWindow::slotShowStatusBar() { statusBar()->setVisible(d->showStatusBarAction->isChecked()); } void DXmlGuiWindow::slotConfNotifications() { #ifdef HAVE_KNOTIFYCONFIG KNotifyConfigWidget::configure(this); #endif } void DXmlGuiWindow::editKeyboardShortcuts(KActionCollection* const extraac, const QString& actitle) { KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this); dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General")); if (extraac) dialog.addCollection(extraac, actitle); dialog.configure(); } void DXmlGuiWindow::slotConfToolbars() { KConfigGroup group = KSharedConfig::openConfig()->group(configGroupName()); saveMainWindowSettings(group); KEditToolBar dlg(factory(), this); connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(slotNewToolbarConfig())); dlg.exec(); } void DXmlGuiWindow::slotNewToolbarConfig() { KConfigGroup group = KSharedConfig::openConfig()->group(configGroupName()); applyMainWindowSettings(group); } void DXmlGuiWindow::createGeolocationEditAction() { #ifdef HAVE_MARBLE m_geolocationEditAction = new QAction(QIcon::fromTheme(QLatin1String("globe")), i18n("Edit Geolocation..."), this); actionCollection()->addAction(QLatin1String("geolocation_edit"), m_geolocationEditAction); actionCollection()->setDefaultShortcut(m_geolocationEditAction, Qt::CTRL + Qt::SHIFT + Qt::Key_G); connect(m_geolocationEditAction, SIGNAL(triggered(bool)), this, SLOT(slotEditGeolocation())); #endif } void DXmlGuiWindow::createMetadataEditAction() { m_metadataEditAction = new QAction(QIcon::fromTheme(QLatin1String("format-text-code")), i18n("Edit Metadata..."), this); actionCollection()->addAction(QLatin1String("metadata_edit"), m_metadataEditAction); actionCollection()->setDefaultShortcut(m_metadataEditAction, Qt::CTRL + Qt::SHIFT + Qt::Key_M); connect(m_metadataEditAction, SIGNAL(triggered(bool)), this, SLOT(slotEditMetadata())); } void DXmlGuiWindow::createPresentationAction() { m_presentationAction = new QAction(QIcon::fromTheme(QLatin1String("view-presentation")), i18n("Presentation..."), this); actionCollection()->addAction(QLatin1String("presentation"), m_presentationAction); actionCollection()->setDefaultShortcut(m_presentationAction, Qt::ALT+Qt::SHIFT+Qt::Key_F9); connect(m_presentationAction, SIGNAL(triggered()), this, SLOT(slotPresentation())); } void DXmlGuiWindow::createExpoBlendingAction() { m_expoBlendingAction = new QAction(QIcon::fromTheme(QLatin1String("expoblending")), i18nc("@action", "Create Stacked Images..."), this); actionCollection()->addAction(QLatin1String("expoblending"), m_expoBlendingAction); connect(m_expoBlendingAction, SIGNAL(triggered(bool)), this, SLOT(slotExpoBlending())); } void DXmlGuiWindow::createPanoramaAction() { #ifdef HAVE_PANORAMA m_panoramaAction = new QAction(QIcon::fromTheme(QLatin1String("panorama")), i18nc("@action", "Create panorama..."), this); actionCollection()->addAction(QLatin1String("panorama"), m_panoramaAction); connect(m_panoramaAction, SIGNAL(triggered(bool)), this, SLOT(slotPanorama())); #endif } void DXmlGuiWindow::createVideoSlideshowAction() { #ifdef HAVE_MEDIAPLAYER m_videoslideshowAction = new QAction(QIcon::fromTheme(QLatin1String("media-record")), i18nc("@action", "Create video slideshow..."), this); actionCollection()->addAction(QLatin1String("videoslideshow"), m_videoslideshowAction); connect(m_videoslideshowAction, SIGNAL(triggered(bool)), this, SLOT(slotVideoSlideshow())); #endif } void DXmlGuiWindow::createCalendarAction() { m_calendarAction = new QAction(QIcon::fromTheme(QLatin1String("view-calendar")), i18nc("@action", "Create Calendar..."), this); actionCollection()->addAction(QLatin1String("calendar"), m_calendarAction); connect(m_calendarAction, SIGNAL(triggered(bool)), this, SLOT(slotCalendar())); } void DXmlGuiWindow::createSendByMailAction() { m_sendByMailAction = new QAction(QIcon::fromTheme(QLatin1String("mail-send")), i18nc("@action", "Send by Mail..."), this); actionCollection()->addAction(QLatin1String("sendbymail"), m_sendByMailAction); connect(m_sendByMailAction, SIGNAL(triggered(bool)), this, SLOT(slotSendByMail())); } void DXmlGuiWindow::createPrintCreatorAction() { m_printCreatorAction = new QAction(QIcon::fromTheme(QLatin1String("document-print")), i18nc("@action", "Print Creator..."), this); actionCollection()->addAction(QLatin1String("printcreator"), m_printCreatorAction); connect(m_printCreatorAction, SIGNAL(triggered(bool)), this, SLOT(slotPrintCreator())); } void DXmlGuiWindow::createHtmlGalleryAction() { #ifdef HAVE_HTMLGALLERY m_htmlGalleryAction = new QAction(QIcon::fromTheme(QLatin1String("text-html")), i18nc("@action", "Create Html gallery..."), this); actionCollection()->setDefaultShortcut(m_htmlGalleryAction, Qt::ALT+Qt::SHIFT+Qt::Key_H); actionCollection()->addAction(QLatin1String("htmlgallery"), m_htmlGalleryAction); connect(m_htmlGalleryAction, SIGNAL(triggered(bool)), this, SLOT(slotHtmlGallery())); #endif } void DXmlGuiWindow::createMediaServerAction() { m_mediaServerAction = new QAction(QIcon::fromTheme(QLatin1String("arrow-right-double")), i18n("Share with DLNA"), this); actionCollection()->addAction(QLatin1String("mediaserver"), m_mediaServerAction); connect(m_mediaServerAction, SIGNAL(triggered(bool)), this, SLOT(slotMediaServer())); } void DXmlGuiWindow::createFullScreenAction(const QString& name) { d->fullScreenAction = KStandardAction::fullScreen(0, 0, this, this); actionCollection()->addAction(name, d->fullScreenAction); d->fullScreenBtn = new QToolButton(this); d->fullScreenBtn->setDefaultAction(d->fullScreenAction); d->fullScreenBtn->hide(); connect(d->fullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleFullScreen(bool))); } void DXmlGuiWindow::readFullScreenSettings(const KConfigGroup& group) { if (d->fsOptions & FS_TOOLBARS) d->fullScreenHideToolBars = group.readEntry(s_configFullScreenHideToolBarsEntry, false); if (d->fsOptions & FS_THUMBBAR) d->fullScreenHideThumbBar = group.readEntry(s_configFullScreenHideThumbBarEntry, true); if (d->fsOptions & FS_SIDEBARS) d->fullScreenHideSideBars = group.readEntry(s_configFullScreenHideSideBarsEntry, false); } void DXmlGuiWindow::slotToggleFullScreen(bool set) { KToggleFullScreenAction::setFullScreen(this, set); customizedFullScreenMode(set); if (!set) { qCDebug(DIGIKAM_WIDGETS_LOG) << "TURN OFF fullscreen"; // restore menubar if (d->menubarVisibility) menuBar()->setVisible(true); // restore statusbar if (d->statusbarVisibility) statusBar()->setVisible(true); // restore sidebars if ((d->fsOptions & FS_SIDEBARS) && d->fullScreenHideSideBars) showSideBars(true); // restore thummbbar if ((d->fsOptions & FS_THUMBBAR) && d->fullScreenHideThumbBar) showThumbBar(d->thumbbarVisibility); // restore toolbars and manage full-screen button showToolBars(true); d->fullScreenBtn->hide(); if (d->dirtyMainToolBar) { KToolBar* const mainbar = mainToolBar(); if (mainbar) { mainbar->removeAction(d->fullScreenAction); } } } else { qCDebug(DIGIKAM_WIDGETS_LOG) << "TURN ON fullscreen"; // hide menubar #ifdef Q_OS_WIN d->menubarVisibility = d->showMenuBarAction->isChecked(); #else d->menubarVisibility = menuBar()->isVisible(); #endif menuBar()->setVisible(false); // hide statusbar #ifdef Q_OS_WIN d->statusbarVisibility = d->showStatusBarAction->isChecked(); #else d->statusbarVisibility = statusBar()->isVisible(); #endif statusBar()->setVisible(false); // hide sidebars if ((d->fsOptions & FS_SIDEBARS) && d->fullScreenHideSideBars) showSideBars(false); // hide thummbbar d->thumbbarVisibility = thumbbarVisibility(); if ((d->fsOptions & FS_THUMBBAR) && d->fullScreenHideThumbBar) showThumbBar(false); // hide toolbars and manage full-screen button if ((d->fsOptions & FS_TOOLBARS) && d->fullScreenHideToolBars) { showToolBars(false); } else { showToolBars(true); // add fullscreen action if necessary in toolbar KToolBar* const mainbar = mainToolBar(); if (mainbar && !mainbar->actions().contains(d->fullScreenAction)) { if (mainbar->actions().isEmpty()) { mainbar->addAction(d->fullScreenAction); } else { mainbar->insertAction(mainbar->actions().first(), d->fullScreenAction); } d->dirtyMainToolBar = true; } else { // If FullScreen button is enabled in toolbar settings, // we shall not remove it when leaving of fullscreen mode. d->dirtyMainToolBar = false; } } } } bool DXmlGuiWindow::fullScreenIsActive() const { if (d->fullScreenAction) return d->fullScreenAction->isChecked(); qCDebug(DIGIKAM_WIDGETS_LOG) << "FullScreenAction is not initialized"; return false; } bool DXmlGuiWindow::eventFilter(QObject* obj, QEvent* ev) { if (obj == this) { if (ev && (ev->type() == QEvent::HoverMove) && fullScreenIsActive()) { // We will handle a stand alone FullScreen button action on top/right corner of screen // only if managed window tool bar is hidden, and if we switched already in Full Screen mode. KToolBar* const mainbar = mainToolBar(); if (mainbar) { if (((d->fsOptions & FS_TOOLBARS) && d->fullScreenHideToolBars) || !mainbar->isVisible()) { QHoverEvent* const mev = dynamic_cast(ev); if (mev) { QPoint pos(mev->pos()); QRect desktopRect = QApplication::desktop()->screenGeometry(this); QRect sizeRect(QPoint(0, 0), d->fullScreenBtn->size()); QRect topLeft, topRight; QRect topRightLarger; desktopRect = QRect(desktopRect.y(), desktopRect.y(), desktopRect.width(), desktopRect.height()); topLeft = sizeRect; topRight = sizeRect; topLeft.moveTo(desktopRect.x(), desktopRect.y()); topRight.moveTo(desktopRect.x() + desktopRect.width() - sizeRect.width() - 1, topLeft.y()); topRightLarger = topRight.adjusted(-25, 0, 0, 10); if (topRightLarger.contains(pos)) { d->fullScreenBtn->move(topRight.topLeft()); d->fullScreenBtn->show(); } else { d->fullScreenBtn->hide(); } return false; } } } } } // pass the event on to the parent class return QObject::eventFilter(obj, ev); } void DXmlGuiWindow::keyPressEvent(QKeyEvent* e) { if (e->key() == Qt::Key_Escape) { if (fullScreenIsActive()) { d->fullScreenAction->activate(QAction::Trigger); } } } KToolBar* DXmlGuiWindow::mainToolBar() const { QList toolbars = toolBars(); KToolBar* mainToolbar = 0; foreach(KToolBar* const toolbar, toolbars) { if (toolbar && (toolbar->objectName() == QLatin1String("mainToolBar"))) { mainToolbar = toolbar; break; } } return mainToolbar; } void DXmlGuiWindow::showToolBars(bool visible) { // We will hide toolbars: store previous state for future restoring. if (!visible) { d->toolbarsVisibility.clear(); foreach(KToolBar* const toolbar, toolBars()) { if (toolbar) { bool visibility = toolbar->isVisible(); d->toolbarsVisibility.insert(toolbar, visibility); } } } // Switch toolbars visibility for (QMap::const_iterator it = d->toolbarsVisibility.constBegin(); it != d->toolbarsVisibility.constEnd(); ++it) { KToolBar* const toolbar = it.key(); bool visibility = it.value(); if (toolbar) { if (visible && visibility) toolbar->show(); else toolbar->hide(); } } // We will show toolbars: restore previous state. if (visible) { for (QMap::const_iterator it = d->toolbarsVisibility.constBegin(); it != d->toolbarsVisibility.constEnd(); ++it) { KToolBar* const toolbar = it.key(); bool visibility = it.value(); if (toolbar) { visibility ? toolbar->show() : toolbar->hide(); } } } } void DXmlGuiWindow::showSideBars(bool visible) { Q_UNUSED(visible); } void DXmlGuiWindow::showThumbBar(bool visible) { Q_UNUSED(visible); } void DXmlGuiWindow::customizedFullScreenMode(bool set) { Q_UNUSED(set); } bool DXmlGuiWindow::thumbbarVisibility() const { return true; } void DXmlGuiWindow::slotHelpContents() { openHandbook(); } void DXmlGuiWindow::openHandbook() { QUrl url = QUrl(QString::fromUtf8("https://docs.kde.org/trunk5/en/extragear-graphics/%1/index.html") .arg(QApplication::applicationName())); WebBrowserDlg* const browser = new WebBrowserDlg(url, qApp->activeWindow()); browser->show(); } void DXmlGuiWindow::restoreWindowSize(QWindow* const win, const KConfigGroup& group) { KWindowConfig::restoreWindowSize(win, group); } void DXmlGuiWindow::saveWindowSize(QWindow* const win, KConfigGroup& group) { KWindowConfig::saveWindowSize(win, group); } QAction* DXmlGuiWindow::buildStdAction(StdActionType type, const QObject* const recvr, const char* const slot, QObject* const parent) { switch(type) { case StdCopyAction: return KStandardAction::copy(recvr, slot, parent); break; case StdPasteAction: return KStandardAction::paste(recvr, slot, parent); break; case StdCutAction: return KStandardAction::cut(recvr, slot, parent); break; case StdQuitAction: return KStandardAction::quit(recvr, slot, parent); break; case StdCloseAction: return KStandardAction::close(recvr, slot, parent); break; case StdZoomInAction: return KStandardAction::zoomIn(recvr, slot, parent); break; case StdZoomOutAction: return KStandardAction::zoomOut(recvr, slot, parent); break; case StdOpenAction: return KStandardAction::open(recvr, slot, parent); break; case StdSaveAction: return KStandardAction::save(recvr, slot, parent); break; case StdSaveAsAction: return KStandardAction::saveAs(recvr, slot, parent); break; case StdRevertAction: return KStandardAction::revert(recvr, slot, parent); break; case StdBackAction: return KStandardAction::back(recvr, slot, parent); break; case StdForwardAction: return KStandardAction::forward(recvr, slot, parent); break; default: return 0; break; } } void DXmlGuiWindow::slotRawCameraList() { showRawCameraList(); } void DXmlGuiWindow::slotDonateMoney() { WebBrowserDlg* const browser = new WebBrowserDlg(QUrl(QLatin1String("https://www.digikam.org/donate/")), qApp->activeWindow()); browser->show(); } void DXmlGuiWindow::slotRecipesBook() { WebBrowserDlg* const browser = new WebBrowserDlg(QUrl(QLatin1String("https://www.digikam.org/recipes_book/")), qApp->activeWindow()); browser->show(); } void DXmlGuiWindow::slotContribute() { WebBrowserDlg* const browser = new WebBrowserDlg(QUrl(QLatin1String("https://www.digikam.org/contribute/")), qApp->activeWindow()); browser->show(); } void DXmlGuiWindow::setupIconTheme() { // Let QStandardPaths handle this, it will look for app local stuff // this means e.g. for mac: "/../Resources" and for win: "/data". bool hasBreeze = false; const QString breezeIcons = QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("breeze.rcc")); if (!breezeIcons.isEmpty() && QFile::exists(breezeIcons)) { QResource::registerResource(breezeIcons); hasBreeze = true; } bool hasBreezeDark = false; const QString breezeDarkIcons = QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("breeze-dark.rcc")); if (!breezeDarkIcons.isEmpty() && QFile::exists(breezeDarkIcons)) { QResource::registerResource(breezeDarkIcons); hasBreezeDark = true; } if (hasBreeze || hasBreezeDark) { // Tell Qt about the theme QIcon::setThemeSearchPaths(QStringList() << QLatin1String(":/icons")); // Tell icons loader an co. about the theme KConfigGroup cg(KSharedConfig::openConfig(), "Icons"); if (hasBreeze) { QIcon::setThemeName(QLatin1String("breeze")); cg.writeEntry("Theme", "breeze"); qCDebug(DIGIKAM_WIDGETS_LOG) << "Breeze icons resource file found"; } else if (hasBreezeDark) { QIcon::setThemeName(QLatin1String("breeze-dark")); cg.writeEntry("Theme", "breeze-dark"); qCDebug(DIGIKAM_WIDGETS_LOG) << "Breeze-dark icons resource file found"; } else { qCDebug(DIGIKAM_WIDGETS_LOG) << "No icons resource file found"; } cg.sync(); } } void DXmlGuiWindow::createExportActions() { m_exportDropboxAction = new QAction(i18n("Export to &Dropbox..."), this); m_exportDropboxAction->setIcon(QIcon::fromTheme(QLatin1String("dropbox"))); actionCollection()->addAction(QLatin1String("export_dropbox"), m_exportDropboxAction); actionCollection()->setDefaultShortcut(m_exportDropboxAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_D); connect(m_exportDropboxAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportOnedriveAction = new QAction(i18n("Export to &Onedrive..."), this); m_exportOnedriveAction->setIcon(QIcon::fromTheme(QString::fromLatin1("onedrive"))); actionCollection()->addAction(QLatin1String("export_onedrive"), m_exportOnedriveAction); actionCollection()->setDefaultShortcut(m_exportOnedriveAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_O); connect(m_exportOnedriveAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportPinterestAction = new QAction(i18n("Export to &Pinterest..."), this); m_exportPinterestAction->setIcon(QIcon::fromTheme(QString::fromLatin1("pinterest"))); actionCollection()->addAction(QLatin1String("export_pinterest"), m_exportPinterestAction); actionCollection()->setDefaultShortcut(m_exportPinterestAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_I); connect(m_exportPinterestAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportBoxAction = new QAction(i18n("Export to &Box..."), this); m_exportBoxAction->setIcon(QIcon::fromTheme(QString::fromLatin1("box"))); actionCollection()->addAction(QLatin1String("export_box"), m_exportBoxAction); actionCollection()->setDefaultShortcut(m_exportBoxAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_B); connect(m_exportBoxAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportFacebookAction = new QAction(i18n("Export to &Facebook..."), this); /* m_exportFacebookAction->setIcon(QIcon::fromTheme(QString::fromLatin1("facebook"))); actionCollection()->addAction(QLatin1String("export_facebook"), m_exportFacebookAction); actionCollection()->setDefaultShortcut(m_exportFacebookAction, Qt::ALT + Qt::SHIFT + Qt::Key_F);*/ connect(m_exportFacebookAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportFlickrAction = new QAction(i18n("Export to Flick&r..."), this); m_exportFlickrAction->setIcon(QIcon::fromTheme(QLatin1String("flickr"))); actionCollection()->addAction(QLatin1String("export_flickr"), m_exportFlickrAction); actionCollection()->setDefaultShortcut(m_exportFlickrAction, Qt::ALT + Qt::SHIFT + Qt::Key_R); connect(m_exportFlickrAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportGdriveAction = new QAction(i18n("Export to &Google Drive..."), this); m_exportGdriveAction->setIcon(QIcon::fromTheme(QLatin1String("googledrive"))); actionCollection()->addAction(QLatin1String("export_googledrive"), m_exportGdriveAction); actionCollection()->setDefaultShortcut(m_exportGdriveAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_G); connect(m_exportGdriveAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportGphotoAction = new QAction(i18n("Export to &Google Photos..."), this); m_exportGphotoAction->setIcon(QIcon::fromTheme(QLatin1String("googlephoto"))); actionCollection()->addAction(QLatin1String("export_googlephoto"), m_exportGphotoAction); actionCollection()->setDefaultShortcut(m_exportGphotoAction, Qt::ALT + Qt::SHIFT + Qt::Key_P); connect(m_exportGphotoAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportImageshackAction = new QAction(i18n("Export to &Imageshack..."), this); m_exportImageshackAction->setIcon(QIcon::fromTheme(QLatin1String("imageshack"))); actionCollection()->addAction(QLatin1String("export_imageshack"), m_exportImageshackAction); actionCollection()->setDefaultShortcut(m_exportImageshackAction, Qt::ALT + Qt::SHIFT + Qt::Key_M); connect(m_exportImageshackAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportImgurAction = new QAction(i18n("Export to &Imgur.."), this); m_exportImgurAction->setIcon(QIcon::fromTheme(QLatin1String("imgur"))); actionCollection()->addAction(QLatin1String("export_imgur"), m_exportImgurAction); connect(m_exportImgurAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportPiwigoAction = new QAction(i18n("Export to &Piwigo..."), this); m_exportPiwigoAction->setIcon(QIcon::fromTheme(QLatin1String("piwigo"))); actionCollection()->addAction(QLatin1String("export_piwigo"), m_exportPiwigoAction); connect(m_exportPiwigoAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportRajceAction = new QAction(i18n("Export to &Rajce.net..."), this); m_exportRajceAction->setIcon(QIcon::fromTheme(QLatin1String("rajce"))); actionCollection()->addAction(QLatin1String("export_rajce"), m_exportRajceAction); actionCollection()->setDefaultShortcut(m_exportRajceAction, Qt::ALT + Qt::SHIFT + Qt::Key_J); connect(m_exportRajceAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportSmugmugAction = new QAction(i18n("Export to &SmugMug..."), this); m_exportSmugmugAction->setIcon(QIcon::fromTheme(QLatin1String("smugmug"))); actionCollection()->addAction(QLatin1String("export_smugmug"), m_exportSmugmugAction); actionCollection()->setDefaultShortcut(m_exportSmugmugAction, Qt::ALT + Qt::SHIFT + Qt::Key_S); connect(m_exportSmugmugAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportYandexfotkiAction = new QAction(i18n("Export to &Yandex.Fotki..."), this); m_exportYandexfotkiAction->setIcon(QIcon::fromTheme(QLatin1String("internet-web-browser"))); actionCollection()->addAction(QLatin1String("export_yandexfotki"), m_exportYandexfotkiAction); actionCollection()->setDefaultShortcut(m_exportYandexfotkiAction, Qt::ALT + Qt::SHIFT + Qt::Key_Y); connect(m_exportYandexfotkiAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); m_exportMediawikiAction = new QAction(i18n("Export to MediaWiki..."), this); m_exportMediawikiAction->setIcon(QIcon::fromTheme(QLatin1String("MediaWiki"))); actionCollection()->addAction(QLatin1String("export_MediaWiki"), m_exportMediawikiAction); connect(m_exportMediawikiAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); #ifdef HAVE_VKONTAKTE m_exportVkontakteAction = new QAction(i18n("Export to &VKontakte..."), this); m_exportVkontakteAction->setIcon(QIcon::fromTheme(QLatin1String("preferences-web-browser-shortcuts"))); actionCollection()->addAction(QLatin1String("export_vkontakte"), m_exportVkontakteAction); connect(m_exportVkontakteAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); #endif #ifdef HAVE_KIO m_exportFileTransferAction = new QAction(i18n("Export to remote storage..."), this); m_exportFileTransferAction->setIcon(QIcon::fromTheme(QLatin1String("folder-html"))); actionCollection()->addAction(QLatin1String("export_filetransfer"), m_exportFileTransferAction); actionCollection()->setDefaultShortcut(m_exportYandexfotkiAction, Qt::ALT + Qt::SHIFT + Qt::Key_K); connect(m_exportFileTransferAction, SIGNAL(triggered(bool)), this, SLOT(slotExportTool())); #endif } void DXmlGuiWindow::createImportActions() { m_importGphotoAction = new QAction(i18n("Import from &Google Photos..."), this); m_importGphotoAction->setIcon(QIcon::fromTheme(QLatin1String("googlephoto"))); actionCollection()->addAction(QLatin1String("import_googlephoto"), m_importGphotoAction); actionCollection()->setDefaultShortcut(m_importGphotoAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_P); connect(m_importGphotoAction, SIGNAL(triggered(bool)), this, SLOT(slotImportTool())); m_importSmugmugAction = new QAction(i18n("Import from &SmugMug..."), this); m_importSmugmugAction->setIcon(QIcon::fromTheme(QLatin1String("smugmug"))); actionCollection()->addAction(QLatin1String("import_smugmug"), m_importSmugmugAction); actionCollection()->setDefaultShortcut(m_importSmugmugAction, Qt::ALT + Qt::SHIFT + Qt::CTRL + Qt::Key_S); connect(m_importSmugmugAction, SIGNAL(triggered(bool)), this, SLOT(slotImportTool())); #ifdef HAVE_KIO m_importFileTransferAction = new QAction(i18n("Import from remote storage..."), this); m_importFileTransferAction->setIcon(QIcon::fromTheme(QLatin1String("folder-html"))); actionCollection()->addAction(QLatin1String("import_filetransfer"), m_importFileTransferAction); actionCollection()->setDefaultShortcut(m_importFileTransferAction, Qt::ALT + Qt::SHIFT + Qt::Key_I); connect(m_importFileTransferAction, SIGNAL(triggered(bool)), this, SLOT(slotImportTool())); #endif #ifdef HAVE_KSANE m_ksaneAction = new KSaneAction(this); actionCollection()->addAction(QLatin1String("import_scan"), m_ksaneAction); connect(m_ksaneAction, SIGNAL(triggered(bool)), this, SLOT(slotImportFromScanner())); #endif } QList DXmlGuiWindow::exportActions() const { return QList() << m_exportDropboxAction << m_exportOnedriveAction << m_exportPinterestAction << m_exportBoxAction << m_exportFacebookAction << m_exportFlickrAction << m_exportGdriveAction << m_exportGphotoAction << m_exportImageshackAction << m_exportImgurAction << m_exportPiwigoAction << m_exportRajceAction << m_exportSmugmugAction << m_exportYandexfotkiAction << m_exportMediawikiAction #ifdef HAVE_VKONTAKTE << m_exportVkontakteAction #endif #ifdef HAVE_KIO << m_exportFileTransferAction; #endif ; } QList DXmlGuiWindow::importActions() const { return QList() << m_importGphotoAction << m_importSmugmugAction #ifdef HAVE_KIO << m_importFileTransferAction #endif #ifdef HAVE_KSANE << m_ksaneAction #endif ; } int DXmlGuiWindow::actionToWebService(QAction* const action) const { if (action == m_exportBoxAction) { return WSStarter::Box; } else if (action == m_exportDropboxAction) { return WSStarter::Dropbox; } else if (action == m_exportFacebookAction) { return WSStarter::Facebook; } #ifdef HAVE_KIO else if (action == m_exportFileTransferAction) { return WSStarter::FileTransfer; } + else if (action == m_importFileTransferAction) + { + return WSStarter::ImportFileTransfer; + } #endif else if (action == m_exportFlickrAction) { return WSStarter::Flickr; } else if (action == m_exportGdriveAction) { return WSStarter::Gdrive; } else if (action == m_exportGphotoAction) { return WSStarter::Gphoto; } else if (action == m_exportImageshackAction) { return WSStarter::Imageshack; } else if (action == m_exportImgurAction) { return WSStarter::Imgur; } else if (action == m_exportMediawikiAction) { return WSStarter::Mediawiki; } else if (action == m_exportOnedriveAction) { return WSStarter::Onedrive; } else if (action == m_exportPinterestAction) { return WSStarter::Pinterest; } else if (action == m_exportPiwigoAction) { return WSStarter::Piwigo; } else if (action == m_exportRajceAction) { return WSStarter::Rajce; } else if (action == m_exportSmugmugAction) { return WSStarter::Smugmug; } #ifdef HAVE_VKONTAKTE else if (action == m_exportVkontakteAction) { return WSStarter::Vkontakte; } #endif else if (action == m_exportYandexfotkiAction) { return WSStarter::Yandexfotki; } + else if (action == m_importGphotoAction) + { + return WSStarter::ImportGphoto; + } + else if (action == m_importSmugmugAction) + { + return WSStarter::ImportSmugmug; + } return WSStarter::Unknown; } } // namespace Digikam diff --git a/core/showfoto/main/showfoto_import.cpp b/core/showfoto/main/showfoto_import.cpp index e4c1e87da5..c619557246 100644 --- a/core/showfoto/main/showfoto_import.cpp +++ b/core/showfoto/main/showfoto_import.cpp @@ -1,92 +1,73 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2004-11-22 * Description : stand alone digiKam image editor - Import tools * * Copyright (C) 2004-2018 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 "showfoto.h" #include "showfoto_p.h" namespace ShowFoto { void ShowFoto::slotImportFromScanner() { #ifdef HAVE_KSANE QString place = QDir::homePath(); QStringList pics = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); if (!pics.isEmpty()) place = pics.first(); QUrl trg = saveDestinationUrl(); if (!trg.isEmpty()) { QString path = trg.adjusted(QUrl::RemoveFilename).toLocalFile(); if (!path.isEmpty()) place = path; } m_ksaneAction->activate(place, configGroupName()); connect(m_ksaneAction, SIGNAL(signalImportedImage(QUrl)), this, SLOT(slotImportedImagefromScanner(QUrl))); #endif } void ShowFoto::slotImportedImagefromScanner(const QUrl& url) { openUrls(QList() << url); } void ShowFoto::slotImportTool() { - QAction* const tool = dynamic_cast(sender()); + QAction* const action = dynamic_cast(sender()); + int tool = actionToWebService(action); - if (tool == m_importGphotoAction) + if (tool != WSStarter::Unknown) { - QPointer w = new GSWindow(new DMetaInfoIface(this, QList() << d->thumbBar->currentUrl()), - this, QLatin1String("googlephotoimport")); - w->exec(); - delete w; + WSStarter::importFromWebService(tool, new DMetaInfoIface(this, QList() << d->thumbBar->currentUrl()), this); } - else if (tool == m_importSmugmugAction) - { - QPointer w = new SmugWindow(new DMetaInfoIface(this, QList() << d->thumbBar->currentUrl()), - this, true); - w->exec(); - delete w; - } - -#ifdef HAVE_KIO - else if (tool == m_importFileTransferAction) - { - QPointer w = new FTImportWindow(new DMetaInfoIface(this, QList() << d->thumbBar->currentUrl()), - this); - w->exec(); - delete w; - } -#endif } } // namespace ShowFoto diff --git a/core/showfoto/main/showfoto_p.h b/core/showfoto/main/showfoto_p.h index bc47c7888c..649a7047a3 100644 --- a/core/showfoto/main/showfoto_p.h +++ b/core/showfoto/main/showfoto_p.h @@ -1,191 +1,185 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2004-11-22 * Description : stand alone digiKam image editor GUI * * Copyright (C) 2004-2018 by Gilles Caulier * Copyright (C) 2006-2012 by Marcel Wiesweg * Copyright (C) 2013 by Mohamed_Anwer * * 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 SHOW_FOTO_PRIVATE_H #define SHOW_FOTO_PRIVATE_H // Qt includes #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 // KDE includes #include #include // Local includes #include "showfoto.h" #include "showfotoiteminfo.h" #include "showfotothumbnailbar.h" #include "dsplashscreen.h" #include "imagepropertiessidebar.h" #include "showfotodragdrophandler.h" #include "thumbnailloadthread.h" #include "drawdecoder.h" #include "digikam_globals.h" #include "digikam_debug.h" #include "canvas.h" #include "editorcore.h" #include "dmetadata.h" #include "editorstackview.h" #include "dfileoperations.h" #include "iccsettingscontainer.h" #include "imagedialog.h" #include "iofilesettings.h" #include "loadingcache.h" #include "loadingcacheinterface.h" #include "metadatasettings.h" #include "metadataedit.h" #include "presentationmngr.h" #include "savingcontext.h" #include "showfotosetup.h" #include "showfotosetupmisc.h" #include "setupicc.h" #include "slideshow.h" #include "statusprogressbar.h" #include "thememanager.h" #include "thumbnailsize.h" #include "dnotificationwrapper.h" #include "showfotodelegate.h" #include "showfotothumbnailmodel.h" #include "showfotocategorizedview.h" #include "showfotosettings.h" #include "dmetainfoiface.h" #include "dexpanderbox.h" #include "dfiledialog.h" #include "calwizard.h" #include "expoblendingmanager.h" #include "mailwizard.h" #include "advprintwizard.h" #include "dmediaservermngr.h" #include "dmediaserverdlg.h" #include "wsstarter.h" -#include "gswindow.h" -#include "smugwindow.h" - -#ifdef HAVE_KIO -# include "ftimportwindow.h" -#endif #ifdef HAVE_MARBLE # include "geolocationedit.h" #endif #ifdef HAVE_HTMLGALLERY # include "htmlwizard.h" #endif #ifdef HAVE_PANORAMA # include "panomanager.h" #endif #ifdef HAVE_MEDIAPLAYER # include "vidslidewizard.h" #endif namespace ShowFoto { class Q_DECL_HIDDEN ShowFoto::Private { public: explicit Private() : validIccPath(true), droppedUrls(false), itemsNb(0), vSplitter(0), fileOpenAction(0), openFilesInFolderAction(0), mediaServerAction(0), first(0), model(0), dDHandler(0), filterModel(0), thumbLoadThread(0), thumbBar(0), thumbBarDock(0), normalDelegate(0), rightSideBar(0), splash(0), settings(0) { } bool validIccPath; bool droppedUrls; int itemsNb; QSplitter* vSplitter; QAction* fileOpenAction; QUrl currentLoadedUrl; QUrl lastOpenedDirectory; QAction* openFilesInFolderAction; QAction* mediaServerAction; QAction* first; ShowfotoItemInfoList infoList; ShowfotoThumbnailModel* model; ShowfotoDragDropHandler* dDHandler; ShowfotoFilterModel* filterModel; Digikam::ThumbnailLoadThread* thumbLoadThread; ShowfotoThumbnailBar* thumbBar; Digikam::ThumbBarDock* thumbBarDock; ShowfotoNormalDelegate* normalDelegate; Digikam::ImagePropertiesSideBar* rightSideBar; Digikam::DSplashScreen* splash; ShowfotoSettings* settings; }; } // namespace Showfoto #endif // SHOW_FOTO_PRIVATE_H diff --git a/core/utilities/assistants/webservices/common/wsstarter.cpp b/core/utilities/assistants/webservices/common/wsstarter.cpp index 4292d5223b..162a6e4f81 100644 --- a/core/utilities/assistants/webservices/common/wsstarter.cpp +++ b/core/utilities/assistants/webservices/common/wsstarter.cpp @@ -1,388 +1,442 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2018-09-02 * Description : Start Web Service methods. * * Copyright (C) 2018 by Maik Qualmann * * 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 "wsstarter.h" // Qt includes #include // Local includes #include "digikam_debug.h" #include "digikam_config.h" #include "flickrwindow.h" #include "dbwindow.h" #include "odwindow.h" #include "pwindow.h" #include "boxwindow.h" #include "fbwindow.h" #include "gswindow.h" #include "imageshackwindow.h" #include "imgurwindow.h" #include "piwigowindow.h" #include "rajcewindow.h" #include "smugwindow.h" #include "yfwindow.h" #include "mediawikiwindow.h" #ifdef HAVE_VKONTAKTE # include "vkwindow.h" #endif #ifdef HAVE_KIO # include "ftexportwindow.h" # include "ftimportwindow.h" #endif namespace Digikam { class Q_DECL_HIDDEN WSStarter::Private { public: explicit Private() { } QPointer boxWindow; QPointer dbWindow; QPointer fbWindow; #ifdef HAVE_KIO QPointer ftExportWindow; + QPointer ftImportWindow; #endif QPointer flickrWindow; QPointer gdWindow; QPointer gpWindow; + QPointer gpImportWindow; QPointer imageShackWindow; QPointer imgurWindow; QPointer mediaWikiWindow; QPointer odWindow; QPointer pWindow; QPointer piwigoWindow; QPointer rajceWindow; QPointer smugWindow; + QPointer smugImportWindow; #ifdef HAVE_VKONTAKTE QPointer vkWindow; #endif QPointer yfWindow; }; class Q_DECL_HIDDEN WSStarterCreator { public: WSStarter object; }; Q_GLOBAL_STATIC(WSStarterCreator, creator) // ------------------------------------------------------------------------------------------------ WSStarter* WSStarter::instance() { return &creator->object; } void WSStarter::cleanUp() { delete instance()->d->boxWindow; delete instance()->d->dbWindow; delete instance()->d->fbWindow; #ifdef HAVE_KIO delete instance()->d->ftExportWindow; + delete instance()->d->ftImportWindow; #endif delete instance()->d->flickrWindow; delete instance()->d->gdWindow; delete instance()->d->gpWindow; + delete instance()->d->gpImportWindow; delete instance()->d->imageShackWindow; delete instance()->d->imgurWindow; delete instance()->d->mediaWikiWindow; delete instance()->d->odWindow; delete instance()->d->pWindow; delete instance()->d->piwigoWindow; delete instance()->d->rajceWindow; delete instance()->d->smugWindow; + delete instance()->d->smugImportWindow; #ifdef HAVE_VKONTAKTE delete instance()->d->vkWindow; #endif delete instance()->d->yfWindow; } void WSStarter::exportToWebService(int tool, DInfoInterface* const iface, QWidget* const parent) { instance()->toWebService(tool, iface, parent); } +void WSStarter::importFromWebService(int tool, DInfoInterface* const iface, QWidget* const parent) +{ + instance()->fromWebService(tool, iface, parent); +} + // ------------------------------------------------------------------------------------------------ WSStarter::WSStarter() : d(new Private) { - //qDebug() << "New WSStarter"; } WSStarter::~WSStarter() { delete d; } void WSStarter::toWebService(int tool, DInfoInterface* const iface, QWidget* const parent) { if (tool == Box) { if (checkWebService(static_cast(d->boxWindow))) { return; } else { d->boxWindow = new BOXWindow(iface, parent); d->boxWindow->show(); } } else if (tool == Dropbox) { if (checkWebService(static_cast(d->dbWindow))) { return; } else { d->dbWindow = new DBWindow(iface, parent); d->dbWindow->show(); } } else if (tool == Facebook) { if (checkWebService(static_cast(d->fbWindow))) { return; } else { d->fbWindow = new FbWindow(iface, parent); d->fbWindow->show(); } } #ifdef HAVE_KIO else if (tool == FileTransfer) { if (checkWebService(static_cast(d->ftExportWindow))) { return; } else { d->ftExportWindow = new FTExportWindow(iface, parent); d->ftExportWindow->show(); } } #endif else if (tool == Flickr) { if (checkWebService(static_cast(d->flickrWindow))) { return; } else { d->flickrWindow = new FlickrWindow(iface, parent); d->flickrWindow->show(); } } else if (tool == Gdrive) { if (checkWebService(static_cast(d->gdWindow))) { return; } else { d->gdWindow = new GSWindow(iface, parent, QLatin1String("googledriveexport")); d->gdWindow->show(); } } else if (tool == Gphoto) { if (checkWebService(static_cast(d->gpWindow))) { return; } else { d->gpWindow = new GSWindow(iface, parent, QLatin1String("googlephotoexport")); d->gpWindow->show(); } } else if (tool == Imageshack) { if (checkWebService(static_cast(d->imageShackWindow))) { return; } else { d->imageShackWindow = new ImageShackWindow(iface, parent); d->imageShackWindow->show(); } } else if (tool == Imgur) { if (checkWebService(static_cast(d->imgurWindow))) { return; } else { d->imgurWindow = new ImgurWindow(iface, parent); d->imgurWindow->show(); } } else if (tool == Mediawiki) { if (checkWebService(static_cast(d->mediaWikiWindow))) { return; } else { d->mediaWikiWindow = new MediaWikiWindow(iface, parent); d->mediaWikiWindow->show(); } } else if (tool == Onedrive) { if (checkWebService(static_cast(d->odWindow))) { return; } else { d->odWindow = new ODWindow(iface, parent); d->odWindow->show(); } } else if (tool == Pinterest) { if (checkWebService(static_cast(d->pWindow))) { return; } else { d->pWindow = new PWindow(iface, parent); d->pWindow->show(); } } else if (tool == Piwigo) { if (checkWebService(static_cast(d->piwigoWindow))) { return; } else { d->piwigoWindow = new PiwigoWindow(iface, parent); d->piwigoWindow->show(); } } else if (tool == Rajce) { if (checkWebService(static_cast(d->rajceWindow))) { return; } else { d->rajceWindow = new RajceWindow(iface, parent); d->rajceWindow->show(); } } else if (tool == Smugmug) { if (checkWebService(static_cast(d->smugWindow))) { return; } else { d->smugWindow = new SmugWindow(iface, parent); d->smugWindow->show(); } } #ifdef HAVE_VKONTAKTE else if (tool == Vkontakte) { if (checkWebService(static_cast(d->vkWindow))) { return; } else { d->vkWindow = new VKWindow(iface, parent); d->vkWindow->show(); } } #endif else if (tool == Yandexfotki) { if (checkWebService(static_cast(d->yfWindow))) { return; } else { d->yfWindow = new YFWindow(iface, parent); d->yfWindow->show(); } } } +void WSStarter::fromWebService(int tool, DInfoInterface* const iface, QWidget* const parent) +{ + if (tool == ImportGphoto) + { + if (checkWebService(static_cast(d->gpImportWindow))) + { + return; + } + else + { + d->gpImportWindow = new GSWindow(iface, parent, QLatin1String("googlephotoimport")); + d->gpImportWindow->show(); + } + } + +#ifdef HAVE_KIO + else if (tool == ImportFileTransfer) + { + if (checkWebService(static_cast(d->ftImportWindow))) + { + return; + } + else + { + d->ftImportWindow = new FTImportWindow(iface, parent); + d->ftImportWindow->show(); + } + } +#endif + + else if (tool == ImportSmugmug) + { + if (checkWebService(static_cast(d->smugImportWindow))) + { + return; + } + else + { + d->smugImportWindow = new SmugWindow(iface, parent, true); + d->smugImportWindow->show(); + } + } +} + bool WSStarter::checkWebService(QWidget* const widget) { if (widget && (widget->isMinimized() || !widget->isHidden())) { widget->showNormal(); // krazy:exclude=qmethods widget->activateWindow(); widget->raise(); return true; } return false; } } // namespace Digikam diff --git a/core/utilities/assistants/webservices/common/wsstarter.h b/core/utilities/assistants/webservices/common/wsstarter.h index 7f2ede0f8e..8e51a2c670 100644 --- a/core/utilities/assistants/webservices/common/wsstarter.h +++ b/core/utilities/assistants/webservices/common/wsstarter.h @@ -1,95 +1,101 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2018-09-02 * Description : Start Web Service methods. * * Copyright (C) 2018 by Maik Qualmann * * 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_WS_STARTER_H #define DIGIKAM_WS_STARTER_H // Qt includes #include // Local includes #include "digikam_export.h" namespace Digikam { class DInfoInterface; class DIGIKAM_EXPORT WSStarter : public QObject { Q_OBJECT public: enum WSTool { Unknown = 0, Box, Dropbox, Facebook, FileTransfer, Flickr, Gdrive, Gphoto, Imageshack, Imgur, Mediawiki, Onedrive, Pinterest, Piwigo, Rajce, Smugmug, Vkontakte, - Yandexfotki + Yandexfotki, + // Import + ImportGphoto, + ImportFileTransfer, + ImportSmugmug }; public: static WSStarter* instance(); static void cleanUp(); static void exportToWebService(int tool, DInfoInterface* const iface, QWidget* const parent); + static void importFromWebService(int tool, DInfoInterface* const iface, QWidget* const parent); private: explicit WSStarter(); ~WSStarter(); void toWebService(int tool, DInfoInterface* const iface, QWidget* const parent); + void fromWebService(int tool, DInfoInterface* const iface, QWidget* const parent); bool checkWebService(QWidget* const widget); private: class Private; Private* const d; friend class WSStarterCreator; }; } // namespace Digikam #endif // DIGIKAM_WS_STARTER_H diff --git a/core/utilities/imageeditor/main/imagewindow_import.cpp b/core/utilities/imageeditor/main/imagewindow_import.cpp index 0a8dd32c4b..0aef200d32 100644 --- a/core/utilities/imageeditor/main/imagewindow_import.cpp +++ b/core/utilities/imageeditor/main/imagewindow_import.cpp @@ -1,76 +1,58 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2004-11-22 * Description : digiKam image editor - Import tools * * Copyright (C) 2004-2018 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 "imagewindow.h" #include "imagewindow_p.h" namespace Digikam { void ImageWindow::slotImportFromScanner() { #ifdef HAVE_KSANE m_ksaneAction->activate(DigikamApp::instance()->scannerTargetPlace(), configGroupName()); connect(m_ksaneAction, SIGNAL(signalImportedImage(QUrl)), this, SLOT(slotImportedImagefromScanner(QUrl))); #endif } void ImageWindow::slotImportedImagefromScanner(const QUrl& url) { ImageInfo info = ScanController::instance()->scannedInfo(url.toLocalFile()); openImage(info); } void ImageWindow::slotImportTool() { - QAction* const tool = dynamic_cast(sender()); + QAction* const action = dynamic_cast(sender()); + int tool = actionToWebService(action); - if (tool == m_importGphotoAction) + if (tool != WSStarter::Unknown) { - QPointer w = new GSWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this, QLatin1String("googlephotoimport")); - w->exec(); - delete w; + WSStarter::importFromWebService(tool, new DBInfoIface(this, QList(), + ApplicationSettings::ImportExport), this); } - else if (tool == m_importSmugmugAction) - { - QPointer w = new SmugWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this, true); - w->exec(); - delete w; - } - -#ifdef HAVE_KIO - else if (tool == m_importFileTransferAction) - { - QPointer w = new FTImportWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this); - w->exec(); - delete w; - } -#endif } } // namespace Digikam diff --git a/core/utilities/imageeditor/main/imagewindow_p.h b/core/utilities/imageeditor/main/imagewindow_p.h index e90d200f50..f9f43e54a8 100644 --- a/core/utilities/imageeditor/main/imagewindow_p.h +++ b/core/utilities/imageeditor/main/imagewindow_p.h @@ -1,304 +1,298 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2004-02-12 * Description : digiKam image editor GUI * * Copyright (C) 2004-2005 by Renchi Raju * Copyright (C) 2004-2018 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. * * ============================================================ */ #ifndef DIGIKAM_IMAGE_WINDOW_PRIVATE_H #define DIGIKAM_IMAGE_WINDOW_PRIVATE_H // C++ includes #include #include #include // Qt includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE includes #include #include #include // Local includes #include "versionmanager.h" #include "dlayoutbox.h" #include "album.h" #include "coredb.h" #include "albummanager.h" #include "albummodel.h" #include "albumfiltermodel.h" #include "applicationsettings.h" #include "canvas.h" #include "collectionlocation.h" #include "collectionmanager.h" #include "collectionscanner.h" #include "componentsinfo.h" #include "coredbaccess.h" #include "coredbwatch.h" #include "coredbchangesets.h" #include "ddragobjects.h" #include "deletedialog.h" #include "dimg.h" #include "editorcore.h" #include "dimagehistory.h" #include "digikamapp.h" #include "dio.h" #include "dmetadata.h" #include "editorstackview.h" #include "fileactionmngr.h" #include "dfileoperations.h" #include "digikam_globals.h" #include "digikam_debug.h" #include "iccsettingscontainer.h" #include "imageattributeswatch.h" #include "imagefiltermodel.h" #include "imagedragdrop.h" #include "imagedescedittab.h" #include "imageinfo.h" #include "imagegps.h" #include "imagelistmodel.h" #include "imagepropertiessidebardb.h" #include "imagepropertiesversionstab.h" #include "imagescanner.h" #include "imagethumbnailbar.h" #include "iofilesettings.h" #include "dnotificationwrapper.h" #include "loadingcacheinterface.h" #include "metadatahub.h" #include "metadatasettings.h" #include "metadataedit.h" #include "colorlabelwidget.h" #include "picklabelwidget.h" #include "presentationmngr.h" #include "ratingwidget.h" #include "savingcontext.h" #include "scancontroller.h" #include "setup.h" #include "slideshow.h" #include "statusprogressbar.h" #include "syncjob.h" #include "tagsactionmngr.h" #include "tagscache.h" #include "tagspopupmenu.h" #include "tagregion.h" #include "thememanager.h" #include "thumbbardock.h" #include "thumbnailloadthread.h" #include "undostate.h" #include "dexpanderbox.h" #include "dbinfoiface.h" #include "calwizard.h" #include "expoblendingmanager.h" #include "mailwizard.h" #include "advprintwizard.h" #include "dmediaserverdlg.h" #include "facetagseditor.h" #include "wsstarter.h" -#include "gswindow.h" -#include "smugwindow.h" - -#ifdef HAVE_KIO -# include "ftimportwindow.h" -#endif #ifdef HAVE_MARBLE # include "geolocationedit.h" #endif #ifdef HAVE_HTMLGALLERY # include "htmlwizard.h" #endif #ifdef HAVE_PANORAMA # include "panomanager.h" #endif #ifdef HAVE_MEDIAPLAYER # include "vidslidewizard.h" #endif namespace Digikam { class Q_DECL_HIDDEN DatabaseVersionManager : public VersionManager { public: virtual QString toplevelDirectory(const QString& path) { CollectionLocation loc = CollectionManager::instance()->locationForPath(path); if (!loc.isNull()) { return loc.albumRootPath(); } return QLatin1String("/"); } }; // ----------------------------------------------------------------------------------------- class Q_DECL_HIDDEN ImageWindow::Private { public: Private() : configShowThumbbarEntry(QLatin1String("Show Thumbbar")), configHorizontalThumbbarEntry(QLatin1String("HorizontalThumbbar")), viewContainer(0), toMainWindowAction(0), fileDeletePermanentlyAction(0), fileDeletePermanentlyDirectlyAction(0), fileTrashDirectlyAction(0), imageInfoModel(0), imageFilterModel(0), dragDropHandler(0), thumbBar(0), thumbBarDock(0), rightSideBar(0) { } QModelIndex currentIndex() const { return imageFilterModel->indexForImageInfo(currentImageInfo); } QModelIndex currentSourceIndex() const { return imageInfoModel->indexForImageInfo(currentImageInfo); } bool currentIsValid() const { return !currentImageInfo.isNull(); } QUrl currentUrl() const { return currentImageInfo.fileUrl(); } QModelIndex nextIndex() const { return imageFilterModel->index(currentIndex().row() + 1, 0); } QModelIndex previousIndex() const { return imageFilterModel->index(currentIndex().row() - 1, 0); } QModelIndex firstIndex() const { return imageFilterModel->index(0, 0); } QModelIndex lastIndex() const { return imageFilterModel->index(imageFilterModel->rowCount() - 1, 0); } ImageInfo imageInfo(const QModelIndex& index) const { return imageFilterModel->imageInfo(index); } void setThumbBarToCurrent() { QModelIndex index = imageFilterModel->indexForImageInfo(currentImageInfo); if (index.isValid()) { thumbBar->setCurrentIndex(index); } else { thumbBar->setCurrentWhenAvailable(currentImageInfo.id()); } } void ensureModelContains(const ImageInfo& info) { if (!imageInfoModel->hasImage(info)) { imageInfoModel->addImageInfoSynchronously(info); imageFilterModel->sort(imageFilterModel->sortColumn()); } } public: const QString configShowThumbbarEntry; const QString configHorizontalThumbbarEntry; KMainWindow* viewContainer; QAction* toMainWindowAction; // Delete actions QAction* fileDeletePermanentlyAction; QAction* fileDeletePermanentlyDirectlyAction; QAction* fileTrashDirectlyAction; ImageInfo currentImageInfo; ImageListModel* imageInfoModel; ImageFilterModel* imageFilterModel; ImageDragDropHandler* dragDropHandler; ImageThumbnailBar* thumbBar; ThumbBarDock* thumbBarDock; ImagePropertiesSideBarDB* rightSideBar; DatabaseVersionManager versionManager; QMultiMap newFaceTags; }; } // namespace Digikam #endif // DIGIKAM_IMAGE_WINDOW_PRIVATE_H diff --git a/core/utilities/lighttable/lighttablewindow_import.cpp b/core/utilities/lighttable/lighttablewindow_import.cpp index a47ae15514..a6216404d9 100644 --- a/core/utilities/lighttable/lighttablewindow_import.cpp +++ b/core/utilities/lighttable/lighttablewindow_import.cpp @@ -1,75 +1,58 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2004-11-22 * Description : digiKam light table - Import tools * * Copyright (C) 2007-2018 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 "lighttablewindow.h" #include "lighttablewindow_p.h" namespace Digikam { void LightTableWindow::slotImportFromScanner() { #ifdef HAVE_KSANE m_ksaneAction->activate(DigikamApp::instance()->scannerTargetPlace(), configGroupName()); connect(m_ksaneAction, SIGNAL(signalImportedImage(QUrl)), this, SLOT(slotImportedImagefromScanner(QUrl))); #endif } void LightTableWindow::slotImportedImagefromScanner(const QUrl& url) { ImageInfo info = ScanController::instance()->scannedInfo(url.toLocalFile()); loadImageInfos(ImageInfoList() << info, info, true); } void LightTableWindow::slotImportTool() { - QAction* const tool = dynamic_cast(sender()); + QAction* const action = dynamic_cast(sender()); + int tool = actionToWebService(action); - if (tool == m_importGphotoAction) + if (tool != WSStarter::Unknown) { - QPointer w = new GSWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this, QLatin1String("googlephotoimport")); - w->exec(); - delete w; + WSStarter::importFromWebService(tool, new DBInfoIface(this, QList(), + ApplicationSettings::ImportExport), this); } - else if (tool == m_importSmugmugAction) - { - QPointer w = new SmugWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), - this, true); - w->exec(); - delete w; - } - -#ifdef HAVE_KIO - else if (tool == m_importFileTransferAction) - { - QPointer w = new FTImportWindow(new DBInfoIface(this, QList(), ApplicationSettings::ImportExport), this); - w->exec(); - delete w; - } -#endif } } // namespace Digikam diff --git a/core/utilities/lighttable/lighttablewindow_p.h b/core/utilities/lighttable/lighttablewindow_p.h index 0ed703f075..a7a2125cbb 100644 --- a/core/utilities/lighttable/lighttablewindow_p.h +++ b/core/utilities/lighttable/lighttablewindow_p.h @@ -1,233 +1,227 @@ /* ============================================================ * * This file is a part of digiKam project * http://www.digikam.org * * Date : 2007-03-05 * Description : digiKam light table GUI * * Copyright (C) 2007-2018 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. * * ============================================================ */ #ifndef DIGIKAM_LIGHT_TABLE_WINDOW_PRIVATE_H #define DIGIKAM_LIGHT_TABLE_WINDOW_PRIVATE_H // Qt includes #include #include #include #include #include #include #include #include #include // KDE includes #include #include // Local includes #include "digikam_globals.h" #include "imagepropertiessidebardb.h" #include "statusprogressbar.h" #include "dzoombar.h" #include "lighttableview.h" #include "lighttablethumbbar.h" #include "thumbbardock.h" #include "drawdecoder.h" #include "digikam_debug.h" #include "componentsinfo.h" #include "digikamapp.h" #include "thememanager.h" #include "dimg.h" #include "dio.h" #include "dmetadata.h" #include "dfileoperations.h" #include "metadatasettings.h" #include "metadataedit.h" #include "applicationsettings.h" #include "albummanager.h" #include "loadingcacheinterface.h" #include "deletedialog.h" #include "iccsettings.h" #include "imagewindow.h" #include "imagegps.h" #include "imagedescedittab.h" #include "presentationmngr.h" #include "slideshowbuilder.h" #include "slideshow.h" #include "setup.h" #include "syncjob.h" #include "lighttablepreview.h" #include "albummodel.h" #include "albumfiltermodel.h" #include "coredbchangesets.h" #include "collectionscanner.h" #include "scancontroller.h" #include "tagsactionmngr.h" #include "thumbnailsize.h" #include "thumbnailloadthread.h" #include "dexpanderbox.h" #include "dbinfoiface.h" #include "calwizard.h" #include "expoblendingmanager.h" #include "mailwizard.h" #include "advprintwizard.h" #include "dmediaserverdlg.h" #include "wsstarter.h" -#include "gswindow.h" -#include "smugwindow.h" - -#ifdef HAVE_KIO -# include "ftimportwindow.h" -#endif #ifdef HAVE_MARBLE # include "geolocationedit.h" #endif #ifdef HAVE_HTMLGALLERY # include "htmlwizard.h" #endif #ifdef HAVE_PANORAMA # include "panomanager.h" #endif #ifdef HAVE_MEDIAPLAYER # include "vidslidewizard.h" #endif namespace Digikam { class DAdjustableLabel; class Q_DECL_HIDDEN LightTableWindow::Private { public: Private() : autoLoadOnRightPanel(true), autoSyncPreview(true), fromLeftPreview(true), setItemLeftAction(0), setItemRightAction(0), clearListAction(0), editItemAction(0), removeItemAction(0), fileDeleteAction(0), fileDeleteFinalAction(0), slideShowAction(0), leftZoomPlusAction(0), leftZoomMinusAction(0), leftZoomTo100percents(0), leftZoomFitToWindowAction(0), rightZoomPlusAction(0), rightZoomMinusAction(0), rightZoomTo100percents(0), rightZoomFitToWindowAction(0), forwardAction(0), backwardAction(0), firstAction(0), lastAction(0), showBarAction(0), viewCMViewAction(0), syncPreviewAction(0), navigateByPairAction(0), clearOnCloseAction(0), leftFileName(0), rightFileName(0), hSplitter(0), barViewDock(0), thumbView(0), previewView(0), leftZoomBar(0), rightZoomBar(0), statusProgressBar(0), leftSideBar(0), rightSideBar(0) { } void addPageUpDownActions(LightTableWindow* const q, QWidget* const w) { defineShortcut(w, Qt::Key_Down, q, SLOT(slotForward())); defineShortcut(w, Qt::Key_Right, q, SLOT(slotForward())); defineShortcut(w, Qt::Key_Up, q, SLOT(slotBackward())); defineShortcut(w, Qt::Key_Left, q, SLOT(slotBackward())); } public: bool autoLoadOnRightPanel; bool autoSyncPreview; bool fromLeftPreview; QAction* setItemLeftAction; QAction* setItemRightAction; QAction* clearListAction; QAction* editItemAction; QAction* removeItemAction; QAction* fileDeleteAction; QAction* fileDeleteFinalAction; QAction* slideShowAction; QAction* leftZoomPlusAction; QAction* leftZoomMinusAction; QAction* leftZoomTo100percents; QAction* leftZoomFitToWindowAction; QAction* rightZoomPlusAction; QAction* rightZoomMinusAction; QAction* rightZoomTo100percents; QAction* rightZoomFitToWindowAction; QAction* forwardAction; QAction* backwardAction; QAction* firstAction; QAction* lastAction; QAction* showBarAction; QAction* viewCMViewAction; QAction* syncPreviewAction; QAction* navigateByPairAction; QAction* clearOnCloseAction; DAdjustableLabel* leftFileName; DAdjustableLabel* rightFileName; SidebarSplitter* hSplitter; ThumbBarDock* barViewDock; LightTableThumbBar* thumbView; LightTableView* previewView; DZoomBar* leftZoomBar; DZoomBar* rightZoomBar; StatusProgressBar* statusProgressBar; ImagePropertiesSideBarDB* leftSideBar; ImagePropertiesSideBarDB* rightSideBar; }; } // namespace Digikam #endif // DIGIKAM_LIGHT_TABLE_WINDOW_PRIVATE_H