Commit 1cb521d8 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

factorize

parent f087dd0a
......@@ -58,11 +58,14 @@
#include "calsettings.h"
#include "kpimagedialog.h"
#include "kpmetadata.h"
using namespace KIPIPlugins;
namespace KIPICalendarPlugin
{
MonthWidget::MonthWidget(KIPI::Interface* interface, QWidget* parent, int month)
MonthWidget::MonthWidget(Interface* const interface, QWidget* const parent, int month)
: QPushButton(parent), thumbSize(64, 64), interface_(interface)
{
setAcceptDrops(true);
......@@ -78,7 +81,6 @@ MonthWidget::MonthWidget(KIPI::Interface* interface, QWidget* parent, int month)
connect(this, SIGNAL(pressed()),
this, SLOT(monthSelected()));
}
MonthWidget::~MonthWidget()
......@@ -97,7 +99,7 @@ void MonthWidget::paintEvent(QPaintEvent* event)
QPushButton::paintEvent(event);
QPainter painter(this);
QString name = KGlobal::locale()->calendar()->monthName(
month_, CalSettings::instance()->year(), KCalendarSystem::ShortName);
month_, CalSettings::instance()->year(), KCalendarSystem::ShortName);
cr = contentsRect();
cr.setBottom(70);
......@@ -142,12 +144,9 @@ void MonthWidget::setImage(const KUrl& url)
}
// check if the file is an image
QFileInfo fi(url.path());
QString rawFilesExt(KDcrawIface::KDcraw::rawFiles());
// Check if RAW image.
if (!rawFilesExt.toUpper().contains(fi.suffix().toUpper()))
// Check if RAW file.
if (KPMetadata::isRawFile(url))
{
// Check if image can be loaded by native Qt loader.
if (QImageReader::imageFormat(url.path()).isEmpty())
......@@ -200,7 +199,7 @@ void MonthWidget::mouseReleaseEvent(QMouseEvent* event)
if (event->button() == Qt::LeftButton)
{
KIPIPlugins::KPImageDialog dlg(this, true);
KPImageDialog dlg(this, true);
setImage(dlg.url());
}
else if (event->button() == Qt::RightButton)
......
......@@ -7,9 +7,9 @@
* Description : month image selection widget.
*
* Copyright (C) 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com>
* Copyright (C) 2006 by Tom Albers <tomalbers@kde.nl>
* Copyright (C) 2006 by Tom Albers <tomalbers@kde.nl>
* Copyright (C) 2007-2008 by Orgad Shaneh <orgads at gmail dot com>
* Copyright (C) 2012 by Angelo Naselli <anaselli at linux dot it>
* Copyright (C) 2012 by Angelo Naselli <anaselli at linux dot it>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -43,9 +43,11 @@ class QPaintEvent;
namespace KIPI
{
class Interface;
class Interface;
}
using namespace KIPI;
namespace KIPICalendarPlugin
{
......@@ -55,7 +57,7 @@ class MonthWidget : public QPushButton
public:
MonthWidget(KIPI::Interface* interface, QWidget* parent, int month);
MonthWidget(Interface* const interface, QWidget* const parent, int month);
~MonthWidget();
KUrl imagePath() const;
......@@ -85,11 +87,11 @@ private:
private:
const QSize thumbSize;
QPixmap thumb_;
int month_;
KUrl imagePath_;
KIPI::Interface* interface_;
const QSize thumbSize;
QPixmap thumb_;
int month_;
KUrl imagePath_;
Interface* interface_;
};
} // NameSpace KIPICalendarPlugin
......
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