]> git.sesse.net Git - kdenlive/commitdiff
Nice little icons in rec monitor for user info
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 22 Jul 2008 09:13:53 +0000 (09:13 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 22 Jul 2008 09:13:53 +0000 (09:13 +0000)
svn path=/branches/KDE4/; revision=2343

src/recmonitor.cpp
src/recmonitor.h

index bb49cb426d9eba4e5701b4b4034d51631bc2ab79..1680a9232c32619606632b7674943860a84d24fa 100644 (file)
@@ -113,7 +113,8 @@ void RecMonitor::slotVideoDeviceChanged(int ix) {
         m_recAction->setEnabled(true);
         m_stopAction->setEnabled(false);
         m_playAction->setEnabled(false);
-        ui.video_frame->setText(i18n("Press record button\nto start screen capture"));
+       ui.video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture")));
+        //ui.video_frame->setText(i18n("Press record button\nto start screen capture"));
         break;
     case VIDEO4LINUX:
         m_discAction->setEnabled(false);
@@ -131,17 +132,37 @@ void RecMonitor::slotVideoDeviceChanged(int ix) {
         m_playAction->setEnabled(false);
         m_rewAction->setEnabled(false);
         m_fwdAction->setEnabled(false);
-        ui.video_frame->setText(i18n("Press connect button\nto initialize connection"));
+        //ui.video_frame->setText(i18n("Plug your camcorder and\npress connect button\nto initialize connection"));
+       ui.video_frame->setPixmap(mergeSideBySide(KIcon("network-connect").pixmap(QSize(50, 50)), i18n("Plug your camcorder and\npress connect button\nto initialize connection")));
         break;
     }
 }
 
+QPixmap RecMonitor::mergeSideBySide( const QPixmap& pix, const QString txt )
+{
+    QPainter p;
+    int strWidth = p.fontMetrics().boundingRect( QRect(0, 0, ui.video_frame->width(), ui.video_frame->height()), Qt::AlignLeft, txt ).width();
+    int strHeight = p.fontMetrics().height();
+    int pixWidth = pix.width();
+    int pixHeight = pix.height();
+    QPixmap res( strWidth + 8 + pixWidth, qMax( strHeight, pixHeight ) );
+    res.fill(Qt::transparent);
+    p.begin( &res );
+    p.drawPixmap(0,0, pix );
+    p.drawText( QRect( pixWidth +8, 0, strWidth, pixHeight), 0, txt );
+    p.end();
+    return res;
+}
+
+
 void RecMonitor::checkDeviceAvailability() {
     if (!KIO::NetAccess::exists(KUrl(KdenliveSettings::video4vdevice()), KIO::NetAccess::SourceSide , this)) {
         m_playAction->setEnabled(false);
         m_recAction->setEnabled(false);
-        ui.video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()));
-    } else ui.video_frame->setText(i18n("Press play or record button\nto start video capture"));
+       ui.video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice())));
+        //ui.video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()));
+    } else //ui.video_frame->setText(i18n("Press play or record button\nto start video capture"));
+       ui.video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Press play or record button\nto start video capture")));
 }
 
 void RecMonitor::slotDisconnect() {
index 0f6ac33dfc832b9ebff8efd8bb7d6435406255fd..3ff604d52c103e3887307dcdce65ac6b91f54b4f 100644 (file)
@@ -72,6 +72,7 @@ private:
     QAction *m_stopAction;
     QAction *m_discAction;
     void checkDeviceAvailability();
+    QPixmap mergeSideBySide( const QPixmap& pix, const QString txt );
 
 private slots:
     void slotStartCapture(bool play = true);