Commit c9033851 authored by Maik Qualmann's avatar Maik Qualmann
Browse files

first step to implement a web service starter

Flickr is the first tool used
CCBUGS: 397972
parent 01fe01d9
......@@ -203,6 +203,10 @@ DigikamApp::~DigikamApp()
QueueMgrWindow::queueManagerWindow()->close();
}
// Close all web service windows.
WSStarter::cleanUp();
if (TagsManager::isCreated())
{
TagsManager::instance()->close();
......
......@@ -124,9 +124,7 @@ void DigikamApp::slotExportTool()
}
else if (tool == m_exportFlickrAction)
{
QPointer<FlickrWindow> w = new FlickrWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
WSStarter::exportFlickr(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
}
else if (tool == m_exportGdriveAction)
{
......
......@@ -135,7 +135,7 @@
#include "pwindow.h"
#include "boxwindow.h"
#include "fbwindow.h"
#include "flickrwindow.h"
#include "wsstarter.h"
#include "gswindow.h"
#include "imageshackwindow.h"
#include "imgurwindow.h"
......
......@@ -126,6 +126,7 @@ ShowFoto::~ShowFoto()
delete m_canvas;
m_canvas = 0;
Digikam::WSStarter::cleanUp();
Digikam::ThumbnailLoadThread::cleanUp();
Digikam::LoadingCacheInterface::cleanUp();
Digikam::DMediaServerMngr::instance()->saveAtShutdown();
......
......@@ -118,9 +118,7 @@ void ShowFoto::slotExportTool()
}
else if (tool == m_exportFlickrAction)
{
QPointer<FlickrWindow> w = new FlickrWindow(new DMetaInfoIface(this, d->thumbBar->urls()), this);
w->exec();
delete w;
WSStarter::exportFlickr(new DMetaInfoIface(this, d->thumbBar->urls()), this);
}
else if (tool == m_exportGdriveAction)
{
......
......@@ -112,7 +112,7 @@
#include "pwindow.h"
#include "boxwindow.h"
#include "fbwindow.h"
#include "flickrwindow.h"
#include "wsstarter.h"
#include "gswindow.h"
#include "imageshackwindow.h"
#include "imgurwindow.h"
......
......@@ -103,6 +103,7 @@ set(libwebservices_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/common/wscomboboxdelegate.cp
${CMAKE_CURRENT_SOURCE_DIR}/common/wsselectuserdlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/wstooldialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/wslogindialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/wsstarter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/manager/wssettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/manager/wsauthentication.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/manager/wstalker.cpp
......
/* ============================================================
*
* 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 <metzpinguin at gmail dot com>
*
* 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 <QPointer>
// Local includes
#include "digikam_debug.h"
#include "flickrwindow.h"
namespace Digikam
{
class Q_DECL_HIDDEN WSStarter::Private
{
public:
explicit Private()
{
}
QPointer<FlickrWindow> flickrWindow;
};
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->flickrWindow;
}
void WSStarter::exportFlickr(DInfoInterface* const iface, QWidget* const parent)
{
instance()->toFlickr(iface, parent);
}
// ------------------------------------------------------------------------------------------------
WSStarter::WSStarter()
: d(new Private)
{
qDebug() << "New WSStarter";
}
WSStarter::~WSStarter()
{
delete d;
}
void WSStarter::toFlickr(DInfoInterface* const iface, QWidget* const parent)
{
if (d->flickrWindow && (d->flickrWindow->isMinimized() || !d->flickrWindow->isHidden()))
{
d->flickrWindow->showNormal(); // krazy:exclude=qmethods
d->flickrWindow->activateWindow();
d->flickrWindow->raise();
}
else
{
qDebug() << "New FlickrWindow";
d->flickrWindow = new FlickrWindow(iface, parent);
d->flickrWindow->show();
}
}
} // namespace Digikam
/* ============================================================
*
* 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 <metzpinguin at gmail dot com>
*
* 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 <QObject>
// Local includes
#include "digikam_export.h"
namespace Digikam
{
class DInfoInterface;
class DIGIKAM_EXPORT WSStarter : public QObject
{
Q_OBJECT
public:
static WSStarter* instance();
static void cleanUp();
static void exportFlickr(DInfoInterface* const iface, QWidget* const parent);
private:
explicit WSStarter();
~WSStarter();
void toFlickr(DInfoInterface* const iface, QWidget* const parent);
private:
class Private;
Private* const d;
friend class WSStarterCreator;
};
} // namespace Digikam
#endif // DIGIKAM_WS_STARTER_H
......@@ -129,10 +129,8 @@ void ImageWindow::slotExportTool()
}
else if (tool == m_exportFlickrAction)
{
QPointer<FlickrWindow> w = new FlickrWindow(new DBInfoIface(this, d->thumbBar->allUrls(),
ApplicationSettings::ImportExport), this);
w->exec();
delete w;
WSStarter::exportFlickr(new DBInfoIface(this, d->thumbBar->allUrls(),
ApplicationSettings::ImportExport), this);
}
else if (tool == m_exportGdriveAction)
{
......
......@@ -139,7 +139,7 @@
#include "pwindow.h"
#include "boxwindow.h"
#include "fbwindow.h"
#include "flickrwindow.h"
#include "wsstarter.h"
#include "gswindow.h"
#include "imageshackwindow.h"
#include "imgurwindow.h"
......
......@@ -128,10 +128,8 @@ void LightTableWindow::slotExportTool()
}
else if (tool == m_exportFlickrAction)
{
QPointer<FlickrWindow> w = new FlickrWindow(new DBInfoIface(this, d->thumbView->allUrls(),
ApplicationSettings::ImportExport), this);
w->exec();
delete w;
WSStarter::exportFlickr(new DBInfoIface(this, d->thumbView->allUrls(),
ApplicationSettings::ImportExport), this);
}
else if (tool == m_exportGdriveAction)
{
......
......@@ -95,7 +95,7 @@
#include "pwindow.h"
#include "boxwindow.h"
#include "fbwindow.h"
#include "flickrwindow.h"
#include "wsstarter.h"
#include "gswindow.h"
#include "imageshackwindow.h"
#include "imgurwindow.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment