Commit 4d02e8ad authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

separate settings widget from main dialog implementation, for better readability of code.

CCMAIL: smit.meh@gmail.com
parent d7e1ef27
......@@ -5,6 +5,7 @@ SET(kipiplugin_timeadjust_PART_SRCS plugin_timeadjust.cpp
clockphotodialog.cpp
actionthread.cpp
myimagelist.cpp
settingswidget.cpp
)
KDE4_ADD_PLUGIN(kipiplugin_timeadjust ${kipiplugin_timeadjust_PART_SRCS})
......
This diff is collapsed.
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
* Date : 2004-05-16
* Description : a plugin to set time stamp of picture files.
*
* Copyright (C) 2012 by Smit Mehta <smit dot meh at gmail dot com>
* Copyright (C) 2006-2012 by Gilles Caulier <caulier dot gilles 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 SETTINGSWIDGET_H
#define SETTINGSWIDGET_H
// Qt includes
#include <QDateTime>
// KDE includes
#include <kconfiggroup.h>
#include <kvbox.h>
// Local includes
#include "timeadjustsettings.h"
class KConfigGroup;
namespace KIPITimeAdjustPlugin
{
class SettingsWidget : public KVBox
{
Q_OBJECT
public:
SettingsWidget(QWidget* const parent=0);
~SettingsWidget();
void readSettings(const KConfigGroup& group);
void saveSettings(KConfigGroup& group);
TimeAdjustSettings settings() const;
QDateTime customDate() const;
QDateTime calculateAdjustedDate(const QDateTime& time) const;
Q_SIGNALS:
void signalSettingsChanged();
private Q_SLOTS:
void slotSrcTimestampChanged();
void slotResetDateToCurrent();
void slotAdjustmentTypeChanged();
void slotDetAdjustmentByClockPhoto();
private:
class SettingsWidgetPrivate;
SettingsWidgetPrivate* const d;
};
} // namespace KIPITimeAdjustPlugin
#endif /* SETTINGSWIDGET_H */
This diff is collapsed.
......@@ -64,10 +64,6 @@ protected:
private Q_SLOTS:
void slotSrcTimestampChanged();
void slotResetDateToCurrent();
void slotAdjustmentTypeChanged();
void slotDetAdjustmentByClockPhoto();
void slotApplyClicked();
void slotCloseClicked();
void slotProgressChanged(int);
......@@ -76,16 +72,15 @@ private Q_SLOTS:
void slotButtonClicked(int);
void slotProcessStarted(const KUrl&);
void slotProcessEnded(const KUrl&, int);
void slotUpdateListView();
void setBusy(bool);
private:
/** Read the Used Timestamps for all selected files
* (according to the newly selected source timestamp type),
* this will also implicitly update listview info.
*/
void readTimestamps();
void slotReadTimestamps();
private:
/** Called by readTimestamps() to get KIPI host timestamps
*/
......@@ -102,9 +97,7 @@ private:
void readSettings();
void saveSettings();
TimeAdjustSettings settings() const;
QDateTime calculateAdjustedTime(const QDateTime& time) const;
void updateListView();
private:
......
......@@ -31,6 +31,14 @@ class TimeAdjustSettings
public:
enum UseDateSource
{
APPDATE = 0,
FILEDATE,
METADATADATE,
CUSTOMDATE
};
enum UseMetaDateType
{
EXIFIPTCXMP = 0,
......@@ -66,12 +74,29 @@ public:
updXMPDate = false;
updFileName = false;
updFileModDate = false;
dateSource = APPDATE;
metadataSource = EXIFIPTCXMP;
fileDateSource = FILELASTMOD;
};
~TimeAdjustSettings()
{
};
/// Check if at least one option is selected
bool atLeastOneUpdateToProcess()
{
return (updAppDate ||
updFileModDate ||
updEXIFModDate ||
updEXIFOriDate ||
updEXIFDigDate ||
updIPTCDate ||
updXMPDate ||
updFileName);
}
public:
bool updAppDate;
......@@ -82,6 +107,10 @@ public:
bool updXMPDate;
bool updFileName;
bool updFileModDate;
int dateSource;
int metadataSource;
int fileDateSource;
};
} // namespace KIPITimeAdjustPlugin
......
Markdown is supported
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