Re: Full Screen Information

Carles Pina i Estany <[email protected]>
Newsgroups gmane.comp.kde.gwenview
Message-ID <[email protected]>
Hello!

On Jan/15/2008, Aurélien Gâteau wrote:

I send a new patch. But some help is welcomed in one part :-) (not fully
working)

> Thanks for the patch. I have a few things I would like to see changed in it 
> though:
> 
> - You should not call updateFullScreenInformation() from 
> slotSelectionChanged(). Instead, I suggest you add code like this in 
> openDocumentUrl():
> 
> 	Document::Ptr doc = DocumentFactory::instance()->load(url);
> 	connect(doc.data(), SIGNAL(metaDataLoaded()),
> 		SLOT(updateFullScreenInformation()) );
> 
> 	if (doc->isMetaDataLoaded()) {
> 		updateFullScreenInformation();
> 	}

I did it, thanks for the suggestion. But still not working always:
sometimes information is not loaded :-o (at least the name, what I'm
checking in my tests now)

Forwarding the photos in "fast" way is the problem (or faster than meta
information is loaded). Any other idea?

I wonder if signal metaDataLoaded is correctly "signaled". Is it?

I will try to look on it during weekend, but maybe you are faster than
me :-)

> Put this after the call to DocumentView::openUrl(). This way your label will 
> be updated whenever the metadata is available

It's not :-|

Other suggestions/mistakes that you sent in the same mail are correctly
addressed.

Thanks for your help,

-- 
Carles Pina i Estany		GPG id: 0x8CBDAE64
	http://pinux.info	Manresa - Barcelona

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Gwenview-general mailing list
Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/gwenview-general
exifinformation2.patch (text/x-diff, 10.4 KB)
Index: app/configdialog.ui
===================================================================
--- app/configdialog.ui	(revision 763443)
+++ 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 763443)
+++ 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 763443)
+++ 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>
@@ -165,6 +167,8 @@
 
 	QString mCaption;
 
+	QLabel *mInformationLabel;
+
 	void setupWidgets() {
 		QWidget* centralWidget = new QWidget(mWindow);
 		mWindow->setCentralWidget(centralWidget);
@@ -190,6 +194,8 @@
 
 		mSlideShow = new SlideShow(mWindow);
 
+		mInformationLabel = new QLabel();
+		
 		connect(mSaveBar, SIGNAL(requestSave(const KUrl&)),
 			mWindow, SLOT(save(const KUrl&)) );
 		connect(mSaveBar, SIGNAL(goToUrl(const KUrl&)),
@@ -462,6 +468,8 @@
 		mFullScreenBar->addWidget(mSlideShow->intervalWidget());
 		mFullScreenBar->addWidget(mSlideShow->optionsWidget());
 
+		mFullScreenBar->addWidget(mInformationLabel);
+
 		mFullScreenBar->resize(mFullScreenBar->sizeHint());
 	}
 
@@ -780,10 +788,61 @@
 	if (!d->mDocumentView->openUrl(url)) {
 		return;
 	}
+
+	Document::Ptr doc = DocumentFactory::instance()->load(url);
+	connect(doc.data(),SIGNAL(metaDataLoaded()), 
+		SLOT(updateFullScreenInformation()) );
+
+	if (doc->isMetaDataLoaded()) {
+		updateFullScreenInformation();
+	}	
+	
+
 	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.FocalLength",&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);
+
+	d->mInformationLabel->setText(info);
+	d->mInformationLabel->resize(d->mInformationLabel->minimumSize());
+	//d->mFullScreenBar->resize(d->mFullScreenBar->sizeHint());
+}
+
 void MainWindow::slotSetStatusBarText(const QString& message) {
 	d->mDocumentView->statusBar()->showMessage(message);
 }
Index: lib/slideshow.cpp
===================================================================
--- lib/slideshow.cpp	(revision 763443)
+++ lib/slideshow.cpp	(working copy)
@@ -164,8 +164,6 @@
 	d->mRandomAction->setChecked(SlideShowConfig::random());
 	d->mIntervalSpinBox->setValue(SlideShowConfig::interval());
 }
-
-
 SlideShow::~SlideShow() {
 	SlideShowConfig::self()->writeConfig();
 	delete d;
@@ -201,14 +199,12 @@
 	SlideShowConfig::setInterval(sInterval);
 }
 
-
 void SlideShow::stop() {
 	d->mTimer->stop();
 	d->mStarted=false;
 	stateChanged(false);
 }
 
-
 void SlideShow::slotTimeout() {
 	LOG("");
 	KUrl url = d->findNextUrl();
@@ -235,12 +231,10 @@
 	return d->mIntervalSpinBox;
 }
 
-
 QWidget* SlideShow::optionsWidget() const {
 	return d->mOptionsButton;
 }
 
-
 void SlideShow::updateConfig() {
 	SlideShowConfig::setLoop(d->mLoopAction->isChecked());
 	SlideShowConfig::setRandom(d->mRandomAction->isChecked());
Index: lib/fullscreenbar.cpp
===================================================================
--- lib/fullscreenbar.cpp	(revision 763443)
+++ lib/fullscreenbar.cpp	(working copy)
@@ -95,6 +95,9 @@
 		"		stop:0 #222, stop: 0.6 black, stop:1 black);"
 		"	border: 1px solid #444;"
 		"}"
+		"QLabel {"
+		"	color:lightgray;"
+		"}"
 		);
 
 	d->mTimeLine = new QTimeLine(SLIDE_DURATION, this);
Index: lib/gwenviewconfig.kcfg
===================================================================
--- lib/gwenviewconfig.kcfg	(revision 763443)
+++ 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">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.