[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Kamoso] fdd990b: Replaced all tabs by sapces Set copyright year fro
From: Alex Fiestas <alex () eyeos ! org>
Date: 2010-12-31 17:31:50
Message-ID: 20101231173150.8E668A60A9 () git ! kde ! org
[Download RAW message or body]
commit fdd990bdce38b438f53d518839c603a31d20a552
branch master
Author: Alex Fiestas <alex@eyeos.org>
Date: Fri Dec 31 18:27:05 2010 +0100
Replaced all tabs by sapces
Set copyright year from 2008 to 2011
Fix some coding style to more closer to kdelibs
diff --git a/src/burstshootmode.cpp b/src/burstshootmode.cpp
index d3aa4bb..44b7d13 100644
--- a/src/burstshootmode.cpp
+++ b/src/burstshootmode.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -26,50 +26,51 @@
#include "countdownwidget.h"
BurstShootMode::BurstShootMode(Kamoso* camera)
- : ShootMode(camera)
+ : ShootMode(camera)
{
}
void BurstShootMode::deactivate()
{
- disconnect(controller()->countdown(), SIGNAL(finished()),this, SLOT(keepTaking()));
+ disconnect(controller()->countdown(), SIGNAL(finished()),this, \
SLOT(keepTaking())); }
QWidget* BurstShootMode::mainAction()
{
- QPushButton* m_action = new QPushButton(controller());
- m_action->setIcon(icon());
- m_action->setIconSize(QSize(32,32));
- m_action->setToolTip(name());
- m_action->setCheckable(true);
- connect(controller()->countdown(), SIGNAL(finished()), SLOT(keepTaking()));
- connect(m_action, SIGNAL(clicked(bool)), this, SLOT(stateChanged(bool)));
- return m_action;
+ QPushButton* m_action = new QPushButton(controller());
+ m_action->setIcon(icon());
+ m_action->setIconSize(QSize(32,32));
+ m_action->setToolTip(name());
+ m_action->setCheckable(true);
+ connect(controller()->countdown(), SIGNAL(finished()), SLOT(keepTaking()));
+ connect(m_action, SIGNAL(clicked(bool)), this, SLOT(stateChanged(bool)));
+ return m_action;
}
void BurstShootMode::stateChanged(bool pressed)
{
- mWorking=pressed;
- keepTaking();
+ mWorking=pressed;
+ keepTaking();
}
void BurstShootMode::keepTaking()
{
- if(mWorking)
- controller()->startCountdown(1000);
+ if(mWorking) {
+ controller()->startCountdown(1000);
+ }
}
QIcon BurstShootMode::icon() const
{
- return KIcon("code-block");
+ return KIcon("code-block");
}
QString BurstShootMode::name() const
{
- return i18n("Take pictures");
+ return i18n("Take pictures");
}
QStringList BurstShootMode::thumbnailsViewMimeTypes() const
{
- return QStringList() << "image/png";
+ return QStringList() << "image/png";
}
diff --git a/src/burstshootmode.h b/src/burstshootmode.h
index 7d014a7..02742fb 100644
--- a/src/burstshootmode.h
+++ b/src/burstshootmode.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -26,22 +26,22 @@
class BurstShootMode : public ShootMode
{
- Q_OBJECT
- public:
- BurstShootMode(Kamoso* camera);
- virtual void deactivate();
- virtual QList<QAction*> actions() { return QList<QAction*>(); }
- virtual QWidget* mainAction();
- virtual QIcon icon() const;
- virtual QString name() const;
- virtual QStringList thumbnailsViewMimeTypes() const;
+ Q_OBJECT
+ public:
+ BurstShootMode(Kamoso* camera);
+ virtual void deactivate();
+ virtual QList<QAction*> actions() { return QList<QAction*>(); }
+ virtual QWidget* mainAction();
+ virtual QIcon icon() const;
+ virtual QString name() const;
+ virtual QStringList thumbnailsViewMimeTypes() const;
- private slots:
- void stateChanged(bool);
- void keepTaking();
-
- private:
- bool mWorking;
+ private slots:
+ void stateChanged(bool);
+ void keepTaking();
+
+ private:
+ bool mWorking;
};
#endif // BURSTSHOOTMODE_H
diff --git a/src/countdownwidget.cpp b/src/countdownwidget.cpp
index d781934..411c7c8 100644
--- a/src/countdownwidget.cpp
+++ b/src/countdownwidget.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -28,65 +28,65 @@ static const int numberOfColours=3;
static const QColor colors[numberOfColours]={ Qt::red, Qt::yellow, Qt::green };
CountdownWidget::CountdownWidget(QWidget* parent)
- : QWidget(parent)
+ : QWidget(parent)
{
- mTimer=new QTimeLine(1, this);
- connect(mTimer, SIGNAL(valueChanged(qreal)), SLOT(tick(qreal)));
- connect(mTimer, SIGNAL(finished()), this, SLOT(hide()));
- connect(mTimer, SIGNAL(finished()), this, SIGNAL(finished()));
-
- mTimer->setCurveShape(QTimeLine::EaseInCurve);
+ mTimer=new QTimeLine(1, this);
+ connect(mTimer, SIGNAL(valueChanged(qreal)), SLOT(tick(qreal)));
+ connect(mTimer, SIGNAL(finished()), this, SLOT(hide()));
+ connect(mTimer, SIGNAL(finished()), this, SIGNAL(finished()));
+
+ mTimer->setCurveShape(QTimeLine::EaseInCurve);
}
void CountdownWidget::start(int timeInterval)
{
- mTimer->setDuration(timeInterval);
- mTimer->start();
+ mTimer->setDuration(timeInterval);
+ mTimer->start();
}
void CountdownWidget::tick(qreal progress)
{
- mProgress=progress;
- repaint();
+ mProgress=progress;
+ repaint();
}
void CountdownWidget::hideEvent(QHideEvent* )
{
- mTimer->stop();
- mTimer->setCurrentTime(0);
+ mTimer->stop();
+ mTimer->setCurrentTime(0);
}
void CountdownWidget::paintEvent(QPaintEvent* )
{
- QPainter painter(this);
- painter.setRenderHint(QPainter::Antialiasing);
-
- const int margin=5;
- int rad=height()/2-margin;
- int dist=(width()-rad*numberOfColours)/(numberOfColours-1);
-
- int current=int(mProgress*numberOfColours);
-
- for(int i=0; i<numberOfColours; i++) {
- QColor color=colors[i];
- if(i>=current)
- color=color.dark(125);
-
- QPointF tl(margin+dist*i+rad, margin+height()/2);
-
- painter.setPen(color);
- painter.setBrush(color);
- painter.drawEllipse(tl, rad, rad);
-
- if(current==i) {
- QColor color=colors[i];
- painter.setPen(color);
- painter.setBrush(color);
-
- double progUnit=1./numberOfColours;
- double prog=(mProgress-i*progUnit)/progUnit;
-
- painter.drawEllipse(tl, rad*prog, rad*prog);
- }
- }
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+
+ const int margin=5;
+ int rad=height()/2-margin;
+ int dist=(width()-rad*numberOfColours)/(numberOfColours-1);
+
+ int current=int(mProgress*numberOfColours);
+
+ for(int i=0; i<numberOfColours; i++) {
+ QColor color=colors[i];
+ if(i>=current)
+ color=color.dark(125);
+
+ QPointF tl(margin+dist*i+rad, margin+height()/2);
+
+ painter.setPen(color);
+ painter.setBrush(color);
+ painter.drawEllipse(tl, rad, rad);
+
+ if(current==i) {
+ QColor color=colors[i];
+ painter.setPen(color);
+ painter.setBrush(color);
+
+ double progUnit=1./numberOfColours;
+ double prog=(mProgress-i*progUnit)/progUnit;
+
+ painter.drawEllipse(tl, rad*prog, rad*prog);
+ }
+ }
}
diff --git a/src/countdownwidget.h b/src/countdownwidget.h
index 1278f3e..9ed0f5e 100644
--- a/src/countdownwidget.h
+++ b/src/countdownwidget.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -25,26 +25,26 @@
class QTimeLine;
class CountdownWidget : public QWidget
{
- Q_OBJECT
- public:
- CountdownWidget(QWidget* parent=0);
-
- QSize sizeHint() const { return QSize(100,100); }
-
- virtual void paintEvent (QPaintEvent*);
- virtual void hideEvent(QHideEvent* );
-
- void start(int timeInterval);
-
- private slots:
- void tick(qreal progress);
-
- signals:
- void finished();
-
- private:
- qreal mProgress;
- QTimeLine* mTimer;
+Q_OBJECT
+ public:
+ CountdownWidget(QWidget* parent=0);
+
+ QSize sizeHint() const { return QSize(100,100); }
+
+ virtual void paintEvent (QPaintEvent*);
+ virtual void hideEvent(QHideEvent* );
+
+ void start(int timeInterval);
+
+ private Q_SLOTS:
+ void tick(qreal progress);
+
+ Q_SIGNALS:
+ void finished();
+
+ private:
+ qreal mProgress;
+ QTimeLine* mTimer;
};
-#endif // COUNTDOWNWIDGET_H
+#endif // COUNTDOWNWIDGET_H
\ No newline at end of file
diff --git a/src/customDelegate.cpp b/src/customDelegate.cpp
index 7532b4b..affcd8e 100644
--- a/src/customDelegate.cpp
+++ b/src/customDelegate.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -29,10 +29,11 @@ KIcon CustomDelegate::m_unavailable;
QColor shadowColor(100, 100, 100);
CustomDelegate::CustomDelegate(const QHash< KUrl, QPixmap >& repo, QWidget* parent)
- : QItemDelegate(parent), m_repo(repo)
+ : QItemDelegate(parent), m_repo(repo)
{
- if(m_unavailable.isNull())
- m_unavailable=KIcon("image-missing");
+ if(m_unavailable.isNull()) {
+ m_unavailable=KIcon("image-missing");
+ }
}
CustomDelegate::~CustomDelegate()
@@ -40,89 +41,89 @@ CustomDelegate::~CustomDelegate()
void CustomDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, \
const QModelIndex &index) const {
- const QRect& rect = option.rect;
-
- QStyleOptionViewItemV4 opt(option);
- QStyle *style = opt.widget->style();
-
- KFileItem file = qvariant_cast<KFileItem>(index.data(KDirModel::FileItemRole));
- KUrl url = file.url();
-
- style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
- QList<QIcon> icons = m_overlays.value(url);
-
- const int overlayperline = 5;
- int space = qMin(rect.width(), rect.height());
- int extent = space/overlayperline, lines=icons.size()/overlayperline+1;
-
- if(m_repo.contains(url))
- {
- QSize s= m_repo[url].size();
- if(!icons.isEmpty())
- s.scale(s.width(), s.height()-extent, Qt::KeepAspectRatio);
- QPoint topleft(rect.topLeft().x()+(rect.width()-s.width())/2,
- rect.topLeft().y()+(rect.height()-s.height())/2);
- if(!icons.isEmpty())
- topleft.ry() -= extent;
-
- QPainterPath path(topleft);
- path.lineTo(QPoint(s.width() + rect.left(), topleft.y()));
- path.quadTo(QPoint(s.width()/4 + rect.left(), s.height()/4 + topleft.y()),
- QPoint(topleft.x(), s.height() + topleft.y()));
- path.lineTo(topleft);
-
- QRect pixRect(topleft, s);
- pixRect.adjust(3,3, -7,-7);
- QRect shadowRect=pixRect;
- shadowRect.translate(3,3);
- painter->setBrush(shadowColor);
- painter->drawRect(shadowRect);
- painter->drawPixmap(pixRect, m_repo[url]);
- painter->setRenderHint(QPainter::Antialiasing);
- painter->fillPath(path, QColor(255, 255, 255, 25));
- }
- else
- {
- emit pixmapNeeded(file, index, rect);
-
- QPixmap pix = m_unavailable.pixmap(qMin(rect.width(), rect.height()));
- QSize s=pix.size();
- QPoint topleft(rect.topLeft().x()+(rect.width()-s.width())/2,
- rect.topLeft().y()+(rect.height()-s.height())/2);
- painter->drawPixmap(QRect(topleft, s), pix);
- }
-
- if(option.showDecorationSelected)
- {
- painter->setBrush(Qt::red);
- painter->drawRect(rect);
- }
-
- if(!icons.isEmpty()) {
- int count=0, margin=(space-(extent*overlayperline))/2;
-
- foreach(const QIcon& icon, icons) {
- QPixmap pix = icon.pixmap(extent);
- QPoint tl = rect.bottomLeft() - QPoint(0,extent);
- tl.rx() += (count%overlayperline) * extent;
-// tl.ry() += (count/overlayperline)*pix.height();
- if(count/overlayperline>=1)
- break;
-
- painter->drawPixmap(tl, pix);
-
- count++;
- }
- }
+ const QRect& rect = option.rect;
+
+ QStyleOptionViewItemV4 opt(option);
+ QStyle *style = opt.widget->style();
+
+ KFileItem file = qvariant_cast<KFileItem>(index.data(KDirModel::FileItemRole));
+ KUrl url = file.url();
+
+ style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
+ QList<QIcon> icons = m_overlays.value(url);
+
+ const int overlayperline = 5;
+ int space = qMin(rect.width(), rect.height());
+ int extent = space/overlayperline, lines=icons.size()/overlayperline+1;
+
+ if(m_repo.contains(url))
+ {
+ QSize s= m_repo[url].size();
+ if(!icons.isEmpty())
+ s.scale(s.width(), s.height()-extent, Qt::KeepAspectRatio);
+ QPoint topleft(rect.topLeft().x()+(rect.width()-s.width())/2,
+ rect.topLeft().y()+(rect.height()-s.height())/2);
+ if(!icons.isEmpty())
+ topleft.ry() -= extent;
+
+ QPainterPath path(topleft);
+ path.lineTo(QPoint(s.width() + rect.left(), topleft.y()));
+ path.quadTo(QPoint(s.width()/4 + rect.left(), s.height()/4 + topleft.y()),
+ QPoint(topleft.x(), s.height() + topleft.y()));
+ path.lineTo(topleft);
+
+ QRect pixRect(topleft, s);
+ pixRect.adjust(3,3, -7,-7);
+ QRect shadowRect=pixRect;
+ shadowRect.translate(3,3);
+ painter->setBrush(shadowColor);
+ painter->drawRect(shadowRect);
+ painter->drawPixmap(pixRect, m_repo[url]);
+ painter->setRenderHint(QPainter::Antialiasing);
+ painter->fillPath(path, QColor(255, 255, 255, 25));
+ }
+ else
+ {
+ emit pixmapNeeded(file, index, rect);
+
+ QPixmap pix = m_unavailable.pixmap(qMin(rect.width(), rect.height()));
+ QSize s=pix.size();
+ QPoint topleft(rect.topLeft().x()+(rect.width()-s.width())/2,
+ rect.topLeft().y()+(rect.height()-s.height())/2);
+ painter->drawPixmap(QRect(topleft, s), pix);
+ }
+
+ if(option.showDecorationSelected)
+ {
+ painter->setBrush(Qt::red);
+ painter->drawRect(rect);
+ }
+
+ if(!icons.isEmpty()) {
+ int count=0, margin=(space-(extent*overlayperline))/2;
+
+ foreach(const QIcon& icon, icons) {
+ QPixmap pix = icon.pixmap(extent);
+ QPoint tl = rect.bottomLeft() - QPoint(0,extent);
+ tl.rx() += (count%overlayperline) * extent;
+ // tl.ry() += (count/overlayperline)*pix.height();
+ if(count/overlayperline>=1)
+ break;
+
+ painter->drawPixmap(tl, pix);
+
+ count++;
+ }
+ }
}
QSize CustomDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex \
&index) const {
- Q_UNUSED(option); Q_UNUSED(index);
- return QSize(100, 125);
+ Q_UNUSED(option); Q_UNUSED(index);
+ return QSize(100, 125);
}
void CustomDelegate::setOverlays(const KUrl& url, const QList< QIcon >& icons)
{
- m_overlays.insert(url, icons);
+ m_overlays.insert(url, icons);
}
diff --git a/src/customDelegate.h b/src/customDelegate.h
index dffeeb4..e7f5313 100644
--- a/src/customDelegate.h
+++ b/src/customDelegate.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -30,21 +30,21 @@ class KFileItem;
class CustomDelegate : public QItemDelegate
{
- Q_OBJECT
- public:
- CustomDelegate(const QHash<KUrl, QPixmap>& repo, QWidget *parent = 0);
- ~CustomDelegate();
- void paint(QPainter *painter, const QStyleOptionViewItem &option,const QModelIndex \
&index) const;
- QSize sizeHint(const QStyleOptionViewItem &option,const QModelIndex &index) const;
- void setOverlays(const KUrl& url, const QList< QIcon >& icons);
-
- signals:
- void pixmapNeeded(const KFileItem& it, const QModelIndex& idx, const QRect&) \
const;
-
- private:
- const QHash<KUrl, QPixmap>& m_repo;
- QHash<KUrl, QList<QIcon> > m_overlays;
- static KIcon m_unavailable;
+Q_OBJECT
+ public:
+ CustomDelegate(const QHash<KUrl, QPixmap>& repo, QWidget *parent = 0);
+ ~CustomDelegate();
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,const \
QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem \
&option,const QModelIndex &index) const; + void setOverlays(const KUrl& url, \
const QList< QIcon >& icons); +
+ Q_SIGNALS:
+ void pixmapNeeded(const KFileItem& it, const QModelIndex& idx, const QRect&) \
const; +
+ private:
+ const QHash<KUrl, QPixmap>& m_repo;
+ QHash<KUrl, QList<QIcon> > m_overlays;
+ static KIcon m_unavailable;
};
#endif
diff --git a/src/device.cpp b/src/device.cpp
index 016154a..debbcdd 100644
--- a/src/device.cpp
+++ b/src/device.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -27,25 +27,24 @@ Device::Device()
Device::Device(const Solid::Device *device)
{
- m_udi = device->udi();
- m_description = device->product();
-
- const Solid::Video *solidVideoDevice = device->as<Solid::Video>();
- if (solidVideoDevice)
- {
- QStringList protocols = solidVideoDevice->supportedProtocols();
- if ( protocols.contains( "video4linux" ) )
- {
- QStringList drivers = solidVideoDevice->supportedDrivers( "video4linux" );
- if ( drivers.contains( "video4linux" ) )
- {
- m_path = solidVideoDevice->driverHandle( "video4linux" ).toString();
- }
- }
- }
-
-
- config = new KConfig("kamosoDevices");
+ m_udi = device->udi();
+ m_description = device->product();
+
+ const Solid::Video *solidVideoDevice = device->as<Solid::Video>();
+ if (solidVideoDevice)
+ {
+ QStringList protocols = solidVideoDevice->supportedProtocols();
+ if ( protocols.contains( "video4linux" ) )
+ {
+ QStringList drivers = solidVideoDevice->supportedDrivers( "video4linux" \
); + if ( drivers.contains( "video4linux" ) )
+ {
+ m_path = solidVideoDevice->driverHandle( "video4linux" ).toString();
+ }
+ }
+ }
+
+ config = new KConfig("kamosoDevices");
}
Device::~Device()
@@ -53,80 +52,80 @@ Device::~Device()
QString Device::path() const
{
- return m_path;
+ return m_path;
}
QString Device::description() const
{
- return m_description;
+ return m_description;
}
QString Device::udi() const
{
- return m_udi;
+ return m_udi;
}
QString Device::vendor() const
{
- return m_vendor;
+ return m_vendor;
}
void Device::setBrightness(int level)
{
- qDebug() << "New brightness " << level;
- config->group(m_udi).writeEntry("brightness",level);
- config->sync();
+ qDebug() << "New brightness " << level;
+ config->group(m_udi).writeEntry("brightness",level);
+ config->sync();
}
void Device::setContrast(int level)
{
- qDebug() << "New contrast " << level;
- config->group(m_udi).writeEntry("contrast",level);
- config->sync();
+ qDebug() << "New contrast " << level;
+ config->group(m_udi).writeEntry("contrast",level);
+ config->sync();
}
void Device::setSaturation(int level)
{
- qDebug() << "New saturation " << level;
- config->group(m_udi).writeEntry("saturation",level);
- config->sync();
+ qDebug() << "New saturation " << level;
+ config->group(m_udi).writeEntry("saturation",level);
+ config->sync();
}
void Device::setGamma(int level)
{
- qDebug() << "new gamma" << level;
- config->group(m_udi).writeEntry("gamma",level);
- config->sync();
+ qDebug() << "new gamma" << level;
+ config->group(m_udi).writeEntry("gamma",level);
+ config->sync();
}
void Device::setHue(int level)
{
- qDebug() << "new hue" << level;
- config->group(m_udi).writeEntry("hue",level);
- config->sync();
+ qDebug() << "new hue" << level;
+ config->group(m_udi).writeEntry("hue",level);
+ config->sync();
}
int Device::brightness() const
{
- return config->group(m_udi).readEntry("brightness",100);
+ return config->group(m_udi).readEntry("brightness",100);
}
int Device::contrast() const
{
- return config->group(m_udi).readEntry("contrast",100);
+ return config->group(m_udi).readEntry("contrast",100);
}
int Device::saturation() const
{
- return config->group(m_udi).readEntry("saturation",100);
+ return config->group(m_udi).readEntry("saturation",100);
}
int Device::gamma() const
{
- return config->group(m_udi).readEntry("gamma",100);
+ return config->group(m_udi).readEntry("gamma",100);
}
int Device::hue() const
{
- return config->group(m_udi).readEntry("hue",0);
+ return config->group(m_udi).readEntry("hue",0);
}
diff --git a/src/device.h b/src/device.h
index 9051a37..623583b 100644
--- a/src/device.h
+++ b/src/device.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -25,31 +25,31 @@
class Device
{
- public:
- Device();
- Device(const Solid::Device*);
- ~Device();
- QString description() const;
- QString udi() const;
- QString path() const;
- QString vendor() const;
+ public:
+ Device();
+ Device(const Solid::Device*);
+ ~Device();
+ QString description() const;
+ QString udi() const;
+ QString path() const;
+ QString vendor() const;
void setBrightness(int level);
- void setContrast(int level);
- void setSaturation(int level);
- void setGamma(int level);
- void setHue(int level);
- int brightness() const;
- int contrast() const;
- int saturation() const;
- int gamma() const;
- int hue() const;
- private:
- QString queryv4lInfo();
- QString m_description;
- QString m_udi;
- QString m_path;
- QString m_vendor;
- KConfig* config;
+ void setContrast(int level);
+ void setSaturation(int level);
+ void setGamma(int level);
+ void setHue(int level);
+ int brightness() const;
+ int contrast() const;
+ int saturation() const;
+ int gamma() const;
+ int hue() const;
+ private:
+ QString queryv4lInfo();
+ QString m_description;
+ QString m_udi;
+ QString m_path;
+ QString m_vendor;
+ KConfig* config;
};
-#endif
\ No newline at end of file
+#endif //DEVICE_H
\ No newline at end of file
diff --git a/src/devicemanager.cpp b/src/devicemanager.cpp
index 275ab4d..426059d 100644
--- a/src/devicemanager.cpp
+++ b/src/devicemanager.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -30,17 +30,15 @@ DeviceManager *DeviceManager::s_instance = NULL;
DeviceManager::DeviceManager()
{
- //Checking current connected devices
- foreach (Solid::Device device,
- Solid::Device::listFromType(Solid::DeviceInterface::Video, QString())) {
- addDevice(device);
- }
- //Connect to solid events to get new devices.
-
- connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(const QString&)), \
SLOT(deviceAdded(const QString &)) );
- connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(const QString&)), \
SLOT(deviceRemoved(const QString &)) );
-
-// m_playingUdi = NULL;
+ //Checking current connected devices
+ foreach (Solid::Device device,
+ Solid::Device::listFromType(Solid::DeviceInterface::Video, QString())) {
+ addDevice(device);
+ }
+
+ //Connect to solid events to get new devices.
+ connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(const QString&)), \
SLOT(deviceAdded(const QString &)) ); + connect(Solid::DeviceNotifier::instance(), \
SIGNAL(deviceRemoved(const QString&)), SLOT(deviceRemoved(const QString &)) ); }
/*
@@ -48,42 +46,42 @@ DeviceManager::DeviceManager()
*/
QList<Device> DeviceManager::devices() const
{
- return m_deviceList;
+ return m_deviceList;
}
int DeviceManager::numberOfDevices() const
{
- return m_deviceList.size();
+ return m_deviceList.size();
}
Device& DeviceManager::defaultDevice()
{
- return m_deviceList.first();
+ return m_deviceList.first();
}
QString DeviceManager::defaultDevicePath() const
{
- return m_deviceList.first().path();
+ return m_deviceList.first().path();
}
QString DeviceManager::defaultDeviceUdi() const
{
- return m_deviceList.first().udi();
+ return m_deviceList.first().udi();
}
Device& DeviceManager::playingDevice()
{
- return m_playingDevice;
+ return m_playingDevice;
}
QString DeviceManager::playingDeviceUdi() const
{
- return m_playingUdi;
+ return m_playingUdi;
}
QString DeviceManager::playingDevicePath() const
{
- return m_playingPath;
+ return m_playingPath;
}
/*
@@ -91,20 +89,20 @@ QString DeviceManager::playingDevicePath() const
*/
void DeviceManager::addDevice(const Solid::Device& device)
{
- m_deviceList.append(Device(&device));
+ m_deviceList.append(Device(&device));
}
void DeviceManager::removeDevice(const Solid::Device& device)
{
- QList <Device> ::iterator i;
- for(i=m_deviceList.begin();i!=m_deviceList.end();++i)
- {
- if(i->udi() == device.udi())
- {
- m_deviceList.erase(i);
- break;
- }
- }
+ QList <Device> ::iterator i;
+ for(i = m_deviceList.begin(); i != m_deviceList.end(); ++i)
+ {
+ if(i->udi() == device.udi())
+ {
+ m_deviceList.erase(i);
+ break;
+ }
+ }
}
/*
@@ -112,45 +110,45 @@ void DeviceManager::removeDevice(const Solid::Device& device)
*/
void DeviceManager::deviceRemoved(const QString &udi)
{
- QList <Device> ::iterator i;
- for(i=m_deviceList.begin();i!=m_deviceList.end();++i)
- {
- if(i->udi() == udi)
- {
- m_deviceList.erase(i);
- emit deviceUnregistered(udi);
- break;
- }
- }
+ QList <Device> ::iterator i;
+ for(i=m_deviceList.begin();i!=m_deviceList.end();++i)
+ {
+ if(i->udi() == udi)
+ {
+ m_deviceList.erase(i);
+ emit deviceUnregistered(udi);
+ break;
+ }
+ }
}
void DeviceManager::deviceAdded(const QString &udi)
{
- Solid::Device device( udi );
- if(device.is<Solid::Video>())
- {
- addDevice(device);
- emit deviceRegistered(udi);
- }
+ Solid::Device device( udi );
+ if(device.is<Solid::Video>())
+ {
+ addDevice(device);
+ emit deviceRegistered(udi);
+ }
}
void DeviceManager::webcamPlaying(const QString &udi)
{
- Device device;
- foreach(device,m_deviceList) {
- qDebug() << device.udi();
- if(device.udi() == udi) {
- m_playingDevice = device;
- m_playingUdi = udi;
- m_playingPath = m_playingDevice.path();
- break;
- }
- }
+ Device device;
+ foreach(device,m_deviceList) {
+ qDebug() << device.udi();
+ if(device.udi() == udi) {
+ m_playingDevice = device;
+ m_playingUdi = udi;
+ m_playingPath = m_playingDevice.path();
+ break;
+ }
+ }
}
bool DeviceManager::hasDevices() const
{
- return !m_deviceList.isEmpty();
+ return !m_deviceList.isEmpty();
}
/*
@@ -158,9 +156,9 @@ bool DeviceManager::hasDevices() const
*/
DeviceManager* DeviceManager::self()
{
- if(s_instance == NULL)
- {
- s_instance = new DeviceManager();
- }
- return s_instance;
+ if(s_instance == NULL)
+ {
+ s_instance = new DeviceManager();
+ }
+ return s_instance;
}
\ No newline at end of file
diff --git a/src/devicemanager.h b/src/devicemanager.h
index 1c4bd41..b396812 100644
--- a/src/devicemanager.h
+++ b/src/devicemanager.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -26,39 +26,39 @@
class DeviceManager : public QObject
{
Q_OBJECT
-public:
- static DeviceManager* self();
- int numberOfDevices() const;
- QList<Device> devices() const;
- Device& defaultDevice();
- QString defaultDevicePath() const;
- QString defaultDeviceUdi() const;
+ public:
+ static DeviceManager* self();
+ int numberOfDevices() const;
+ QList<Device> devices() const;
+ Device& defaultDevice();
+ QString defaultDevicePath() const;
+ QString defaultDeviceUdi() const;
+
+ Device& playingDevice();
+ QString playingDeviceUdi() const;
+ QString playingDevicePath() const;
+ bool hasDevices() const;
+
+public Q_SLOTS:
+ void webcamPlaying(const QString &udi);
+
+private Q_SLOTS:
+ void deviceAdded(const QString &udi);
+ void deviceRemoved(const QString &udi);
+
+Q_SIGNALS:
+ void deviceRegistered( const QString & udi );
+ void deviceUnregistered( const QString & udi );
- Device& playingDevice();
- QString playingDeviceUdi() const;
- QString playingDevicePath() const;
- bool hasDevices() const;
-
-public slots:
- void webcamPlaying(const QString &udi);
-
-private slots:
- void deviceAdded(const QString &udi);
- void deviceRemoved(const QString &udi);
-
-signals:
- void deviceRegistered( const QString & udi );
- void deviceUnregistered( const QString & udi );
-
private:
- DeviceManager();
- static DeviceManager* s_instance;
- void addDevice(const Solid::Device& device);
- void removeDevice(const Solid::Device& device);
- QList<Device> m_deviceList;
- Device m_playingDevice;
- QString m_playingUdi;
- QString m_playingPath;
+ DeviceManager();
+ static DeviceManager* s_instance;
+ void addDevice(const Solid::Device& device);
+ void removeDevice(const Solid::Device& device);
+ QList<Device> m_deviceList;
+ Device m_playingDevice;
+ QString m_playingUdi;
+ QString m_playingPath;
};
#endif // DEVICEMANAGER_H
diff --git a/src/infoshared.cpp b/src/infoshared.cpp
index 2564a2d..1fe2a2e 100644
--- a/src/infoshared.cpp
+++ b/src/infoshared.cpp
@@ -1,28 +1,29 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#include "infoshared.h"
InfoShared::InfoShared(KIPIInterface* interface, const KUrl& url) : \
KIPI::ImageInfoShared(interface,url) {
-
+
}
+
void InfoShared::delAttributes(const QStringList& )
{
@@ -40,7 +41,7 @@ void InfoShared::clearAttributes()
QMap< QString, QVariant > InfoShared::attributes()
{
- return QMap<QString,QVariant>();
+ return QMap<QString,QVariant>();
}
void InfoShared::setDescription(const QString& )
@@ -50,6 +51,6 @@ void InfoShared::setDescription(const QString& )
QString InfoShared::description()
{
- return "Took with kamoso";
+ return "Took with kamoso";
}
diff --git a/src/infoshared.h b/src/infoshared.h
index d4cd250..0cc6e84 100644
--- a/src/infoshared.h
+++ b/src/infoshared.h
@@ -1,33 +1,32 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#ifndef INFOSHARED_H
#define INFOSHARED_H
#include <libkipi/imageinfoshared.h>
#include "kipiinterface.h"
-// #include <>
class InfoShared : public KIPI::ImageInfoShared
{
public:
- InfoShared(KIPIInterface* interface, const KUrl& url);
+ InfoShared(KIPIInterface* interface, const KUrl& url);
virtual void delAttributes(const QStringList& );
virtual void addAttributes(const QMap< QString, QVariant >& );
virtual void clearAttributes();
diff --git a/src/kamoso.cpp b/src/kamoso.cpp
index 149e7be..04e3e94 100644
--- a/src/kamoso.cpp
+++ b/src/kamoso.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -73,214 +73,212 @@ const int max_exponential_value = 50;
const int exponential_increment = 5;
Kamoso::Kamoso(QWidget* parent)
- : KMainWindow(parent), m_activeMode(0), m_flashEnabled(true)
+ : KMainWindow(parent), m_activeMode(0), m_flashEnabled(true)
{
- dirModel = new KDirModel(this);
-
- m_countdown = new CountdownWidget(this);
- m_countdown->hide();
+ dirModel = new KDirModel(this);
- deviceManager = DeviceManager::self();
- connect(deviceManager,SIGNAL(deviceRegistered(QString)),SLOT(webcamAdded()));
- connect(deviceManager,SIGNAL(deviceUnregistered(QString)),SLOT(webcamRemoved()));
-
- mainWidgetUi = new Ui::mainWidget;
- mainWidget = new QWidget(this);
- mainWidgetUi->setupUi(mainWidget);
-
- //We've to investigate if is better call start before do the UI stuff
- bool comboShown=deviceManager->numberOfDevices() > 1;
- mainWidgetUi->chooseWebcamLbl->setVisible(comboShown);
- mainWidgetUi->webcamCombo->setVisible(comboShown);
-
- connect(this,SIGNAL(webcamPlaying(const \
QString&)),deviceManager,SLOT(webcamPlaying(const QString&))); + m_countdown = new \
CountdownWidget(this); + m_countdown->hide();
+
+ deviceManager = DeviceManager::self();
+ connect(deviceManager,SIGNAL(deviceRegistered(QString)),SLOT(webcamAdded()));
+ connect(deviceManager,SIGNAL(deviceUnregistered(QString)),SLOT(webcamRemoved()));
+
+ mainWidgetUi = new Ui::mainWidget;
+ mainWidget = new QWidget(this);
+ mainWidgetUi->setupUi(mainWidget);
+
+ //We've to investigate if is better call start before do the UI stuff
+ bool comboShown=deviceManager->numberOfDevices() > 1;
+ mainWidgetUi->chooseWebcamLbl->setVisible(comboShown);
+ mainWidgetUi->webcamCombo->setVisible(comboShown);
+
+ connect(this,SIGNAL(webcamPlaying(const \
QString&)),deviceManager,SLOT(webcamPlaying(const QString&))); //First row Stuff, at \
the moment only webcam is placed here
- //Setting webcam in the first row, central spot
-
- m_webcam = WebcamWidget::createInstance(this);
- m_webcam->setParent(mainWidgetUi->centralSpot);
- m_webcam->setMinimumSize(640,480);
- if(deviceManager->hasDevices()) {
- m_webcam->playFile(deviceManager->defaultDevice());
- emit webcamPlaying(deviceManager->defaultDeviceUdi());
- } //TODO: else we should warn the user
-// connect(webcam, SIGNAL(photoTaken(KUrl)), SLOT(photoTaken(KUrl)));
-
- reloadDevicesCombo();
- connect(mainWidgetUi->webcamCombo,SIGNAL(currentIndexChanged(int)),SLOT(webcamChanged(int)));
-
-
+//Setting webcam in the first row, central spot
+
+ m_webcam = WebcamWidget::createInstance(this);
+ m_webcam->setParent(mainWidgetUi->centralSpot);
+ m_webcam->setMinimumSize(640,480);
+ if(deviceManager->hasDevices()) {
+ m_webcam->playFile(deviceManager->defaultDevice());
+ emit webcamPlaying(deviceManager->defaultDeviceUdi());
+ }
+
+ reloadDevicesCombo();
+ connect(mainWidgetUi->webcamCombo,SIGNAL(currentIndexChanged(int)),SLOT(webcamChanged(int)));
+
//Second row Stuff
- m_modes.append(new PhotoShootMode(this));
- m_modes.append(new BurstShootMode(this));
- m_modes.append(new VideoShootMode(this));
-
- QHBoxLayout *modesLayout = new QHBoxLayout(mainWidgetUi->modes);
-
- foreach(ShootMode* mode, m_modes) {
- m_modesRadio += new QPushButton(mainWidgetUi->modes);
- m_modesRadio.last()->setIcon(mode->icon());
- m_modesRadio.last()->setIconSize(QSize(20,20));
- m_modesRadio.last()->setCheckable(true);
- m_modesRadio.last()->setAutoExclusive(true);
- m_modesRadio.last()->setToolTip(mode->name());
- modesLayout->addWidget(m_modesRadio.last());
-
- connect(m_modesRadio.last(), SIGNAL(clicked(bool)), SLOT(changeMode(bool)));
- }
- m_modesRadio.first()->setChecked(true);
- changeMode(true);
-
- mainWidgetUi->exportFiles->setIcon(KIcon("document-export"));
- connect(mainWidgetUi->exportFiles, SIGNAL(clicked(bool)), SLOT(exportMenu(bool)));
-
- mainWidgetUi->configure->setIcon(KIcon("configure"));
- connect(mainWidgetUi->configure, SIGNAL(clicked(bool)), SLOT(settingsMenu(bool)));
-
- //Third row
- //Dir operator will show the previews
- mainWidgetUi->thumbnailView->setModel(dirModel);
- mainWidgetUi->thumbnailView->assignDelegate();
- connect(mainWidgetUi->thumbnailView, SIGNAL(doubleClicked(QModelIndex)),
- SLOT(openFile()));
- connect(mainWidgetUi->thumbnailView->model(), SIGNAL(rowsInserted(QModelIndex, int, \
int)),
- SLOT(thumbnailAdded()));
- connect(mainWidgetUi->thumbnailView->horizontalScrollBar(), \
SIGNAL(valueChanged(int)), SLOT(thumbnailViewMoved(int)));
- mainWidgetUi->thirdRow->insertWidget(1, mainWidgetUi->thumbnailView);
- connect(mainWidgetUi->thumbnailView->selectionModel(), \
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- SLOT(fileViewSelectionChanged(QItemSelection,QItemSelection)));
-
- //Arrows
- mainWidgetUi->scrollLeft->setIcon(KIcon("arrow-left"));
- mainWidgetUi->scrollRight->setIcon(KIcon("arrow-right"));
- mainWidgetUi->scrollLeft->setText(QString());
- mainWidgetUi->scrollRight->setText(QString());
- connect(mainWidgetUi->scrollLeft, SIGNAL(clicked(bool)), SLOT(slotScrollLeft()));
- connect(mainWidgetUi->scrollRight, SIGNAL(clicked(bool)), SLOT(slotScrollRight()));
-
- whiteWidgetManager = new WhiteWidgetManager(this);
- mainWidgetUi->thirdRow->addWidget(m_countdown);
-
- connect(m_countdown, SIGNAL(finished()), SLOT(takePhoto()));
- const KUrl soundFile = KStandardDirs::locate("sound", "KDE-Im-User-Auth.ogg");
- player = Phonon::createPlayer(Phonon::NotificationCategory);
- player->setCurrentSource(soundFile);
-
- //TODO: find a better place to init this
- m_exponentialValue = 0;
- this->setCentralWidget(mainWidget);
-
- mTracker=new KamosoJobTracker(statusBar());
- connect(mTracker, SIGNAL(jobClicked(KJob*, KUrl::List)), SLOT(selectJob(KJob*, \
KUrl::List)));
- statusBar()->addWidget(mTracker);
-
- connect(mTracker, SIGNAL(urlsChanged(KUrl::List)), \
SLOT(updateThumbnails(KUrl::List)));
-
- QMetaObject::invokeMethod(this, "initialize");
- mPluginLoader = new KIPI::PluginLoader(QStringList(), new KIPIInterface(this), "");
+ m_modes.append(new PhotoShootMode(this));
+ m_modes.append(new BurstShootMode(this));
+ m_modes.append(new VideoShootMode(this));
+
+ QHBoxLayout *modesLayout = new QHBoxLayout(mainWidgetUi->modes);
+
+ foreach(ShootMode* mode, m_modes) {
+ m_modesRadio += new QPushButton(mainWidgetUi->modes);
+ m_modesRadio.last()->setIcon(mode->icon());
+ m_modesRadio.last()->setIconSize(QSize(20,20));
+ m_modesRadio.last()->setCheckable(true);
+ m_modesRadio.last()->setAutoExclusive(true);
+ m_modesRadio.last()->setToolTip(mode->name());
+ modesLayout->addWidget(m_modesRadio.last());
+
+ connect(m_modesRadio.last(), SIGNAL(clicked(bool)), SLOT(changeMode(bool)));
+ }
+ m_modesRadio.first()->setChecked(true);
+ changeMode(true);
+
+ mainWidgetUi->exportFiles->setIcon(KIcon("document-export"));
+ connect(mainWidgetUi->exportFiles, SIGNAL(clicked(bool)), \
SLOT(exportMenu(bool))); +
+ mainWidgetUi->configure->setIcon(KIcon("configure"));
+ connect(mainWidgetUi->configure, SIGNAL(clicked(bool)), \
SLOT(settingsMenu(bool))); +
+//Third row
+ //Dir operator will show the previews
+ mainWidgetUi->thumbnailView->setModel(dirModel);
+ mainWidgetUi->thumbnailView->assignDelegate();
+ connect(mainWidgetUi->thumbnailView, SIGNAL(doubleClicked(QModelIndex)),
+ SLOT(openFile()));
+ connect(mainWidgetUi->thumbnailView->model(), SIGNAL(rowsInserted(QModelIndex, \
int, int)), + SLOT(thumbnailAdded()));
+ connect(mainWidgetUi->thumbnailView->horizontalScrollBar(), \
SIGNAL(valueChanged(int)), SLOT(thumbnailViewMoved(int))); + \
mainWidgetUi->thirdRow->insertWidget(1, mainWidgetUi->thumbnailView); + \
connect(mainWidgetUi->thumbnailView->selectionModel(), \
SIGNAL(selectionChanged(QItemSelection,QItemSelection)), + \
SLOT(fileViewSelectionChanged(QItemSelection,QItemSelection))); + //Arrows
+ mainWidgetUi->scrollLeft->setIcon(KIcon("arrow-left"));
+ mainWidgetUi->scrollRight->setIcon(KIcon("arrow-right"));
+ mainWidgetUi->scrollLeft->setText(QString());
+ mainWidgetUi->scrollRight->setText(QString());
+ connect(mainWidgetUi->scrollLeft, SIGNAL(clicked(bool)), \
SLOT(slotScrollLeft())); + connect(mainWidgetUi->scrollRight, \
SIGNAL(clicked(bool)), SLOT(slotScrollRight())); +
+ whiteWidgetManager = new WhiteWidgetManager(this);
+ mainWidgetUi->thirdRow->addWidget(m_countdown);
+
+ connect(m_countdown, SIGNAL(finished()), SLOT(takePhoto()));
+ const KUrl soundFile = KStandardDirs::locate("sound", "KDE-Im-User-Auth.ogg");
+ player = Phonon::createPlayer(Phonon::NotificationCategory);
+ player->setCurrentSource(soundFile);
+
+ //TODO: find a better place to init this
+ m_exponentialValue = 0;
+ this->setCentralWidget(mainWidget);
+
+ mTracker=new KamosoJobTracker(statusBar());
+ connect(mTracker, SIGNAL(jobClicked(KJob*, KUrl::List)), SLOT(selectJob(KJob*, \
KUrl::List))); + statusBar()->addWidget(mTracker);
+
+ connect(mTracker, SIGNAL(urlsChanged(KUrl::List)), \
SLOT(updateThumbnails(KUrl::List))); +
+ QMetaObject::invokeMethod(this, "initialize");
+ mPluginLoader = new KIPI::PluginLoader(QStringList(), new KIPIInterface(this), \
""); }
KUrl::List Kamoso::selectedItems()
{
- KUrl::List urls;
- foreach(const QModelIndex& idx, \
mainWidgetUi->thumbnailView->selectionModel()->selectedIndexes())
- urls += dirModel->itemForIndex(idx).url();
-
- return urls;
+ KUrl::List urls;
+ foreach(const QModelIndex& idx, \
mainWidgetUi->thumbnailView->selectionModel()->selectedIndexes()) { + urls += \
dirModel->itemForIndex(idx).url(); + }
+
+ return urls;
}
void Kamoso::initialize()
{
- //Check the initial and basic config, and ask for it it doesn't exist
- checkInitConfig();
-
- qDebug() << "Settings of kamoso:";
- qDebug() << "saveUrl: " << Settings::saveUrl();
- qDebug() << "photoTime: " << Settings::photoTime();
+ //Check the initial and basic config, and ask for it it doesn't exist
+ checkInitConfig();
+
+ qDebug() << "Settings of kamoso:";
+ qDebug() << "saveUrl: " << Settings::saveUrl();
+ qDebug() << "photoTime: " << Settings::photoTime();
}
void Kamoso::webcamAdded()
{
- qDebug() << "A new webcam has been added";
-
- bool comboShown=deviceManager->numberOfDevices()>1;
-
- mainWidgetUi->chooseWebcamLbl->setVisible(comboShown);
- mainWidgetUi->webcamCombo->setVisible(comboShown);
-
- if(comboShown)
- reloadDevicesCombo();
+ qDebug() << "A new webcam has been added";
+
+ bool comboShown=deviceManager->numberOfDevices()>1;
+
+ mainWidgetUi->chooseWebcamLbl->setVisible(comboShown);
+ mainWidgetUi->webcamCombo->setVisible(comboShown);
+
+ if(comboShown) {
+ reloadDevicesCombo();
+ }
}
void Kamoso::startVideo(bool sound)
{
- m_webcam->recordVideo(sound);
+ m_webcam->recordVideo(sound);
}
void Kamoso::stopVideo()
{
- KUrl finalPath = Settings::saveUrl();
- finalPath.addPath(QString("video_1.mkv"));
+ KUrl finalPath = Settings::saveUrl();
+ finalPath.addPath(QString("video_1.mkv"));
- while(KIO::NetAccess::exists( finalPath, KIO::NetAccess::DestinationSide, this )) {
- autoincFilename(finalPath);
- }
+ while(KIO::NetAccess::exists( finalPath, KIO::NetAccess::DestinationSide, this \
)) { + autoincFilename(finalPath);
+ }
- m_webcam->stopRecording(finalPath);
- m_webcam->playFile(deviceManager->playingDevice());
+ m_webcam->stopRecording(finalPath);
+ m_webcam->playFile(deviceManager->playingDevice());
}
void Kamoso::reloadDevicesCombo()
{
- mainWidgetUi->webcamCombo->clear();
- QList <Device> devices = deviceManager->devices();
-
- foreach(const Device& d, devices)
- {
- mainWidgetUi->webcamCombo->addItem(d.description(), d.udi());
-
- //If kamoso is using this device, set it as currentIndex
- if(d.udi() == deviceManager->playingDeviceUdi()) {
- mainWidgetUi->webcamCombo->setCurrentIndex(mainWidgetUi->webcamCombo->count() \
-1);
- }
- }
-
+ mainWidgetUi->webcamCombo->clear();
+ QList <Device> devices = deviceManager->devices();
+
+ foreach(const Device& d, devices)
+ {
+ mainWidgetUi->webcamCombo->addItem(d.description(), d.udi());
+
+ //If kamoso is using this device, set it as currentIndex
+ if(d.udi() == deviceManager->playingDeviceUdi()) {
+ mainWidgetUi->webcamCombo->setCurrentIndex(mainWidgetUi->webcamCombo->count() \
-1); + }
+ }
}
void Kamoso::webcamRemoved()
{
- if(deviceManager->numberOfDevices() < 3) {
- //At the moment there are only 2 widgets to hidden, maybe a container is needed \
here.
- mainWidgetUi->chooseWebcamLbl->hide();
- mainWidgetUi->webcamCombo->hide();
- } else {
- //The combo is already shown (should be),so onlyupdate the content is required.
- reloadDevicesCombo();
- }
+ if(deviceManager->numberOfDevices() < 3) {
+ //At the moment there are only 2 widgets to hidden, maybe a container is \
needed here. + mainWidgetUi->chooseWebcamLbl->hide();
+ mainWidgetUi->webcamCombo->hide();
+ } else {
+ //The combo is already shown (should be),so onlyupdate the content is \
required. + reloadDevicesCombo();
+ }
}
void Kamoso::webcamChanged(int index)
{
- QString udi = mainWidgetUi->webcamCombo->itemData(index).toString();
- deviceManager->webcamPlaying(udi);
+ QString udi = mainWidgetUi->webcamCombo->itemData(index).toString();
+ deviceManager->webcamPlaying(udi);
- m_webcam->playFile(deviceManager->playingDevice());
+ m_webcam->playFile(deviceManager->playingDevice());
}
void Kamoso::checkInitConfig()
{
- //If kamoso doesn't know where to save the taken photos, ask for it
- if(Settings::saveUrl().isEmpty()) {
- KDirSelectDialog dirs;
- dirs.showButton(KDialog::Cancel, false);
-
- KUrl url;
- if(dirs.exec() && dirs.url().isValid())
- url=dirs.url();
- else
- url=QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
- Settings::setSaveUrl(url);
- }
- dirModel->dirLister()->openUrl(Settings::saveUrl(), KDirLister::Reload);
+ //If kamoso doesn't know where to save the taken photos, ask for it
+ if(Settings::saveUrl().isEmpty()) {
+ KDirSelectDialog dirs;
+ dirs.showButton(KDialog::Cancel, false);
+
+ KUrl url;
+ if(dirs.exec() && dirs.url().isValid())
+ url=dirs.url();
+ else
+ url=QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
+ Settings::setSaveUrl(url);
+ }
+ dirModel->dirLister()->openUrl(Settings::saveUrl(), KDirLister::Reload);
}
/**
@@ -289,66 +287,66 @@ void Kamoso::checkInitConfig()
*/
void Kamoso::configuration()
{
- //If settings dialog is already open, return (and focus)
- if(KConfigDialog::showDialog("settings")){
- return;
- }
-
- //Creating the kcm
- dialog = new WebcamDialog(this,"settings",Settings::self());
- dialog->resize(540,dialog->height());
-
- //Widget created with qt-designer
- //TODO: Check page and pagePicture leaking
- Ui::generalConfigWidget *page = new Ui::generalConfigWidget();
- QWidget *widgetPage = new QWidget();
- page->setupUi(widgetPage);
- page->kcfg_saveUrl->setMode(KFile::Directory);
- Q_EMIT(Settings::saveUrl());
-
- dialog->addPage(widgetPage,i18n("General"),"configure");
- connect(dialog,SIGNAL(settingsChanged(const QString &)), this, \
SLOT(generalUpdated()));
-
- Ui::pictureConfigWidget *pagePicture = new Ui::pictureConfigWidget;
- QWidget *widgetPicturePage = new QWidget();
- pagePicture->setupUi(widgetPicturePage);
- pagePicture->kcfg_photoTime->setValue(Settings::photoTime());
- dialog->addPage(widgetPicturePage,i18n("Photo Settings"),"insert-image");
-
- pageWebcam = new Ui::webcamConfigWidget;
-
- QWidget *widgetWebcamPage = new QWidget();
- pageWebcam->setupUi(widgetWebcamPage);
- dialog->addPage(widgetWebcamPage,i18n("Video Settings"),"camera-web");
-
- //the values are in X.X form while the sliders use integer so we device by 100;
- Device device = deviceManager->playingDevice();
- pageWebcam->brightnessSlider->setValue(device.brightness());
- pageWebcam->contrastSlider->setValue(device.contrast());
- pageWebcam->saturationSlider->setValue(device.saturation());
- pageWebcam->gammaSlider->setValue(device.gamma());
- pageWebcam->hueSlider->setValue(device.hue());
-
- PageWebcamConfigManager* configManager = new PageWebcamConfigManager(pageWebcam);
- dialog->setPageWebcamConfigManager(configManager);
-
- connect(pageWebcam->brightnessSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
- connect(pageWebcam->contrastSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
- connect(pageWebcam->saturationSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
- connect(pageWebcam->gammaSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
- connect(pageWebcam->hueSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
-
- connect(pageWebcam->brightnessSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setBrightness(int)));
- connect(pageWebcam->contrastSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setContrast(int)));
- connect(pageWebcam->saturationSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setSaturation(int)));
- connect(pageWebcam->gammaSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setGamma(int)));
- connect(pageWebcam->hueSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setHue(int)));
-
- //TODO: Use the designer and so on
-// KPluginSelector* selector=new KPluginSelector(dialog);
-// selector->addPlugins(PluginManager::self()->pluginInfo());
-// dialog->addPage(selector, i18n("Plugin List"), "preferences-plugin");
- dialog->show();
+ //If settings dialog is already open, return (and focus)
+ if(KConfigDialog::showDialog("settings")){
+ return;
+ }
+
+ //Creating the kcm
+ dialog = new WebcamDialog(this,"settings",Settings::self());
+ dialog->resize(540,dialog->height());
+
+ //Widget created with qt-designer
+ //TODO: Check page and pagePicture leaking
+ Ui::generalConfigWidget *page = new Ui::generalConfigWidget();
+ QWidget *widgetPage = new QWidget();
+ page->setupUi(widgetPage);
+ page->kcfg_saveUrl->setMode(KFile::Directory);
+ Q_EMIT(Settings::saveUrl());
+
+ dialog->addPage(widgetPage,i18n("General"),"configure");
+ connect(dialog,SIGNAL(settingsChanged(const QString &)), this, \
SLOT(generalUpdated())); +
+ Ui::pictureConfigWidget *pagePicture = new Ui::pictureConfigWidget;
+ QWidget *widgetPicturePage = new QWidget();
+ pagePicture->setupUi(widgetPicturePage);
+ pagePicture->kcfg_photoTime->setValue(Settings::photoTime());
+ dialog->addPage(widgetPicturePage,i18n("Photo Settings"),"insert-image");
+
+ pageWebcam = new Ui::webcamConfigWidget;
+
+ QWidget *widgetWebcamPage = new QWidget();
+ pageWebcam->setupUi(widgetWebcamPage);
+ dialog->addPage(widgetWebcamPage,i18n("Video Settings"),"camera-web");
+
+ //the values are in X.X form while the sliders use integer so we device by 100;
+ Device device = deviceManager->playingDevice();
+ pageWebcam->brightnessSlider->setValue(device.brightness());
+ pageWebcam->contrastSlider->setValue(device.contrast());
+ pageWebcam->saturationSlider->setValue(device.saturation());
+ pageWebcam->gammaSlider->setValue(device.gamma());
+ pageWebcam->hueSlider->setValue(device.hue());
+
+ PageWebcamConfigManager* configManager = new \
PageWebcamConfigManager(pageWebcam); + \
dialog->setPageWebcamConfigManager(configManager); +
+ connect(pageWebcam->brightnessSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
+ connect(pageWebcam->contrastSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
+ connect(pageWebcam->saturationSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
+ connect(pageWebcam->gammaSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
+ connect(pageWebcam->hueSlider,SIGNAL(valueChanged(int)),dialog,SLOT(updateButtons()));
+
+ connect(pageWebcam->brightnessSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setBrightness(int)));
+ connect(pageWebcam->contrastSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setContrast(int)));
+ connect(pageWebcam->saturationSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setSaturation(int)));
+ connect(pageWebcam->gammaSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setGamma(int)));
+ connect(pageWebcam->hueSlider,SIGNAL(valueChanged(int)),m_webcam,SLOT(setHue(int)));
+
+ //TODO: Use the designer and so on
+ // KPluginSelector* selector=new KPluginSelector(dialog);
+ // selector->addPlugins(PluginManager::self()->pluginInfo());
+ // dialog->addPage(selector, i18n("Plugin List"), "preferences-plugin");
+ dialog->show();
}
/**
@@ -356,17 +354,17 @@ void Kamoso::configuration()
*/
void Kamoso::generalUpdated()
{
- qDebug() << "Settings New\n" << Settings::saveUrl();
- Settings::self()->writeConfig();
- dirModel->dirLister()->openUrl(Settings::saveUrl(), KDirLister::Reload);
+ qDebug() << "Settings New\n" << Settings::saveUrl();
+ Settings::self()->writeConfig();
+ dirModel->dirLister()->openUrl(Settings::saveUrl(), KDirLister::Reload);
- Device device = deviceManager->playingDevice();
-
- device.setBrightness(pageWebcam->brightnessSlider->value());
- device.setContrast(pageWebcam->contrastSlider->value());
- device.setSaturation(pageWebcam->saturationSlider->value());
- device.setGamma(pageWebcam->gammaSlider->value());
- device.setHue(pageWebcam->hueSlider->value());
+ Device device = deviceManager->playingDevice();
+
+ device.setBrightness(pageWebcam->brightnessSlider->value());
+ device.setContrast(pageWebcam->contrastSlider->value());
+ device.setSaturation(pageWebcam->saturationSlider->value());
+ device.setGamma(pageWebcam->gammaSlider->value());
+ device.setHue(pageWebcam->hueSlider->value());
}
/**
@@ -374,8 +372,8 @@ void Kamoso::generalUpdated()
*/
Kamoso::~Kamoso()
{
- delete player;
- Settings::self()->writeConfig();
+ delete player;
+ Settings::self()->writeConfig();
}
/**
@@ -384,15 +382,15 @@ Kamoso::~Kamoso()
//TODO: Abstraction of what is called on pushBtn?
void Kamoso::startCountdown(qreal minimumTime)
{
- qDebug() << Settings::photoTime();
- int time = qMax(minimumTime, 1000.*Settings::photoTime());
-
- m_countdown->start(time);
- //hidding all non-semaphore widgets
- mainWidgetUi->scrollLeft->hide();
- mainWidgetUi->scrollRight->hide();
- mainWidgetUi->thumbnailView->hide();
- m_countdown->show();
+ qDebug() << Settings::photoTime();
+ int time = qMax(minimumTime, 1000.*Settings::photoTime());
+
+ m_countdown->start(time);
+ //hidding all non-semaphore widgets
+ mainWidgetUi->scrollLeft->hide();
+ mainWidgetUi->scrollRight->hide();
+ mainWidgetUi->thumbnailView->hide();
+ m_countdown->show();
}
/**
@@ -400,9 +398,9 @@ void Kamoso::startCountdown(qreal minimumTime)
*/
void Kamoso::takePhoto()
{
- stopCountdown();
-
- if(m_flashEnabled){
+ stopCountdown();
+
+ if(m_flashEnabled){
#if KDE_IS_VERSION(4,5,85)
org::kde::Solid::PowerManagement power("org.kde.Solid.PowerManagement", \
"/org/kde/Solid/PowerManagement", QDBusConnection::sessionBus()); brightBack = \
power.brightness().value(); @@ -411,27 +409,27 @@ void Kamoso::takePhoto()
brightBack = Solid::Control::PowerManager::brightness();
Solid::Control::PowerManager::setBrightness(100);
#endif
- whiteWidgetManager->showAll();
- }
- QTimer::singleShot(1000, this, SLOT(restore()));
-
- KUrl photoPlace = Settings::saveUrl();
- photoPlace.addPath(QString("picture_1.png"));
+ whiteWidgetManager->showAll();
+ }
+ QTimer::singleShot(1000, this, SLOT(restore()));
+
+ KUrl photoPlace = Settings::saveUrl();
+ photoPlace.addPath(QString("picture_1.png"));
- while(KIO::NetAccess::exists( photoPlace, KIO::NetAccess::DestinationSide, this )) \
{
- autoincFilename(photoPlace);
- }
+ while(KIO::NetAccess::exists( photoPlace, KIO::NetAccess::DestinationSide, this \
)) { + autoincFilename(photoPlace);
+ }
- m_webcam->takePhoto(photoPlace);
- player->play();
+ m_webcam->takePhoto(photoPlace);
+ player->play();
}
void Kamoso::stopCountdown()
{
- mainWidgetUi->scrollLeft->show();
- mainWidgetUi->scrollRight->show();
- mainWidgetUi->thumbnailView->show();
- m_countdown->hide();
+ mainWidgetUi->scrollLeft->show();
+ mainWidgetUi->scrollRight->show();
+ mainWidgetUi->thumbnailView->show();
+ m_countdown->hide();
}
/**
@@ -439,181 +437,188 @@ void Kamoso::stopCountdown()
*/
void Kamoso::restore()
{
- whiteWidgetManager->hideAll();
- if(m_flashEnabled) {
+ whiteWidgetManager->hideAll();
+ if(m_flashEnabled) {
#if KDE_IS_VERSION(4,5,85)
org::kde::Solid::PowerManagement power("org.kde.Solid.PowerManagement", \
"/org/kde/Solid/PowerManagement", QDBusConnection::sessionBus()); \
power.setBrightness(brightBack); #else
Solid::Control::PowerManager::setBrightness(brightBack);
#endif
- }
+ }
}
void Kamoso::slotScrollLeft()
{
- int v=mainWidgetUi->thumbnailView->xValue();
- mainWidgetUi->thumbnailView->setXValue(v-mainWidgetUi->thumbnailView->width());
+ int v = mainWidgetUi->thumbnailView->xValue();
+ mainWidgetUi->thumbnailView->setXValue(v-mainWidgetUi->thumbnailView->width());
}
void Kamoso::slotScrollRight()
{
- int v=mainWidgetUi->thumbnailView->xValue();
- mainWidgetUi->thumbnailView->setXValue(v+mainWidgetUi->thumbnailView->width());
+ int v = mainWidgetUi->thumbnailView->xValue();
+ mainWidgetUi->thumbnailView->setXValue(v+mainWidgetUi->thumbnailView->width());
}
QPointer< QMenu > Kamoso::exportKIPIMenu()
{
- QPointer<QMenu> menu = new QMenu(this);
- QModelIndex idx = mainWidgetUi->thumbnailView->currentIndex();
- KFileItem item(dirModel->itemForIndex(idx));
-
- Q_FOREACH(KIPI::PluginLoader::Info* pluginInfo, mPluginLoader->pluginList()) {
- QStringList pluginMime=pluginInfo->service()->property("X-KIPI-Mimetypes").toStringList();
-
- foreach(const QString& supportedPlugin, pluginMime) {
- if(item.mimeTypePtr()->is(supportedPlugin)) {
- KipiAction* action=new KipiAction(pluginInfo, this, menu);
-
- menu->addAction(action);
- break;
- }
- }
- }
-
- if(!menu->isEmpty())
- menu->addSeparator();
-
- menu->addAction(KIcon("user-trash"), i18n("Trash"), this, SLOT(removeSelection()));
- menu->addAction(KIcon("document-open"), i18n("Open..."), this, SLOT(openFile()));
- return menu;
+ QPointer<QMenu> menu = new QMenu(this);
+ QModelIndex idx = mainWidgetUi->thumbnailView->currentIndex();
+ KFileItem item(dirModel->itemForIndex(idx));
+
+ Q_FOREACH(KIPI::PluginLoader::Info* pluginInfo, mPluginLoader->pluginList()) {
+ QStringList \
pluginMime=pluginInfo->service()->property("X-KIPI-Mimetypes").toStringList(); +
+ foreach(const QString& supportedPlugin, pluginMime) {
+ if(item.mimeTypePtr()->is(supportedPlugin)) {
+ KipiAction* action=new KipiAction(pluginInfo, this, menu);
+
+ menu->addAction(action);
+ break;
+ }
+ }
+ }
+
+ if(!menu->isEmpty()) {
+ menu->addSeparator();
+ }
+
+ menu->addAction(KIcon("user-trash"), i18n("Trash"), this, \
SLOT(removeSelection())); + menu->addAction(KIcon("document-open"), \
i18n("Open..."), this, SLOT(openFile())); + return menu;
}
void Kamoso::contextMenuEvent(QContextMenuEvent* event)
{
- if(!mainWidgetUi->thumbnailView->selectionModel()->hasSelection())
- return;
-
- QPointer<QMenu> menu = exportKIPIMenu();
-
- menu->exec(mapToGlobal(event->pos()));
-
- delete menu;
+ if(!mainWidgetUi->thumbnailView->selectionModel()->hasSelection()) {
+ return;
+ }
+
+ QPointer<QMenu> menu = exportKIPIMenu();
+
+ menu->exec(mapToGlobal(event->pos()));
+
+ delete menu;
}
void Kamoso::fileViewSelectionChanged(const QItemSelection& , const QItemSelection& \
) {
- mainWidgetUi->exportFiles->setEnabled(mainWidgetUi->thumbnailView->selectionModel()->hasSelection());
+ mainWidgetUi->exportFiles->setEnabled(mainWidgetUi->thumbnailView->selectionModel()->hasSelection());
}
void Kamoso::exportMenu(bool)
{
- QPointer<QMenu> menu = exportKIPIMenu();
-
- menu->exec(mainWidgetUi->exportFiles->parentWidget()->mapToGlobal(mainWidgetUi->exportFiles->geometry().bottomLeft()));
- delete menu;
+ QPointer<QMenu> menu = exportKIPIMenu();
+
+ menu->exec(mainWidgetUi->exportFiles->parentWidget()->mapToGlobal(mainWidgetUi->exportFiles->geometry().bottomLeft()));
+ delete menu;
}
void Kamoso::openFile()
{
- KUrl::List urls;
- foreach(const QModelIndex& idx, \
mainWidgetUi->thumbnailView->selectionModel()->selectedIndexes())
- QDesktopServices::openUrl(dirModel->itemForIndex(idx).url());
+ KUrl::List urls;
+ foreach(const QModelIndex& idx, \
mainWidgetUi->thumbnailView->selectionModel()->selectedIndexes()) { + \
QDesktopServices::openUrl(dirModel->itemForIndex(idx).url()); + }
}
void Kamoso::removeSelection()
{
- KUrl::List urls;
- foreach(const QModelIndex& idx, \
mainWidgetUi->thumbnailView->selectionModel()->selectedIndexes())
- urls << dirModel->itemForIndex(idx).url();
-
- int res=KMessageBox::warningContinueCancel(0,
- i18np("Are you sure you want to delete this file?", "Are you sure you want \
to delete these %1 files?", urls.size()),
- i18n("Move to Trash"));
+ KUrl::List urls;
+ foreach(const QModelIndex& idx, \
mainWidgetUi->thumbnailView->selectionModel()->selectedIndexes()) { + urls << \
dirModel->itemForIndex(idx).url(); + }
+
+ int res=KMessageBox::warningContinueCancel(0,
+ i18np("Are you sure you want to delete this \
file?", "Are you sure you want to delete these %1 files?", urls.size()), + \
i18n("Move to Trash"));
- if(res==KMessageBox::Continue) {
- KIO::CopyJob *job = KIO::trash(urls);
- mTracker->registerJob(job, urls, KIcon("user-trash"));
- }
+ if(res==KMessageBox::Continue) {
+ KIO::CopyJob *job = KIO::trash(urls);
+ mTracker->registerJob(job, urls, KIcon("user-trash"));
+ }
}
void Kamoso::thumbnailAdded()
{
- QTimer::singleShot(0, this, SLOT(selectLast()));
+ QTimer::singleShot(0, this, SLOT(selectLast()));
}
void Kamoso::selectLast()
{
- ThumbnailView* v=mainWidgetUi->thumbnailView;
- v->horizontalScrollBar()->setValue(v->horizontalScrollBar()->maximum());
-
- QModelIndex idx=v->model()->index(v->model()->rowCount()-1, 0);
-
- if(idx.isValid())
- v->selectionModel()->setCurrentIndex(idx,
- QItemSelectionModel::Clear|QItemSelectionModel::Select);
+ ThumbnailView* v = mainWidgetUi->thumbnailView;
+ v->horizontalScrollBar()->setValue(v->horizontalScrollBar()->maximum());
+
+ QModelIndex idx=v->model()->index(v->model()->rowCount()-1, 0);
+
+ if(idx.isValid()) {
+ v->selectionModel()->setCurrentIndex(idx,
+ QItemSelectionModel::Clear|QItemSelectionModel::Select);
+ }
}
void Kamoso::selectJob(KJob* , const KUrl::List& urls)
{
- mainWidgetUi->thumbnailView->selectionModel()->clearSelection();
- foreach(const KUrl&url, urls)
- mainWidgetUi->thumbnailView->selectionModel()->select(dirModel->indexForUrl(url), \
QItemSelectionModel::Select); + \
mainWidgetUi->thumbnailView->selectionModel()->clearSelection(); + foreach(const \
KUrl&url, urls) { + \
mainWidgetUi->thumbnailView->selectionModel()->select(dirModel->indexForUrl(url), \
QItemSelectionModel::Select); + }
}
void Kamoso::changeMode(bool pressed)
{
- if(!pressed)
- return;
+ if(!pressed) {
+ return;
+ }
- QPushButton* tb=qobject_cast<QPushButton*>(sender());
- if(!tb)
- tb=m_modesRadio.first();
-
- int i=0;
- foreach(QPushButton* butt, m_modesRadio) {
- if(butt==tb)
- break;
- i++;
- }
- Q_ASSERT(i<m_modesRadio.size());
-
- if(m_activeMode) {
- m_activeMode->deactivate();
- }
- m_activeMode=m_modes[i];
- dirModel->dirLister()->setMimeFilter(m_activeMode->thumbnailsViewMimeTypes());
- if(!dirModel->dirLister()->url().isEmpty())
- dirModel->dirLister()->openUrl(dirModel->dirLister()->url(), KDirLister::Reload);
-
- QWidget* w=m_activeMode->mainAction();
- w->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
-
- QHBoxLayout* v=qobject_cast<QHBoxLayout*>(mainWidgetUi->actions->layout());
- delete v->takeAt(1)->widget();
-
- v->insertWidget(1, w);
- w->setFocus();
+ QPushButton* tb=qobject_cast<QPushButton*>(sender());
+ if(!tb) {
+ tb=m_modesRadio.first();
+ }
+
+ int i=0;
+ foreach(QPushButton* butt, m_modesRadio) {
+ if(butt==tb)
+ break;
+ i++;
+ }
+ Q_ASSERT(i<m_modesRadio.size());
+
+ if(m_activeMode) {
+ m_activeMode->deactivate();
+ }
+ m_activeMode=m_modes[i];
+ dirModel->dirLister()->setMimeFilter(m_activeMode->thumbnailsViewMimeTypes());
+ if(!dirModel->dirLister()->url().isEmpty())
+ dirModel->dirLister()->openUrl(dirModel->dirLister()->url(), \
KDirLister::Reload);
+ QWidget* w=m_activeMode->mainAction();
+ w->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
+
+ QHBoxLayout* v=qobject_cast<QHBoxLayout*>(mainWidgetUi->actions->layout());
+ delete v->takeAt(1)->widget();
+
+ v->insertWidget(1, w);
+ w->setFocus();
}
CountdownWidget * Kamoso::countdown() const
{
- return m_countdown;
+ return m_countdown;
}
void Kamoso::settingsMenu(bool )
{
- QList<QAction*> actions=m_activeMode->actions();
- KMenu m;
- if(!actions.isEmpty()) {
- m.addActions(actions);
- m.addSeparator();
- }
- m.addAction(KIcon("configure"), i18n("Settings"), this, SLOT(configuration()));
- m.addMenu(customHelpMenu());
-
- m.exec(mainWidgetUi->configure->parentWidget()->mapToGlobal(mainWidgetUi->configure->geometry().bottomLeft()));
+ QList<QAction*> actions=m_activeMode->actions();
+ KMenu m;
+ if(!actions.isEmpty()) {
+ m.addActions(actions);
+ m.addSeparator();
+ }
+ m.addAction(KIcon("configure"), i18n("Settings"), this, SLOT(configuration()));
+ m.addMenu(customHelpMenu());
+
+ m.exec(mainWidgetUi->configure->parentWidget()->mapToGlobal(mainWidgetUi->configure->geometry().bottomLeft()));
}
//Code taken from ksnapshot, thanks guys :p
@@ -654,17 +659,17 @@ void Kamoso::autoincFilename(KUrl &filename)
void Kamoso::thumbnailViewMoved(int value)
{
- mainWidgetUi->scrollLeft->setEnabled(value!=0);
- mainWidgetUi->scrollRight->setEnabled(mainWidgetUi->thumbnailView->horizontalScrollBar()->maximum()!=value);
+ mainWidgetUi->scrollLeft->setEnabled(value!=0);
+ mainWidgetUi->scrollRight->setEnabled(mainWidgetUi->thumbnailView->horizontalScrollBar()->maximum()!=value);
}
void Kamoso::updateThumbnails(const KUrl::List& urls)
{
- foreach(const KUrl& url, urls) {
- QModelIndex idx = dirModel->indexForUrl(url);
- QList<QIcon> icons = tracker()->iconsPerUrl(url);
- mainWidgetUi->thumbnailView->delegate()->setOverlays(url, icons);
-
- mainWidgetUi->thumbnailView->update(idx);
- }
+ foreach(const KUrl& url, urls) {
+ QModelIndex idx = dirModel->indexForUrl(url);
+ QList<QIcon> icons = tracker()->iconsPerUrl(url);
+ mainWidgetUi->thumbnailView->delegate()->setOverlays(url, icons);
+
+ mainWidgetUi->thumbnailView->update(idx);
+ }
}
diff --git a/src/kamoso.h b/src/kamoso.h
index f5f0a1f..eea0bab 100644
--- a/src/kamoso.h
+++ b/src/kamoso.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -50,86 +50,86 @@ namespace Ui { class mainWidget; class webcamConfigWidget;}
namespace Phonon { class MediaObject; }
class Kamoso : public KMainWindow
{
- Q_OBJECT
-//Methods that aren't slots
- public:
- Kamoso ( QWidget *parent=0 );
- void checkInitConfig();
- CountdownWidget *countdown() const;
- ~Kamoso();
- bool isFlashEnabled() const { return m_flashEnabled; }
-
- void startVideo(bool withSound);
- void stopVideo();
- KUrl::List selectedItems();
- KamosoJobTracker* tracker() const { return mTracker; }
- virtual void contextMenuEvent(QContextMenuEvent* event);
-//Only slots
- public slots:
- void takePhoto();
-
- /** Starts a countdown before we take a picture.
- @param minimumTime in miliseconds */
- void startCountdown(qreal minimumTime=0);
- void configuration();
- void generalUpdated();
- void webcamChanged(int index);
- void webcamAdded();
- void webcamRemoved();
- void thumbnailAdded();
- void selectLast();
- void settingsMenu(bool);
- void selectJob(KJob* job, const KUrl::List& urls);
- void changeMode(bool);
+Q_OBJECT
+ public:
+ Kamoso ( QWidget *parent=0 );
+ void checkInitConfig();
+ CountdownWidget *countdown() const;
+ ~Kamoso();
+ bool isFlashEnabled() const { return m_flashEnabled; }
+
+ void startVideo(bool withSound);
+ void stopVideo();
+ KUrl::List selectedItems();
+ KamosoJobTracker* tracker() const { return mTracker; }
+ virtual void contextMenuEvent(QContextMenuEvent* event);
+
+ public Q_SLOTS:
+ void takePhoto();
+
+ /** Starts a countdown before we take a picture.
+ @param minimumTime in miliseconds */
+ void startCountdown(qreal minimumTime=0);
+ void configuration();
+ void generalUpdated();
+ void webcamChanged(int index);
+ void webcamAdded();
+ void webcamRemoved();
+ void thumbnailAdded();
+ void selectLast();
+ void settingsMenu(bool);
+ void selectJob(KJob* job, const KUrl::List& urls);
+ void changeMode(bool);
+
+ void setFlashEnabled(bool en) { m_flashEnabled=en; }
+ void stopCountdown();
+ void thumbnailViewMoved(int value);
+ void updateThumbnails(const KUrl::List& urls);
+ void exportMenu(bool);
+ void fileViewSelectionChanged(const QItemSelection&, const QItemSelection&);
+
+ private Q_SLOTS:
+ void initialize();
+
+ void restore();
+ void slotScrollLeft();
+ void slotScrollRight();
+ void reloadDevicesCombo();
+ void autoincFilename(KUrl& filename);
+ void removeSelection();
+ void openFile();
+
+ Q_SIGNALS:
+ void webcamPlaying(const QString&);
+
+ private:
+ QPointer<QMenu> exportKIPIMenu();
- void setFlashEnabled(bool en) { m_flashEnabled=en; }
- void stopCountdown();
- void thumbnailViewMoved(int value);
- void updateThumbnails(const KUrl::List& urls);
- void exportMenu(bool);
- void fileViewSelectionChanged(const QItemSelection&, const QItemSelection&);
-
- private slots:
- void initialize();
-
- void restore();
- void slotScrollLeft();
- void slotScrollRight();
- void reloadDevicesCombo();
- void autoincFilename(KUrl& filename);
- void removeSelection();
- void openFile();
-
- signals:
- void webcamPlaying(const QString&);
-
- private:
- QPointer<QMenu> exportKIPIMenu();
-
#if KDE_IS_VERSION(4,5,85)
int brightBack;
#else
float brightBack;
#endif
- int m_webcamId;
- KDirModel *dirModel;
- WhiteWidgetManager *whiteWidgetManager;
- WebcamWidget *m_webcam;
- CountdownWidget *m_countdown;
- Phonon::MediaObject *player;
- Ui::mainWidget *mainWidgetUi;
- Ui::webcamConfigWidget *pageWebcam;
- QWidget *mainWidget;
- DeviceManager *deviceManager;
- int m_exponentialValue;
- QList<ShootMode*> m_modes;
- QList<QPushButton*> m_modesRadio;
- ShootMode *m_activeMode;
- bool m_flashEnabled;
- KIPI::PluginLoader* mPluginLoader;
- QList<KAction*> kipiActions;
- KamosoJobTracker* mTracker;
- WebcamDialog* dialog;
+
+ int m_webcamId;
+ KDirModel *dirModel;
+ WhiteWidgetManager *whiteWidgetManager;
+ WebcamWidget *m_webcam;
+ CountdownWidget *m_countdown;
+ Phonon::MediaObject *player;
+ Ui::mainWidget *mainWidgetUi;
+ Ui::webcamConfigWidget *pageWebcam;
+ QWidget *mainWidget;
+ DeviceManager *deviceManager;
+ int m_exponentialValue;
+ QList<ShootMode*> m_modes;
+ QList<QPushButton*> m_modesRadio;
+ ShootMode *m_activeMode;
+ bool m_flashEnabled;
+ KIPI::PluginLoader* mPluginLoader;
+ QList<KAction*> kipiActions;
+ KamosoJobTracker* mTracker;
+ WebcamDialog* dialog;
};
#endif
diff --git a/src/kamosoimagecollectionshared.cpp \
b/src/kamosoimagecollectionshared.cpp index 4466913..36c85aa 100644
--- a/src/kamosoimagecollectionshared.cpp
+++ b/src/kamosoimagecollectionshared.cpp
@@ -1,50 +1,49 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#include "kamosoimagecollectionshared.h"
struct KamosoImageCollectionShared::Private
{
- Kamoso* kamoso;
+ Kamoso* kamoso;
};
KamosoImageCollectionShared::KamosoImageCollectionShared(Kamoso* kamoso): d(new \
Private) {
- d->kamoso = kamoso;
+ d->kamoso = kamoso;
}
KamosoImageCollectionShared::~KamosoImageCollectionShared()
{
- delete d;
+ delete d;
}
QString KamosoImageCollectionShared::name()
{
- //TODO: Do this configurable?
- return "Kamoso";
+ //TODO: Do this configurable?
+ return "Kamoso";
}
KUrl::List KamosoImageCollectionShared::images()
{
- return d->kamoso->selectedItems();
+ return d->kamoso->selectedItems();
}
-
diff --git a/src/kamosoimagecollectionshared.h b/src/kamosoimagecollectionshared.h
index 58c737a..b9529d0 100644
--- a/src/kamosoimagecollectionshared.h
+++ b/src/kamosoimagecollectionshared.h
@@ -1,21 +1,21 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#ifndef KAMOSOIMAGECOLLECTIONSHARED_H
#define KAMOSOIMAGECOLLECTIONSHARED_H
@@ -27,13 +27,13 @@ class KamosoImageCollectionShared : public \
KIPI::ImageCollectionShared {
public:
- KamosoImageCollectionShared(Kamoso *kamoso);
- ~KamosoImageCollectionShared();
- virtual KUrl::List images();
- virtual QString name();
+ KamosoImageCollectionShared(Kamoso *kamoso);
+ ~KamosoImageCollectionShared();
+ virtual KUrl::List images();
+ virtual QString name();
private:
- class Private;
- Private* d;
+ class Private;
+ Private* d;
};
#endif // KAMOSOIMAGECOLLECTIONSHARED_H
diff --git a/src/kamosojobtracker.cpp b/src/kamosojobtracker.cpp
index 2ee1a7c..f8c2f40 100644
--- a/src/kamosojobtracker.cpp
+++ b/src/kamosojobtracker.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -28,114 +28,116 @@
#include <QMouseEvent>
KamosoJobTracker::KamosoJobTracker(QWidget* parent, Qt::WindowFlags f)
- : QWidget(parent, f), m_selectedJob(-1)
+ : QWidget(parent, f), m_selectedJob(-1)
{
- setMouseTracking(true);
+ setMouseTracking(true);
}
void KamosoJobTracker::registerJob(KJob* job, const KUrl::List& urls, const QIcon& \
icon) {
- Q_ASSERT(!mJobs.contains(job));
- qDebug() << "Register job received!!!";
- connect(job, SIGNAL(result(KJob*)), SLOT(unregisterJob(KJob*)));
- connect(job, SIGNAL(percent(KJob*, unsigned long)), SLOT(repaint()));
- mJobs.insert(job, qMakePair(urls, icon));
- job->start();
- updateGeometry();
- emit urlsChanged(urls);
+ Q_ASSERT(!mJobs.contains(job));
+ qDebug() << "Register job received!!!";
+ connect(job, SIGNAL(result(KJob*)), SLOT(unregisterJob(KJob*)));
+ connect(job, SIGNAL(percent(KJob*, unsigned long)), SLOT(repaint()));
+ mJobs.insert(job, qMakePair(urls, icon));
+ job->start();
+ updateGeometry();
+ emit urlsChanged(urls);
}
void KamosoJobTracker::unregisterJob(KJob* job)
{
- QPair< KUrl::List, QIcon > val = mJobs.take(job);
- updateGeometry();
-
- if(job->error()==0) {
- QStringList urls;
- foreach(const KUrl& url, val.first) {
- urls += url.prettyUrl();
- }
- KNotification::event(KNotification::Notification, i18n("Done: %1", \
urls.join(i18nc("Used to join urls", ", "))),
- val.second.pixmap(48,48));
- } else
- KNotification::event(KNotification::Error, job->errorString());
- emit urlsChanged(val.first);
+ QPair< KUrl::List, QIcon > val = mJobs.take(job);
+ updateGeometry();
+
+ if(job->error()==0) {
+ QStringList urls;
+ foreach(const KUrl& url, val.first) {
+ urls += url.prettyUrl();
+ }
+ KNotification::event(KNotification::Notification, i18n("Done: %1", \
urls.join(i18nc("Used to join urls", ", "))), + \
val.second.pixmap(48,48)); + } else {
+ KNotification::event(KNotification::Error, job->errorString());
+ }
+
+ emit urlsChanged(val.first);
}
static const int iconSide=16, separation=4;
QSize KamosoJobTracker::sizeHint() const
{
- return QSize((iconSide+separation)*mJobs.size(), iconSide);
+ return QSize((iconSide+separation)*mJobs.size(), iconSide);
}
void KamosoJobTracker::paintEvent(QPaintEvent*)
{
- QPainter p(this);
-
- int i=0;
- QPixmap alphamask(iconSide, iconSide);
- alphamask.fill(Qt::gray);
- foreach(KJob* job, mJobs.keys()) {
- QRect target((iconSide+separation)*i, 0, iconSide, iconSide);
- if(i==m_selectedJob) //Make it nicer
- p.drawRect(target);
-
- int completedPix=(job->percent()*iconSide)/100;
- QRect source(0,0, iconSide, completedPix);
- QRect sourceRest(0,completedPix, iconSide, iconSide-completedPix);
- QRect comptarget((iconSide+separation)*i, 0, iconSide, completedPix);
- QRect resttarget((iconSide+separation)*i, completedPix, iconSide, \
iconSide-completedPix);
-
- QPixmap icon=mJobs.value(job).second.pixmap(target.size());
- p.drawPixmap(comptarget, icon, source);
-
- icon.setAlphaChannel(alphamask);
- p.drawPixmap(resttarget, icon, sourceRest);
- i++;
- }
+ QPainter p(this);
+
+ int i=0;
+ QPixmap alphamask(iconSide, iconSide);
+ alphamask.fill(Qt::gray);
+ foreach(KJob* job, mJobs.keys()) {
+ QRect target((iconSide+separation)*i, 0, iconSide, iconSide);
+ if(i==m_selectedJob) //Make it nicer
+ p.drawRect(target);
+
+ int completedPix=(job->percent()*iconSide)/100;
+ QRect source(0,0, iconSide, completedPix);
+ QRect sourceRest(0,completedPix, iconSide, iconSide-completedPix);
+ QRect comptarget((iconSide+separation)*i, 0, iconSide, completedPix);
+ QRect resttarget((iconSide+separation)*i, completedPix, iconSide, \
iconSide-completedPix); +
+ QPixmap icon=mJobs.value(job).second.pixmap(target.size());
+ p.drawPixmap(comptarget, icon, source);
+
+ icon.setAlphaChannel(alphamask);
+ p.drawPixmap(resttarget, icon, sourceRest);
+ i++;
+ }
}
void KamosoJobTracker::mousePressEvent(QMouseEvent* ev)
{
- int i=jobPerPosition(ev->pos());
- if(i>=0 && i<mJobs.size()) {
- KJob* job = mJobs.keys()[i];
- emit jobClicked(job, mJobs.value(job).first);
- }
+ int i=jobPerPosition(ev->pos());
+ if(i>=0 && i<mJobs.size()) {
+ KJob* job = mJobs.keys()[i];
+ emit jobClicked(job, mJobs.value(job).first);
+ }
}
int KamosoJobTracker::jobPerPosition(const QPoint& pos)
{
- int x=pos.x();
- return x/(iconSide+separation);
+ int x=pos.x();
+ return x/(iconSide+separation);
}
void KamosoJobTracker::mouseMoveEvent(QMouseEvent* ev)
{
- setSelectedJob(jobPerPosition(ev->pos()));
+ setSelectedJob(jobPerPosition(ev->pos()));
}
void KamosoJobTracker::leaveEvent(QEvent*)
{
- setSelectedJob(-1);
+ setSelectedJob(-1);
}
void KamosoJobTracker::setSelectedJob(int newselection)
{
- if(newselection!=m_selectedJob) {
- m_selectedJob=newselection;
- repaint();
- }
+ if(newselection!=m_selectedJob) {
+ m_selectedJob=newselection;
+ repaint();
+ }
}
QList<QIcon> KamosoJobTracker::iconsPerUrl(const KUrl& url) const
{
- QList<QIcon> ret;
- typedef QPair<KUrl::List, QIcon> pair;
- foreach(const pair& ue, mJobs) {
- if(ue.first.contains(url))
- ret += ue.second;
- }
- return ret;
+ QList<QIcon> ret;
+ typedef QPair<KUrl::List, QIcon> pair;
+ foreach(const pair& ue, mJobs) {
+ if(ue.first.contains(url))
+ ret += ue.second;
+ }
+ return ret;
}
diff --git a/src/kamosojobtracker.h b/src/kamosojobtracker.h
index a76a9eb..04ce659 100644
--- a/src/kamosojobtracker.h
+++ b/src/kamosojobtracker.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -25,32 +25,32 @@
class KJob;
class KamosoJobTracker
- : public QWidget
+ : public QWidget
{
- Q_OBJECT
- public:
- KamosoJobTracker(QWidget* parent = 0, Qt::WindowFlags f = 0);
- virtual void mousePressEvent(QMouseEvent* ev);
- virtual void mouseMoveEvent(QMouseEvent* );
- virtual void leaveEvent(QEvent* );
-
- QList<QIcon> iconsPerUrl(const KUrl& url) const;
-
- public slots:
- void registerJob(KJob* job, const KUrl::List& urls, const QIcon& icon);
- void unregisterJob(KJob* job);
-
- virtual QSize sizeHint() const;
- virtual void paintEvent(QPaintEvent* );
- signals:
- void urlsChanged(const KUrl::List& urls);
- void jobClicked(KJob* job, const KUrl::List& urls);
-
- private:
- void setSelectedJob(int newselection);
- int jobPerPosition(const QPoint& pos);
- QMap<KJob*, QPair<KUrl::List, QIcon> > mJobs;
- int m_selectedJob;
+Q_OBJECT
+ public:
+ KamosoJobTracker(QWidget* parent = 0, Qt::WindowFlags f = 0);
+ virtual void mousePressEvent(QMouseEvent* ev);
+ virtual void mouseMoveEvent(QMouseEvent* );
+ virtual void leaveEvent(QEvent* );
+
+ QList<QIcon> iconsPerUrl(const KUrl& url) const;
+
+ public slots:
+ void registerJob(KJob* job, const KUrl::List& urls, const QIcon& icon);
+ void unregisterJob(KJob* job);
+
+ virtual QSize sizeHint() const;
+ virtual void paintEvent(QPaintEvent* );
+ signals:
+ void urlsChanged(const KUrl::List& urls);
+ void jobClicked(KJob* job, const KUrl::List& urls);
+
+ private:
+ void setSelectedJob(int newselection);
+ int jobPerPosition(const QPoint& pos);
+ QMap<KJob*, QPair<KUrl::List, QIcon> > mJobs;
+ int m_selectedJob;
};
#endif
diff --git a/src/kamosoplugin.cpp b/src/kamosoplugin.cpp
index d498714..6c4b8dd 100644
--- a/src/kamosoplugin.cpp
+++ b/src/kamosoplugin.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -23,7 +23,7 @@
KamosoPlugin::KamosoPlugin(QObject* parent, const QVariantList& args)
: QObject(parent)
{
- Q_UNUSED(args); //We do not need that (yet?)
+ Q_UNUSED(args); //We do not need that (yet?)
}
KamosoPlugin::~KamosoPlugin()
@@ -31,12 +31,12 @@ KamosoPlugin::~KamosoPlugin()
bool KamosoPlugin::executeContextMenuAction(const QList< KUrl >& urls)
{
- QAction* a=thumbnailsAction(urls);
- if(a)
- a->trigger();
- bool ret=(a!=0);
- delete a;
- return ret;
+ QAction* a=thumbnailsAction(urls);
+ if(a)
+ a->trigger();
+ bool ret=(a!=0);
+ delete a;
+ return ret;
}
#include "kamosoplugin.moc"
diff --git a/src/kamosoplugin.h b/src/kamosoplugin.h
index 3306215..03f2767 100644
--- a/src/kamosoplugin.h
+++ b/src/kamosoplugin.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -30,23 +30,24 @@ class KamosoJob;
class KDE_EXPORT KamosoPlugin : public QObject
{
- Q_OBJECT
- public:
- KamosoPlugin(QObject* parent, const QVariantList& args);
- virtual ~KamosoPlugin();
-
- /** Action that it will appear in the thumbnails view's menu.
- @p url Describes the item we need it for.
-
- @returns the action to be added. If a null action is returned,
- nothing will be added
- */
- bool executeContextMenuAction(const QList<KUrl>& urls);
- virtual QAction* thumbnailsAction(const QList<KUrl>& urls)=0;
-
- signals:
- void jobCreated(KamosoJob* job);
+Q_OBJECT
+ public:
+ KamosoPlugin(QObject* parent, const QVariantList& args);
+ virtual ~KamosoPlugin();
+
+ /** Action that it will appear in the thumbnails view's menu.
+ @p url Describes the item we need it for.
+
+ @returns the action to be added. If a null action is returned,
+ nothing will be added
+ */
+ bool executeContextMenuAction(const QList<KUrl>& urls);
+ virtual QAction* thumbnailsAction(const QList<KUrl>& urls)=0;
+
+ signals:
+ void jobCreated(KamosoJob* job);
};
+
Q_DECLARE_INTERFACE(KamosoPlugin, "org.kamoso.plugin");
#endif // KAMOSOPLUGIN_H
diff --git a/src/kipiaction.cpp b/src/kipiaction.cpp
index a936a49..a0f8405 100644
--- a/src/kipiaction.cpp
+++ b/src/kipiaction.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -25,16 +25,16 @@
#include "kamosojobtracker.h"
KipiAction::KipiAction(KIPI::PluginLoader::Info* pluginInfo, Kamoso* ui, QObject* \
parent)
- : QAction(pluginInfo->icon(), pluginInfo->name(), parent), pluginInfo(pluginInfo), \
mKamoso(ui) + : QAction(pluginInfo->icon(), pluginInfo->name(), parent), \
pluginInfo(pluginInfo), mKamoso(ui) {
- connect(this, SIGNAL(triggered()), SLOT(runJob()));
+ connect(this, SIGNAL(triggered()), SLOT(runJob()));
}
void KipiAction::runJob()
{
- KIPI::Plugin* p=pluginInfo->plugin();
- KIPI::ExportInterface* ep=dynamic_cast<KIPI::ExportInterface*>(p);
-
- KJob* job=ep->exportFiles(i18n("Kamoso"));
- mKamoso->tracker()->registerJob(job, mKamoso->selectedItems(), icon());
-}
+ KIPI::Plugin* p=pluginInfo->plugin();
+ KIPI::ExportInterface* ep=dynamic_cast<KIPI::ExportInterface*>(p);
+
+ KJob* job=ep->exportFiles(i18n("Kamoso"));
+ mKamoso->tracker()->registerJob(job, mKamoso->selectedItems(), icon());
+}
\ No newline at end of file
diff --git a/src/kipiaction.h b/src/kipiaction.h
index 1401dbf..af34a77 100644
--- a/src/kipiaction.h
+++ b/src/kipiaction.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -26,16 +26,16 @@
class Kamoso;
class KipiAction : public QAction
{
- Q_OBJECT
- public:
- KipiAction(KIPI::PluginLoader::Info* pluginInfo, Kamoso* ui, QObject* parent);
-
- public slots:
- void runJob();
-
- private:
- KIPI::PluginLoader::Info* pluginInfo;
- Kamoso* mKamoso;
+Q_OBJECT
+ public:
+ KipiAction(KIPI::PluginLoader::Info* pluginInfo, Kamoso* ui, QObject* \
parent); +
+ public slots:
+ void runJob();
+
+ private:
+ KIPI::PluginLoader::Info* pluginInfo;
+ Kamoso* mKamoso;
};
#endif
diff --git a/src/kipiinterface.cpp b/src/kipiinterface.cpp
index 59daefc..c8c4ceb 100644
--- a/src/kipiinterface.cpp
+++ b/src/kipiinterface.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -34,33 +34,33 @@
#include <libkipi/imageinfo.h>
struct KIPIInterfacePrivate {
- Kamoso *kamoso;
- KIPI::PluginLoader* pluginLoader;
+ Kamoso *kamoso;
+ KIPI::PluginLoader* pluginLoader;
};
KIPIInterface::KIPIInterface(Kamoso* kamoso)
:KIPI::Interface(kamoso)
, d(new KIPIInterfacePrivate) {
- d->kamoso = kamoso;
+ d->kamoso = kamoso;
// d->pluginLoader = new KIPI::PluginLoader(QStringList(), this);
}
KIPIInterface::~KIPIInterface() {
- delete d;
+ delete d;
}
KIPI::ImageCollection KIPIInterface::currentAlbum() {
- return KIPI::ImageCollection(new KamosoImageCollectionShared(d->kamoso));
+ return KIPI::ImageCollection(new KamosoImageCollectionShared(d->kamoso));
}
KIPI::ImageCollection KIPIInterface::currentSelection() {
- return KIPI::ImageCollection(new KamosoImageCollectionShared(d->kamoso));
+ return KIPI::ImageCollection(new KamosoImageCollectionShared(d->kamoso));
}
QList<KIPI::ImageCollection> KIPIInterface::allAlbums() {
- QList<KIPI::ImageCollection> list;
- list << currentSelection();
- return list;
+ QList<KIPI::ImageCollection> list;
+ list << currentSelection();
+ return list;
}
KIPI::ImageInfo KIPIInterface::info(const KUrl& url) {
@@ -77,13 +77,13 @@ void KIPIInterface::refreshImages( const KUrl::List&)
{}
KIPI::ImageCollectionSelector* KIPIInterface::imageCollectionSelector(QWidget \
*parent) {
- return new KIPI::ImageCollectionSelector(parent);
+ return new KIPI::ImageCollectionSelector(parent);
}
KIPI::UploadWidget* KIPIInterface::uploadWidget(QWidget *parent) {
- return (new KIPI::UploadWidget(parent));
+ return (new KIPI::UploadWidget(parent));
}
int KIPIInterface::features() const {
- return KIPI::HostAcceptNewImages;
+ return KIPI::HostAcceptNewImages;
}
\ No newline at end of file
diff --git a/src/kipiinterface.h b/src/kipiinterface.h
index 61df5f7..3784b00 100644
--- a/src/kipiinterface.h
+++ b/src/kipiinterface.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -28,29 +28,28 @@
class KIPIInterfacePrivate;
class KIPIInterface :public KIPI::Interface {
- Q_OBJECT
-
-public:
- KIPIInterface(Kamoso* kamoso);
- virtual ~KIPIInterface();
-
- virtual bool addImage(const KUrl&, QString& err);
- virtual void delImage( const KUrl& );
- virtual void refreshImages( const KUrl::List& urls );
-
- virtual KIPI::ImageCollectionSelector* imageCollectionSelector(QWidget *parent);
- virtual KIPI::UploadWidget* uploadWidget(QWidget *parent);
-
-
- virtual QList< KIPI::ImageCollection > allAlbums();
- virtual KIPI::ImageCollection currentAlbum();
- virtual KIPI::ImageCollection currentSelection();
- virtual int features() const;
- virtual KIPI::ImageInfo info(const KUrl& );
+Q_OBJECT
+
+ public:
+ KIPIInterface(Kamoso* kamoso);
+ virtual ~KIPIInterface();
+
+ virtual bool addImage(const KUrl&, QString& err);
+ virtual void delImage( const KUrl& );
+ virtual void refreshImages( const KUrl::List& urls );
+
+ virtual KIPI::ImageCollectionSelector* imageCollectionSelector(QWidget \
*parent); + virtual KIPI::UploadWidget* uploadWidget(QWidget *parent);
+
+
+ virtual QList< KIPI::ImageCollection > allAlbums();
+ virtual KIPI::ImageCollection currentAlbum();
+ virtual KIPI::ImageCollection currentSelection();
+ virtual int features() const;
+ virtual KIPI::ImageInfo info(const KUrl& );
private:
- private:
- KIPIInterfacePrivate* const d;
+ KIPIInterfacePrivate* const d;
};
#endif // KIPIINTERFACE_H
diff --git a/src/main.cpp b/src/main.cpp
index 24b7b72..9743080 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -24,15 +24,15 @@
int main(int argc, char *argv[])
{
- KAboutData about("kamoso", 0, ki18n(("Kamoso")), "1.90", ki18n("Webcam picture \
retriever"),
- KAboutData::License_GPL, ki18n("(C) 2008-2010 Alex Fiestas and Aleix Pol"));
- about.addAuthor( ki18n("Aleix Pol Gonzalez"), ki18n("Semaphore hacker"), \
"aleixpol@kde.org" );
- about.addAuthor( ki18n("Alex Fiestas"), ki18n("Coffee drinker"), "alex@eyeos.org" \
);
- KCmdLineArgs::init(argc, argv, &about);
- KApplication app;
-
- Kamoso* kamosoMain = new Kamoso;
- kamosoMain->show();
-
- return app.exec();
+ KAboutData about("kamoso", 0, ki18n(("Kamoso")), "1.90", ki18n("Webcam picture \
retriever"), + KAboutData::License_GPL, ki18n("(C) 2008-2010 Alex \
Fiestas and Aleix Pol")); + about.addAuthor( ki18n("Aleix Pol Gonzalez"), \
ki18n("Semaphore hacker"), "aleixpol@kde.org" ); + about.addAuthor( ki18n("Alex \
Fiestas"), ki18n("Coffee drinker"), "alex@eyeos.org" ); + KCmdLineArgs::init(argc, \
argv, &about); + KApplication app;
+
+ Kamoso* kamosoMain = new Kamoso;
+ kamosoMain->show();
+
+ return app.exec();
}
diff --git a/src/pagewebcamconfigmanager.cpp b/src/pagewebcamconfigmanager.cpp
index 6354439..4084b3e 100644
--- a/src/pagewebcamconfigmanager.cpp
+++ b/src/pagewebcamconfigmanager.cpp
@@ -1,75 +1,75 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#include "pagewebcamconfigmanager.h"
#include <QDebug>
-
struct Private
{
- Ui::webcamConfigWidget* pageWebcam;
- int brightness,contrast,saturation,gamma,hue;
+ Ui::webcamConfigWidget* pageWebcam;
+ int brightness,contrast,saturation,gamma,hue;
};
+
PageWebcamConfigManager::PageWebcamConfigManager(Ui::webcamConfigWidget* \
pageWebcam):d(new Private) {
- d->pageWebcam = pageWebcam;
- updateDefaultValues();
+ d->pageWebcam = pageWebcam;
+ updateDefaultValues();
}
bool PageWebcamConfigManager::hasChanged()
{
- if(d->brightness != d->pageWebcam->brightnessSlider->value()) {
- return true;
- }
- if(d->contrast != d->pageWebcam->contrastSlider->value()) {
- return true;
- }
- if(d->saturation != d->pageWebcam->saturationSlider->value()) {
- return true;
- }
- if(d->gamma != d->pageWebcam->gammaSlider->value()) {
- return true;
- }
- if(d->hue != d->pageWebcam->hueSlider->value()) {
- return true;
- }
+ if(d->brightness != d->pageWebcam->brightnessSlider->value()) {
+ return true;
+ }
+ if(d->contrast != d->pageWebcam->contrastSlider->value()) {
+ return true;
+ }
+ if(d->saturation != d->pageWebcam->saturationSlider->value()) {
+ return true;
+ }
+ if(d->gamma != d->pageWebcam->gammaSlider->value()) {
+ return true;
+ }
+ if(d->hue != d->pageWebcam->hueSlider->value()) {
+ return true;
+ }
- return false;
+ return false;
}
void PageWebcamConfigManager::updateDefaultValues()
{
- d->brightness = d->pageWebcam->brightnessSlider->value();
- d->contrast = d->pageWebcam->contrastSlider->value();
- d->saturation = d->pageWebcam->saturationSlider->value();
- d->gamma = d->pageWebcam->gammaSlider->value();
- d->hue = d->pageWebcam->hueSlider->value();
+ d->brightness = d->pageWebcam->brightnessSlider->value();
+ d->contrast = d->pageWebcam->contrastSlider->value();
+ d->saturation = d->pageWebcam->saturationSlider->value();
+ d->gamma = d->pageWebcam->gammaSlider->value();
+ d->hue = d->pageWebcam->hueSlider->value();
}
void PageWebcamConfigManager::updateWidgetsDefault()
{
- qDebug() << "Setting default values to sliders";
- d->pageWebcam->brightnessSlider->setValue(0);
- d->pageWebcam->contrastSlider->setValue(100);
- d->pageWebcam->saturationSlider->setValue(100);
- d->pageWebcam->gammaSlider->setValue(100);
- d->pageWebcam->hueSlider->setValue(0);
+ qDebug() << "Setting default values to sliders";
+ d->pageWebcam->brightnessSlider->setValue(0);
+ d->pageWebcam->contrastSlider->setValue(100);
+ d->pageWebcam->saturationSlider->setValue(100);
+ d->pageWebcam->gammaSlider->setValue(100);
+ d->pageWebcam->hueSlider->setValue(0);
}
\ No newline at end of file
diff --git a/src/pagewebcamconfigmanager.h b/src/pagewebcamconfigmanager.h
index 52b5147..09ea768 100644
--- a/src/pagewebcamconfigmanager.h
+++ b/src/pagewebcamconfigmanager.h
@@ -1,21 +1,21 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#ifndef PAGEWEBCAMCONFIGMANAGER_H
#define PAGEWEBCAMCONFIGMANAGER_H
@@ -26,12 +26,12 @@ struct Private;
class PageWebcamConfigManager
{
public:
- PageWebcamConfigManager(Ui::webcamConfigWidget* pageWebcam);
- bool hasChanged();
- void updateDefaultValues();
- void updateWidgetsDefault();
+ PageWebcamConfigManager(Ui::webcamConfigWidget* pageWebcam);
+ bool hasChanged();
+ void updateDefaultValues();
+ void updateWidgetsDefault();
private:
- Private* d;
+ Private* d;
};
#endif // PAGEWEBCAMCONFIGMANAGER_H
diff --git a/src/photoshootmode.cpp b/src/photoshootmode.cpp
index 864ee5e..8593a47 100644
--- a/src/photoshootmode.cpp
+++ b/src/photoshootmode.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -18,65 +18,68 @@
*************************************************************************************/
#include "photoshootmode.h"
+#include "kamoso.h"
+#include "countdownwidget.h"
+
#include <KIcon>
#include <KLocalizedString>
+
#include <QAction>
-#include "kamoso.h"
#include <QPushButton>
-#include "countdownwidget.h"
PhotoShootMode::PhotoShootMode(Kamoso* camera)
- : ShootMode(camera)
+ : ShootMode(camera)
{
- QAction* flash=new QAction(KIcon("weather-clear"), i18n("Use Flash"), this);
- flash->setCheckable(true);
- flash->setChecked(controller()->isFlashEnabled());
- connect(flash, SIGNAL(triggered(bool)), controller(), SLOT(setFlashEnabled(bool)));
- mActions += flash;
+ QAction* flash=new QAction(KIcon("weather-clear"), i18n("Use Flash"), this);
+ flash->setCheckable(true);
+ flash->setChecked(controller()->isFlashEnabled());
+ connect(flash, SIGNAL(triggered(bool)), controller(), \
SLOT(setFlashEnabled(bool))); + mActions += flash;
}
void PhotoShootMode::deactivate()
{
- disconnect(controller()->countdown(), SIGNAL(finished()),this ,SLOT(release()));
+ disconnect(controller()->countdown(), SIGNAL(finished()),this ,SLOT(release()));
}
QWidget* PhotoShootMode::mainAction()
{
- mTrigger = new QPushButton(controller());
- mTrigger->setIcon(icon());
- mTrigger->setIconSize(QSize(32,32));
- mTrigger->setToolTip(name());
- mTrigger->setCheckable(true);
-
- connect(controller()->countdown(), SIGNAL(finished()), SLOT(release()));
- connect(mTrigger, SIGNAL(clicked(bool)), this, SLOT(shootClicked(bool)));
- return mTrigger;
+ mTrigger = new QPushButton(controller());
+ mTrigger->setIcon(icon());
+ mTrigger->setIconSize(QSize(32,32));
+ mTrigger->setToolTip(name());
+ mTrigger->setCheckable(true);
+
+ connect(controller()->countdown(), SIGNAL(finished()), SLOT(release()));
+ connect(mTrigger, SIGNAL(clicked(bool)), this, SLOT(shootClicked(bool)));
+ return mTrigger;
}
void PhotoShootMode::release()
{
- mTrigger->setChecked(false);
+ mTrigger->setChecked(false);
}
void PhotoShootMode::shootClicked(bool pressed)
{
- if(pressed)
- controller()->startCountdown();
- else
- controller()->stopCountdown();
+ if(pressed) {
+ controller()->startCountdown();
+ } else {
+ controller()->stopCountdown();
+ }
}
QIcon PhotoShootMode::icon() const
{
- return KIcon("webcamreceive");
+ return KIcon("webcamreceive");
}
QString PhotoShootMode::name() const
{
- return i18n("Take pictures");
+ return i18n("Take pictures");
}
QStringList PhotoShootMode::thumbnailsViewMimeTypes() const
{
- return QStringList() << "image/png";
+ return QStringList() << "image/png";
}
diff --git a/src/photoshootmode.h b/src/photoshootmode.h
index 1a4087a..8e09943 100644
--- a/src/photoshootmode.h
+++ b/src/photoshootmode.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -27,24 +27,24 @@ class QPushButton;
class PhotoShootMode : public ShootMode
{
- Q_OBJECT
- public:
- PhotoShootMode(Kamoso* camera);
-
- virtual QList<QAction*> actions() { return mActions; }
- virtual QWidget* mainAction();
- virtual QIcon icon() const;
- virtual QString name() const;
- virtual QStringList thumbnailsViewMimeTypes() const;
- virtual void deactivate();
-
- private slots:
- void shootClicked(bool pressed);
- void release();
-
- private:
- QList<QAction*> mActions;
- QPointer<QPushButton> mTrigger;
+Q_OBJECT
+ public:
+ PhotoShootMode(Kamoso* camera);
+
+ virtual QList<QAction*> actions() { return mActions; }
+ virtual QWidget* mainAction();
+ virtual QIcon icon() const;
+ virtual QString name() const;
+ virtual QStringList thumbnailsViewMimeTypes() const;
+ virtual void deactivate();
+
+ private slots:
+ void shootClicked(bool pressed);
+ void release();
+
+ private:
+ QList<QAction*> mActions;
+ QPointer<QPushButton> mTrigger;
};
#endif // PHOTOSHOOTMODE_H
diff --git a/src/shootmode.cpp b/src/shootmode.cpp
index 3eb79b6..aa66b87 100644
--- a/src/shootmode.cpp
+++ b/src/shootmode.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -29,5 +29,5 @@ ShootMode::~ShootMode()
Kamoso* ShootMode::controller() const
{
- return mController;
+ return mController;
}
diff --git a/src/shootmode.h b/src/shootmode.h
index 241c3c6..52828a4 100644
--- a/src/shootmode.h
+++ b/src/shootmode.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -25,32 +25,32 @@
class Kamoso;
class ShootMode : public QObject
{
- Q_OBJECT
- public:
- ShootMode(Kamoso* camera);
- virtual ~ShootMode();
-
- /** @returns the name of the shooting mode */
- virtual QString name() const=0;
-
- /** @returns the icon of the shooting mode */
- virtual QIcon icon() const=0;
-
- /** @returns the main action associated to the shooting mode */
- virtual QWidget* mainAction()=0;
-
- virtual QStringList thumbnailsViewMimeTypes() const=0;
- /** @returns some more actions associated to the shooting mode */
- virtual QList<QAction*> actions()=0;
-
- /** Deactivate the mode, is like a destructor */
- virtual void deactivate()=0;
-
- /** */
- Kamoso* controller() const;
-
- private:
- Kamoso* mController;
+Q_OBJECT
+ public:
+ ShootMode(Kamoso* camera);
+ virtual ~ShootMode();
+
+ /** @returns the name of the shooting mode */
+ virtual QString name() const=0;
+
+ /** @returns the icon of the shooting mode */
+ virtual QIcon icon() const=0;
+
+ /** @returns the main action associated to the shooting mode */
+ virtual QWidget* mainAction()=0;
+
+ virtual QStringList thumbnailsViewMimeTypes() const=0;
+ /** @returns some more actions associated to the shooting mode */
+ virtual QList<QAction*> actions()=0;
+
+ /** Deactivate the mode, is like a destructor */
+ virtual void deactivate()=0;
+
+ /** */
+ Kamoso* controller() const;
+
+ private:
+ Kamoso* mController;
};
#endif // SHOOTMODE_H
diff --git a/src/thumbnailview.cpp b/src/thumbnailview.cpp
index 395b033..3e77acd 100644
--- a/src/thumbnailview.cpp
+++ b/src/thumbnailview.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -21,80 +21,80 @@
ThumbnailView::ThumbnailView(QWidget* parent) : QListView(parent)
{
- setHorizontalScrollMode(ScrollPerPixel);
- m_xProperty=new QPropertyAnimation(horizontalScrollBar(), "value", this);
-
- connect(this, SIGNAL(pressed (QModelIndex)), SLOT(updatexClick(QModelIndex)));
+ setHorizontalScrollMode(ScrollPerPixel);
+ m_xProperty=new QPropertyAnimation(horizontalScrollBar(), "value", this);
+
+ connect(this, SIGNAL(pressed (QModelIndex)), SLOT(updatexClick(QModelIndex)));
}
void ThumbnailView::previewAvailable(const KFileItem& file, const QPixmap& pic)
{
- m_repo.insert(file.url(), pic);
- update(m_waiting.take(file.url()));
+ m_repo.insert(file.url(), pic);
+ update(m_waiting.take(file.url()));
}
void ThumbnailView::assignDelegate()
{
- CustomDelegate* c=new CustomDelegate(m_repo, this);
- connect(c, SIGNAL(pixmapNeeded(KFileItem,QModelIndex,QRect)), \
SLOT(retrievePixmap(KFileItem,QModelIndex,QRect)));
- setItemDelegate(c);
+ CustomDelegate* c=new CustomDelegate(m_repo, this);
+ connect(c, SIGNAL(pixmapNeeded(KFileItem,QModelIndex,QRect)), \
SLOT(retrievePixmap(KFileItem,QModelIndex,QRect))); + setItemDelegate(c);
}
void ThumbnailView::retrievePixmap(const KFileItem& file, const QModelIndex& idx, \
const QRect& rect) {
- if(!m_waiting.contains(file.url())) {
- m_waiting.insert(file.url(), idx);
+ if(!m_waiting.contains(file.url())) {
+ m_waiting.insert(file.url(), idx);
- KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << file, rect.width(), \
rect.height(), 0, 0, true, false, 0);
- connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), \
SLOT(previewAvailable(KFileItem,QPixmap)));
- job->setAutoDelete(true);
- job->start();
- }
+ KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << file, \
rect.width(), rect.height(), 0, 0, true, false, 0); + connect(job, \
SIGNAL(gotPreview(KFileItem,QPixmap)), SLOT(previewAvailable(KFileItem,QPixmap))); + \
job->setAutoDelete(true); + job->start();
+ }
}
void ThumbnailView::updatexClick(const QModelIndex & idx)
{
- Q_UNUSED(idx);
- xClick= QCursor::pos().x();
+ Q_UNUSED(idx);
+ xClick= QCursor::pos().x();
}
void ThumbnailView::mousePressEvent(QMouseEvent* event)
{
- m_xProperty->setEndValue(horizontalScrollBar()->value());
+ m_xProperty->setEndValue(horizontalScrollBar()->value());
QAbstractItemView::mousePressEvent(event);
}
void ThumbnailView::mouseMoveEvent(QMouseEvent* event)
{
- if (event->buttons() & Qt::LeftButton)
- {
- int x= QCursor::pos().x();
- int difx = 3*(x - xClick);
- int v = m_xProperty->endValue().toInt();
- xClick= x;
- setCursor(Qt::SizeHorCursor);
- setXValue(v-difx);
- }
+ if (event->buttons() & Qt::LeftButton)
+ {
+ int x= QCursor::pos().x();
+ int difx = 3*(x - xClick);
+ int v = m_xProperty->endValue().toInt();
+ xClick= x;
+ setCursor(Qt::SizeHorCursor);
+ setXValue(v-difx);
+ }
}
void ThumbnailView::setXValue(int v)
{
- int min=horizontalScrollBar()->minimum();
- int max=horizontalScrollBar()->maximum();
- int value = qBound(min, v, max);
-
- m_xProperty->setEndValue(value);
- m_xProperty->stop();
- m_xProperty->start();
+ int min=horizontalScrollBar()->minimum();
+ int max=horizontalScrollBar()->maximum();
+ int value = qBound(min, v, max);
+
+ m_xProperty->setEndValue(value);
+ m_xProperty->stop();
+ m_xProperty->start();
}
void ThumbnailView::mouseReleaseEvent ( QMouseEvent * event )
{
- Q_UNUSED(event);
- this->setCursor(QCursor(Qt::ArrowCursor));
+ Q_UNUSED(event);
+ this->setCursor(QCursor(Qt::ArrowCursor));
}
CustomDelegate* ThumbnailView::delegate() const
{
- return qobject_cast<CustomDelegate*>(itemDelegate());
+ return qobject_cast<CustomDelegate*>(itemDelegate());
}
diff --git a/src/thumbnailview.h b/src/thumbnailview.h
index 31c3d9d..f7aa4ba 100644
--- a/src/thumbnailview.h
+++ b/src/thumbnailview.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -34,39 +34,39 @@ class KamosoTracker;
class ThumbnailView : public QListView
{
- Q_OBJECT
- public:
- ThumbnailView(QWidget* parent = 0);
-
- virtual QStyleOptionViewItem viewOptions () const
- {
- QStyleOptionViewItem options=QListView::viewOptions();
- options.decorationPosition = QStyleOptionViewItem::Top;
- return options;
- }
-
- void assignDelegate();
- QSize sizeHint() const { return QSize(150,150); }
- void setXValue(int v);
- int xValue() const { return m_xProperty->endValue().toInt(); }
-
- CustomDelegate* delegate() const;
-
- protected:
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseMoveEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent (QMouseEvent* event );
+Q_OBJECT
+ public:
+ ThumbnailView(QWidget* parent = 0);
- private slots:
- void previewAvailable(const KFileItem& file, const QPixmap& pic);
- void retrievePixmap(const KFileItem& it, const QModelIndex & idx, const QRect& \
rect);
- void updatexClick(const QModelIndex & idx);
-
- private:
- QHash<KUrl, QPixmap> m_repo;
- QMap<KUrl, QModelIndex> m_waiting;
- QPropertyAnimation* m_xProperty;
- int xClick;
+ virtual QStyleOptionViewItem viewOptions () const
+ {
+ QStyleOptionViewItem options=QListView::viewOptions();
+ options.decorationPosition = QStyleOptionViewItem::Top;
+ return options;
+ }
+
+ void assignDelegate();
+ QSize sizeHint() const { return QSize(150,150); }
+ void setXValue(int v);
+ int xValue() const { return m_xProperty->endValue().toInt(); }
+
+ CustomDelegate* delegate() const;
+
+ protected:
+ virtual void mousePressEvent(QMouseEvent* event);
+ virtual void mouseMoveEvent(QMouseEvent* event);
+ virtual void mouseReleaseEvent (QMouseEvent* event );
+
+ private slots:
+ void previewAvailable(const KFileItem& file, const QPixmap& pic);
+ void retrievePixmap(const KFileItem& it, const QModelIndex & idx, const \
QRect& rect); + void updatexClick(const QModelIndex & idx);
+
+ private:
+ QHash<KUrl, QPixmap> m_repo;
+ QMap<KUrl, QModelIndex> m_waiting;
+ QPropertyAnimation* m_xProperty;
+ int xClick;
};
#endif
diff --git a/src/videoshootmode.cpp b/src/videoshootmode.cpp
index fbae551..24e34e3 100644
--- a/src/videoshootmode.cpp
+++ b/src/videoshootmode.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -26,52 +26,53 @@
#include <QAction>
VideoShootMode::VideoShootMode(Kamoso* camera)
- : ShootMode(camera)
+ : ShootMode(camera)
{
- QAction* sound=new QAction(KIcon("audio-input-microphone"), i18n("Record Audio"), \
this);
- sound->setCheckable(true);
- sound->setChecked(true);
-
- mActions += sound;
+ QAction* sound=new QAction(KIcon("audio-input-microphone"), i18n("Record \
Audio"), this); + sound->setCheckable(true);
+ sound->setChecked(true);
+
+ mActions += sound;
}
void VideoShootMode::deactivate()
{
- //Do nothing at the moment
+ //Do nothing at the moment
}
QWidget* VideoShootMode::mainAction()
{
- QPushButton* action = new QPushButton(controller());
- action->setIcon(icon());
- action->setIconSize(QSize(32,32));
- action->setToolTip(name());
- action->setCheckable(true);
-
- #warning TODO
- connect(action, SIGNAL(clicked(bool)), this, SLOT(videoPressed(bool)));
- return action;
+ QPushButton* action = new QPushButton(controller());
+ action->setIcon(icon());
+ action->setIconSize(QSize(32,32));
+ action->setToolTip(name());
+ action->setCheckable(true);
+
+ #warning TODO
+ connect(action, SIGNAL(clicked(bool)), this, SLOT(videoPressed(bool)));
+ return action;
}
void VideoShootMode::videoPressed(bool pressed)
{
- if(pressed)
- controller()->startVideo(mActions.first()->isChecked());
- else
- controller()->stopVideo();
+ if(pressed) {
+ controller()->startVideo(mActions.first()->isChecked());
+ } else {
+ controller()->stopVideo();
+ }
}
QIcon VideoShootMode::icon() const
{
- return KIcon("media-record");
+ return KIcon("media-record");
}
QString VideoShootMode::name() const
{
- return i18n("Take a video");
+ return i18n("Take a video");
}
QStringList VideoShootMode::thumbnailsViewMimeTypes() const
{
- return QStringList() << "video/x-matroska";
+ return QStringList() << "video/x-matroska";
}
diff --git a/src/videoshootmode.h b/src/videoshootmode.h
index a6ab9a7..6a32c43 100644
--- a/src/videoshootmode.h
+++ b/src/videoshootmode.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -22,22 +22,21 @@
#include "shootmode.h"
-
class VideoShootMode : public ShootMode
{
- Q_OBJECT
- public:
- VideoShootMode(Kamoso* camera);
- virtual void deactivate();
- virtual QList<QAction*> actions() { return mActions; }
- virtual QWidget* mainAction();
- virtual QIcon icon() const;
- virtual QString name() const;
- virtual QStringList thumbnailsViewMimeTypes() const;
- public slots:
- void videoPressed(bool pressed);
- private:
- QList<QAction*> mActions;
+Q_OBJECT
+ public:
+ VideoShootMode(Kamoso* camera);
+ virtual void deactivate();
+ virtual QList<QAction*> actions() { return mActions; }
+ virtual QWidget* mainAction();
+ virtual QIcon icon() const;
+ virtual QString name() const;
+ virtual QStringList thumbnailsViewMimeTypes() const;
+ public slots:
+ void videoPressed(bool pressed);
+ private:
+ QList<QAction*> mActions;
};
#endif // VIDEOSHOOTMODE_H
diff --git a/src/webcamdialog.cpp b/src/webcamdialog.cpp
index e65c7a0..2b99cca 100644
--- a/src/webcamdialog.cpp
+++ b/src/webcamdialog.cpp
@@ -1,60 +1,60 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#include <QDebug>
#include <KLocale>
#include "webcamdialog.h"
WebcamDialog::WebcamDialog( QWidget *parent, const QString& name, KConfigSkeleton \
*config ):
- KConfigDialog(parent,name,config),configManager(0)
+ KConfigDialog(parent,name,config),configManager(0)
{
-
+
}
WebcamDialog::~WebcamDialog()
{
- delete configManager;
+ delete configManager;
}
bool WebcamDialog::hasChanged()
{
- Q_ASSERT(configManager);
- if(KConfigDialog::hasChanged() == true || configManager->hasChanged() == true) {
- return true;
- }
- return false;
+ Q_ASSERT(configManager);
+ if(KConfigDialog::hasChanged() == true || configManager->hasChanged() == true) {
+ return true;
+ }
+ return false;
}
void WebcamDialog::setPageWebcamConfigManager(PageWebcamConfigManager* \
webcamManager) {
- configManager = webcamManager;
+ configManager = webcamManager;
}
void WebcamDialog::updateSettings()
{
- Q_ASSERT(configManager);
- if(hasChanged() == true) {
- qDebug() << "Settings changed";
- configManager->updateDefaultValues();
- settingsChangedSlot();
- }
+ Q_ASSERT(configManager);
+ if(hasChanged() == true) {
+ qDebug() << "Settings changed";
+ configManager->updateDefaultValues();
+ settingsChangedSlot();
+ }
}
void WebcamDialog::updateWidgetsDefault()
{
- qDebug() << "updates widget!";
- KConfigDialog::updateWidgetsDefault();
- configManager->updateWidgetsDefault();
+ qDebug() << "updates widget!";
+ KConfigDialog::updateWidgetsDefault();
+ configManager->updateWidgetsDefault();
}
diff --git a/src/webcamdialog.h b/src/webcamdialog.h
index db256a7..6d16613 100644
--- a/src/webcamdialog.h
+++ b/src/webcamdialog.h
@@ -1,21 +1,21 @@
-/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
+/*************************************************************************************
+ * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
* + * \
* + * This program is free software; you can redistribute it and/or \
* + * modify it under the terms of the GNU General Public License \
* + * as published by the Free Software Foundation; either version 2 \
* + * of the License, or (at your option) any later version. \
* + * \
* + * This program is distributed in the hope that it will be useful, \
* + * but WITHOUT ANY WARRANTY; without even the implied warranty of \
* + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
* + * GNU General Public License for more details. \
* + * \
* + * You should have received a copy of the GNU General Public License \
* + * along with this program; if not, write to the Free Software \
* + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
* + *************************************************************************************/
#ifndef WEBCAMDIALOG_H
#define WEBCAMDIALOG_H
@@ -26,19 +26,19 @@
class WebcamDialog : public KConfigDialog
{
Q_OBJECT
-public:
- WebcamDialog(QWidget *parent, const QString& name,
- KConfigSkeleton *config);
- ~WebcamDialog();
- void setPageWebcamConfigManager(PageWebcamConfigManager* webcamManager);
-public slots:
- virtual void updateSettings();
-protected slots:
- virtual void updateWidgetsDefault();
-protected:
- virtual bool hasChanged();
-private:
- PageWebcamConfigManager* configManager;
+ public:
+ WebcamDialog(QWidget *parent, const QString& name,
+ KConfigSkeleton *config);
+ ~WebcamDialog();
+ void setPageWebcamConfigManager(PageWebcamConfigManager* webcamManager);
+ public slots:
+ virtual void updateSettings();
+ protected slots:
+ virtual void updateWidgetsDefault();
+ protected:
+ virtual bool hasChanged();
+ private:
+ PageWebcamConfigManager* configManager;
};
#endif // WEBCAMDIALOG_H
diff --git a/src/webcamwidget.cpp b/src/webcamwidget.cpp
index b200bd0..dae37d5 100644
--- a/src/webcamwidget.cpp
+++ b/src/webcamwidget.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
*
diff --git a/src/webcamwidget.h b/src/webcamwidget.h
index 2411bf0..73f2384 100644
--- a/src/webcamwidget.h
+++ b/src/webcamwidget.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -68,4 +68,4 @@ private:
Private* d;
};
-#endif
\ No newline at end of file
+#endif //WEBCAMWIDGET
\ No newline at end of file
diff --git a/src/whitewidget.cpp b/src/whitewidget.cpp
index 1ae50c3..7dcb826 100644
--- a/src/whitewidget.cpp
+++ b/src/whitewidget.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -25,17 +25,17 @@
#include <KWindowSystem>
WhiteWidget::WhiteWidget(QWidget* parent)
- : QWidget(parent)
+ : QWidget(parent)
{
- setAutoFillBackground(false);
+ setAutoFillBackground(false);
}
void WhiteWidget::paintEvent (QPaintEvent* paintEvent)
{
- QPainter painter(this);
-
- painter.setBrush(Qt::white);
- painter.drawRect(paintEvent->rect());
- painter.drawText(paintEvent->rect().center(), i18n("Smile! :)"));
-}
+ QPainter painter(this);
+
+ painter.setBrush(Qt::white);
+ painter.drawRect(paintEvent->rect());
+ painter.drawText(paintEvent->rect().center(), i18n("Smile! :)"));
+}
\ No newline at end of file
diff --git a/src/whitewidget.h b/src/whitewidget.h
index f5eae4a..3557f0f 100644
--- a/src/whitewidget.h
+++ b/src/whitewidget.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@gmail.com> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@gmail.com> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -24,10 +24,10 @@
class WhiteWidget : public QWidget
{
- Q_OBJECT
- public:
- WhiteWidget(QWidget* parent=0);
- virtual void paintEvent (QPaintEvent*);
+ Q_OBJECT
+ public:
+ WhiteWidget(QWidget* parent=0);
+ virtual void paintEvent (QPaintEvent*);
};
-#endif
+#endif //WHITEWIDGET
diff --git a/src/whitewidgetmanager.cpp b/src/whitewidgetmanager.cpp
index 28a7758..240fab7 100644
--- a/src/whitewidgetmanager.cpp
+++ b/src/whitewidgetmanager.cpp
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -32,15 +32,15 @@
*/
WhiteWidgetManager::WhiteWidgetManager(QWidget* parent) : QObject(parent)
{
- qDebug() << "WhiteWidgetManager: " << "WhiteWidgetManager has been instanced";
- this->createWhiteWidgets();
- //Call tick each 30 ms on showAll call
- m_timer = new QTimer(this);
- m_currentStep = 0;
- //Maybe we should set it as cons again, but at the moment I'd like the idea to have \
it variable
- //I've also moved it to public scope
- m_steps = 10;
- connect(m_timer, SIGNAL(timeout()), SLOT(tick()));
+ qDebug() << "WhiteWidgetManager: " << "WhiteWidgetManager has been instanced";
+ this->createWhiteWidgets();
+ //Call tick each 30 ms on showAll call
+ m_timer = new QTimer(this);
+ m_currentStep = 0;
+ //Maybe we should set it as cons again, but at the moment I'd like the idea to \
have it variable + //I've also moved it to public scope
+ m_steps = 10;
+ connect(m_timer, SIGNAL(timeout()), SLOT(tick()));
}
/**
@@ -48,17 +48,17 @@ WhiteWidgetManager::WhiteWidgetManager(QWidget* parent) : \
QObject(parent)
*/
void WhiteWidgetManager::createWhiteWidgets()
{
- qDebug() << "WhiteWidgetManager: " << "Creating whiteWidgets";
- WhiteWidget *whiteWidget;
- QDesktopWidget *desktopInfo = qApp->desktop();
-
- qDebug() << "WhiteWidgetManager: " << "Num of whidgets to be created: " << \
desktopInfo->numScreens();
- for(uchar x=0;x<desktopInfo->numScreens();x++)
- {
- whiteWidget = new WhiteWidget;
- whiteWidget->setGeometry(desktopInfo->screenGeometry(x));
- whitewidgetList.append(whiteWidget);
- }
+ qDebug() << "WhiteWidgetManager: " << "Creating whiteWidgets";
+ WhiteWidget *whiteWidget;
+ QDesktopWidget *desktopInfo = qApp->desktop();
+
+ qDebug() << "WhiteWidgetManager: " << "Num of whidgets to be created: " << \
desktopInfo->numScreens(); + for(uchar x=0;x<desktopInfo->numScreens();x++)
+ {
+ whiteWidget = new WhiteWidget;
+ whiteWidget->setGeometry(desktopInfo->screenGeometry(x));
+ whitewidgetList.append(whiteWidget);
+ }
}
/**
@@ -66,23 +66,24 @@ void WhiteWidgetManager::createWhiteWidgets()
*/
void WhiteWidgetManager::showAll()
{
- WhiteWidget *iteratorWidget;
- m_timer->start(30);
- foreach(iteratorWidget,whitewidgetList)
- {
- iteratorWidget->showFullScreen();
- }
+ WhiteWidget *iteratorWidget;
+ m_timer->start(30);
+ foreach(iteratorWidget,whitewidgetList)
+ {
+ iteratorWidget->showFullScreen();
+ }
}
+
/**
*This method is usually called by timeout, and hide all the whiteWidgets
*/
void WhiteWidgetManager::hideAll()
{
- WhiteWidget *iteratorWidget;
- foreach(iteratorWidget,whitewidgetList)
- {
- iteratorWidget->hide();
- }
+ WhiteWidget *iteratorWidget;
+ foreach(iteratorWidget,whitewidgetList)
+ {
+ iteratorWidget->hide();
+ }
}
/**
@@ -90,16 +91,16 @@ void WhiteWidgetManager::hideAll()
*/
void WhiteWidgetManager::tick()
{
- WhiteWidget *iteratorWidget;
- m_currentStep=qMin(m_currentStep+1, m_steps);
- foreach(iteratorWidget,whitewidgetList)
- {
- iteratorWidget->setWindowOpacity(m_currentStep);
- }
+ WhiteWidget *iteratorWidget;
+ m_currentStep=qMin(m_currentStep+1, m_steps);
+ foreach(iteratorWidget,whitewidgetList)
+ {
+ iteratorWidget->setWindowOpacity(m_currentStep);
+ }
}
WhiteWidgetManager::~WhiteWidgetManager()
{
- qDeleteAll(whitewidgetList.begin(),whitewidgetList.end());
- whitewidgetList.clear();
+ qDeleteAll(whitewidgetList.begin(),whitewidgetList.end());
+ whitewidgetList.clear();
}
\ No newline at end of file
diff --git a/src/whitewidgetmanager.h b/src/whitewidgetmanager.h
index 0560a2f..d10ec8f 100644
--- a/src/whitewidgetmanager.h
+++ b/src/whitewidgetmanager.h
@@ -1,6 +1,6 @@
/*************************************************************************************
- * Copyright (C) 2008-2009 by Aleix Pol <aleixpol@kde.org> \
*
- * Copyright (C) 2008-2009 by Alex Fiestas <alex@eyeos.org> \
* + * Copyright (C) 2008-2011 by Aleix Pol <aleixpol@kde.org> \
* + * Copyright (C) 2008-2011 by Alex Fiestas <alex@eyeos.org> \
*
* \
*
* This program is free software; you can redistribute it and/or \
*
* modify it under the terms of the GNU General Public License \
* @@ -17,23 +17,29 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA \
*
*************************************************************************************/
+#ifndef WHITEWIDGETMANAGER_H
+#define WHITEWIDGETMANAGER_H
+
#include <QObject>
#include <QDesktopWidget>
#include "whitewidget.h"
+
class WhiteWidgetManager : public QObject
{
- Q_OBJECT
- public:
- WhiteWidgetManager(QWidget* parent=0);
- ~WhiteWidgetManager();
- void showAll();
- void hideAll();
- int m_steps;
- private:
- void createWhiteWidgets();
- QList<WhiteWidget*> whitewidgetList;
- QTimer* m_timer;
- int m_currentStep;
- private slots:
- void tick();
-};
\ No newline at end of file
+ Q_OBJECT
+ public:
+ WhiteWidgetManager(QWidget* parent=0);
+ ~WhiteWidgetManager();
+ void showAll();
+ void hideAll();
+ int m_steps;
+ private:
+ void createWhiteWidgets();
+ QList<WhiteWidget*> whitewidgetList;
+ QTimer* m_timer;
+ int m_currentStep;
+ private slots:
+ void tick();
+};
+
+#endif //WHITEWIDGETMANAGER
\ No newline at end of file
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic