Full Screen Information
Carles Pina i Estany <[email protected]>
| Newsgroups | gmane.comp.kde.gwenview |
|---|---|
| Message-ID | <[email protected]> |
Hello list, I send my first patch (draft) for Gwenview 2.x. This adds an editline to configuration dialog and user can write some "variables" like %i for ISO, %t for exposure time, etc. This variables are showed in full screen mode, in a QLabel, in the FullScreenWidget (or whatever the name :-) ) I need some help: I'm calling MainWindow::updateFullScreenInformation from MainWindow::slotSelectionChanged . I see that filename is always correct, but if user change the phpoto "too fast" Exif information is not available. Actually: I think that depends of how fast user clicked in the previous image to go to next image (it looks like, you need to stay in one image some seconds and click on "Next" and then it's fine, if you don't wait in the previous image Exif information is not available). Question is: where I should call updateFullScreenInformation ? Is there any signal when image is ready? In slotPartCompleted (called when image is completed?) I had the same problem. Maybe I should use other way? Aurelien and people who knows more about Gwenview (or whoever): if there is a better approach to do this, tell me. I will try to understand and change, it's not a problem to start again with this thing. Talking about User Interface, maybe you would prefer to have a button in Full Screen Mode to setup the full screen mode information. We can think about it. I think that I read here that you prefered to have less things in configuration dialog and setup the things "in place". (Ops, Gwenview crashed one time doing some tests now, maybe is my patch blame) -- Carles Pina i Estany GPG id: 0x8CBDAE64 http://pinux.info Manresa - Barcelona ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Gwenview-general mailing list Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/gwenview-general
fullscreeninformation1.patch
(text/x-diff, 11 KB)
Index: app/configdialog.ui
===================================================================
--- app/configdialog.ui (revision 760103)
+++ app/configdialog.ui (working copy)
@@ -5,29 +5,32 @@
<rect>
<x>0</x>
<y>0</y>
- <width>316</width>
- <height>198</height>
+ <width>313</width>
+ <height>331</height>
</rect>
</property>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string/>
</property>
<layout class="QHBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
@@ -61,26 +64,44 @@
</layout>
</widget>
</item>
- <item>
+ <item row="1" column="0" >
<widget class="KButtonGroup" name="kcfg_AlphaBackgroundMode" >
<property name="title" >
<string>Transparent Image Background</string>
</property>
<layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
<item>
<layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QRadioButton" name="checkBoardRadioButton" >
<property name="text" >
@@ -108,12 +129,21 @@
</item>
<item>
<layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QRadioButton" name="solidColorRadioButton" >
<property name="text" >
@@ -149,15 +179,56 @@
</layout>
</widget>
</item>
- <item>
+ <item row="2" column="0" >
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Full Screen Information:</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLineEdit" name="kcfg_FullScreenInfo" />
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Filenname: %f
+Aperture. %a || Exposure Time: %t
+ISO: %i || Focal Length: %t</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
- <width>75</width>
- <height>51</height>
+ <width>20</width>
+ <height>40</height>
</size>
</property>
</spacer>
@@ -174,6 +245,7 @@
<class>KButtonGroup</class>
<extends>QGroupBox</extends>
<header>kbuttongroup.h</header>
+ <container>1</container>
</customwidget>
</customwidgets>
<resources/>
Index: app/mainwindow.h
===================================================================
--- app/mainwindow.h (revision 760103)
+++ app/mainwindow.h (working copy)
@@ -128,6 +128,8 @@
void configureToolbars();
void slotNewToolbarConfig();
+ void updateFullScreenInformation();
+
private:
class Private;
std::auto_ptr<Private> d;
Index: app/mainwindow.cpp
===================================================================
--- app/mainwindow.cpp (revision 760103)
+++ app/mainwindow.cpp (working copy)
@@ -22,6 +22,7 @@
// Qt
#include <QApplication>
#include <QDesktopWidget>
+#include <QLabel>
#include <QTimer>
#include <QShortcut>
#include <QSplitter>
@@ -70,6 +71,7 @@
#include <lib/document/documentfactory.h>
#include <lib/fullscreenbar.h>
#include <lib/gwenviewconfig.h>
+#include <lib/imagemetainfo.h>
#include <lib/imageviewpart.h>
#include <lib/mimetypeutils.h>
#include <lib/print/printhelper.h>
@@ -463,8 +465,11 @@
mFullScreenBar->addSeparator();
mFullScreenBar->addAction(mToggleSlideShowAction);
+
mFullScreenBar->addWidget(mSlideShow->intervalWidget());
mFullScreenBar->addWidget(mSlideShow->optionsWidget());
+
+ mFullScreenBar->addWidget(mSlideShow->infoWidget());
mFullScreenBar->resize(mFullScreenBar->sizeHint());
}
@@ -786,8 +791,57 @@
}
d->mUrlToSelect = url;
d->selectUrlToSelect();
+
}
+void MainWindow::updateFullScreenInformation() {
+ if (!d->mFullScreenAction->isChecked()) {
+ return;
+ }
+
+ KUrl url = d->currentUrl();
+
+ QString info = GwenviewConfig::fullScreenInfo();
+
+ // ??
+ Document::Ptr doc = DocumentFactory::instance()->load(url);
+ QModelIndex index = d->mDirModel->indexForUrl(url);
+ KFileItem item = d->mDirModel->itemForIndex(index);
+
+ ImageMetaInfo imageMetaInfo;
+ imageMetaInfo.setFileItem(item);
+
+ imageMetaInfo.setImageSize(doc->size());
+ imageMetaInfo.setExiv2Image(doc->exiv2Image());
+
+
+ QString aperture,exposuretime,iso,focallength;
+ QString filename;
+ QString label;
+
+ imageMetaInfo.getInfoForKey("Exif.Photo.FNumber",&label,&aperture);
+
+ imageMetaInfo.getInfoForKey("Exif.Photo.ExposureTime",&label,&exposuretime);
+ imageMetaInfo.getInfoForKey("Exif.Photo.ISOSpeedRatings",&label,&iso);
+ imageMetaInfo.getInfoForKey("Exif.Photo.ISOSpeedRatings",&label,&focallength);
+ imageMetaInfo.getInfoForKey("General.Name",&label,&filename);
+
+ info.replace("%a", aperture);
+ info.replace("%t", exposuretime);
+ info.replace("%i", iso);
+ info.replace("%l", focallength);
+ info.replace("%f", filename);
+
+
+ info="<font color=\"lightgray\">"+info+"</font>";
+
+ QLabel *i = (QLabel*) d->mSlideShow->infoWidget();
+ i->setText(info);
+ i->resize(i->minimumSize());
+
+ d->mFullScreenBar->resize(d->mFullScreenBar->sizeHint());
+}
+
void MainWindow::slotSetStatusBarText(const QString& message) {
d->mDocumentView->statusBar()->showMessage(message);
}
@@ -838,6 +892,9 @@
updatePreviousNextActions();
updateContextManager();
d->spreadCurrentUrl();
+
+ updateFullScreenInformation();
+
QTimer::singleShot(PRELOAD_DELAY, this, SLOT(preloadNextUrl()) );
}
Index: lib/slideshow.cpp
===================================================================
--- lib/slideshow.cpp (revision 760103)
+++ lib/slideshow.cpp (working copy)
@@ -25,6 +25,7 @@
// Qt
#include <QAction>
#include <QDoubleSpinBox>
+#include <QLabel>
#include <QMenu>
#include <QTimer>
#include <QToolButton>
@@ -59,6 +60,7 @@
QDoubleSpinBox* mIntervalSpinBox;
QToolButton* mOptionsButton;
+ QLabel* mInformationLabel;
QAction* mLoopAction;
QAction* mRandomAction;
@@ -146,6 +148,9 @@
d->mOptionsButton = new QToolButton();
d->mOptionsButton->setIcon(KIcon("configure"));
d->mOptionsButton->setToolTip(i18nc("@info:tooltip", "Slideshow options"));
+
+ d->mInformationLabel = new QLabel();
+
QMenu* menu = new QMenu(d->mOptionsButton);
d->mOptionsButton->setMenu(menu);
d->mOptionsButton->setPopupMode(QToolButton::InstantPopup);
@@ -165,7 +170,6 @@
d->mIntervalSpinBox->setValue(SlideShowConfig::interval());
}
-
SlideShow::~SlideShow() {
SlideShowConfig::self()->writeConfig();
delete d;
@@ -235,12 +239,15 @@
return d->mIntervalSpinBox;
}
-
QWidget* SlideShow::optionsWidget() const {
return d->mOptionsButton;
}
+QWidget* SlideShow::infoWidget() const {
+ return d->mInformationLabel;
+}
+
void SlideShow::updateConfig() {
SlideShowConfig::setLoop(d->mLoopAction->isChecked());
SlideShowConfig::setRandom(d->mRandomAction->isChecked());
Index: lib/fullscreenbar.cpp
===================================================================
--- lib/fullscreenbar.cpp (revision 760103)
+++ lib/fullscreenbar.cpp (working copy)
@@ -26,6 +26,7 @@
#include <QBitmap>
#include <QEvent>
#include <QHBoxLayout>
+#include <QLabel>
#include <QTimeLine>
#include <QToolButton>
#include <QTimer>
@@ -46,6 +47,7 @@
QTimeLine* mTimeLine;
QTimer* mAutoHideTimer;
QHBoxLayout* mLayout;
+ QLabel* mInfo;
void startTimeLine() {
if (mTimeLine->state() != QTimeLine::Running) {
Index: lib/slideshow.h
===================================================================
--- lib/slideshow.h (revision 760103)
+++ lib/slideshow.h (working copy)
@@ -46,6 +46,9 @@
QWidget* optionsWidget() const;
+ QWidget* infoWidget () const;
+
+
/** @return true if the slideshow is running */
bool isRunning() const;
Index: lib/gwenviewconfig.kcfg
===================================================================
--- lib/gwenviewconfig.kcfg (revision 760103)
+++ lib/gwenviewconfig.kcfg (working copy)
@@ -16,6 +16,12 @@
</entry>
</group>
+ <group name="FullScreen">
+ <entry name="FullScreenInfo" type="String">
+ <default>%f</default>
+ </entry>
+ </group>
+
<group name="ImageView">
<entry name="AlphaBackgroundMode" type="Enum">
<choices name="Gwenview::ImageView::AlphaBackgroundMode">