]> git.sesse.net Git - vlc/commitdiff
kde.cpp: subscribe and unsubscribe messages
authorSigmund Augdal Helberg <sigmunau@videolan.org>
Thu, 3 Oct 2002 10:15:01 +0000 (10:15 +0000)
committerSigmund Augdal Helberg <sigmunau@videolan.org>
Thu, 3 Oct 2002 10:15:01 +0000 (10:15 +0000)
 interface.cpp, interface.h: create a messages window, and add menu iten to
show it
 Modules.as: build messages window
 ui.rc: menuitem to show messages
 preferences.cpp: fixed typo in comment

modules/gui/kde/Modules.am
modules/gui/kde/interface.cpp
modules/gui/kde/interface.h
modules/gui/kde/kde.cpp
modules/gui/kde/preferences.cpp
modules/gui/kde/ui.rc

index 6b97ae31bf29fe279c12fd848989fc6eea924ca7..a690d01bdea3a0175e95f2249620efd70e0b0f3e 100644 (file)
@@ -7,7 +7,8 @@ SOURCES_kde = \
        modules/gui/kde/menu.cpp \
        modules/gui/kde/preferences.cpp \
        modules/gui/kde/pluginsbox.cpp \
-       modules/gui/kde/QConfigItem.cpp
+       modules/gui/kde/QConfigItem.cpp \
+       modules/gui/kde/messages.cpp
 
 nodist_SOURCES_kde = \
        modules/gui/kde/interface.moc.cpp \
@@ -17,7 +18,8 @@ nodist_SOURCES_kde = \
        modules/gui/kde/menu.moc.cpp \
        modules/gui/kde/preferences.moc.cpp \
        modules/gui/kde/pluginsbox.moc.cpp \
-       modules/gui/kde/QConfigItem.moc.cpp
+       modules/gui/kde/QConfigItem.moc.cpp \
+       modules/gui/kde/messages.moc.cpp
 
 noinst_HEADERS += \
        modules/gui/kde/common.h \
@@ -28,7 +30,8 @@ noinst_HEADERS += \
        modules/gui/kde/net.h \
        modules/gui/kde/pluginsbox.h \
        modules/gui/kde/preferences.h \
-       modules/gui/kde/slider.h
+       modules/gui/kde/slider.h \
+       modules/gui/kde/messages.h
 
 modules/gui/kde/interface.moc.cpp: modules/gui/kde/interface.h
        $(MOC) $< -o $@
@@ -46,5 +49,7 @@ modules/gui/kde/pluginsbox.moc.cpp: modules/gui/kde/pluginsbox.h
        $(MOC) $< -o $@
 modules/gui/kde/QConfigItem.moc.cpp: modules/gui/kde/QConfigItem.h
        $(MOC) $< -o $@
+modules/gui/kde/messages.moc.cpp: modules/gui/kde/messages.h
+       $(MOC) $< -o $@
 
 EXTRA_DIST += modules/gui/kde/ui.rc
index 4dd2f02814258ad5744104e95c0a47156bfe1535..9c6508560973564809a070d98dd2a07f35d348b1 100644 (file)
@@ -37,7 +37,8 @@ KInterface::KInterface( intf_thread_t *p_intf, QWidget *parent,
     setAcceptDrops(true);
 
     this->p_intf = p_intf;
-
+    p_messagesWindow = new KMessagesWindow( p_intf, p_intf->p_sys->p_msg );
+    p_messagesWindow->show();
     fDiskDialog = new KDiskDialog( this );
     fNetDialog = new KNetDialog( this );
     fTitleMenu = new KTitleMenu( p_intf, this );
@@ -98,6 +99,7 @@ void KInterface::initActions()
     fast = new KAction( i18n( "Fas&t" ), 0, 0, this, SLOT( slotFast() ), actionCollection(), "fast" );
     prev = new KAction( i18n( "Prev" ), 0, 0, this, SLOT( slotPrev() ), actionCollection(), "prev" );
     next = new KAction( i18n( "Next" ), 0, 0, this, SLOT( slotNext() ), actionCollection(), "next" );
+    messages = new KAction( _( "Messages..." ), 0, 0, this, SLOT( slotShowMessages() ), actionCollection(), "view_messages");
     
     fileOpen->setStatusText(i18n("Opens an existing document"));
     fileOpenRecent->setStatusText(i18n("Opens a recently used file"));
@@ -118,7 +120,8 @@ void KInterface::initActions()
     next->setStatusText( i18n( "Next" ) );
     // use the absolute path to your ktestui.rc file for testing purpose in createGUI();
 
-    createGUI( DATA_PATH "/vlc_kde_ui.rc" );
+    createGUI( DATA_PATH "/ui.rc" );
+//    createGUI( "./modules/gui/kde/ui.rc" );
 }
 
 void KInterface::initStatusBar()
@@ -134,6 +137,10 @@ void KInterface::initStatusBar()
 /////////////////////////////////////////////////////////////////////
 // SLOT IMPLEMENTATION
 /////////////////////////////////////////////////////////////////////
+void KInterface::slotShowMessages()
+{
+    p_messagesWindow->show();
+}
 
 void KInterface::slotFileOpen()
 {
@@ -231,6 +238,8 @@ void KInterface::slotStatusMsg(const QString &text)
 
 void KInterface::slotManage()
 {
+    p_messagesWindow->update();
+    p_intf->p_sys->p_app->processEvents();
     vlc_mutex_lock( &p_intf->change_lock );
 
     /* Update the input */
@@ -275,6 +284,7 @@ void KInterface::slotManage()
     }
 
     vlc_mutex_unlock( &p_intf->change_lock );
+
 }
 
 void KInterface::slotSliderMoved( int position )
index 2a347b1f51434f1b7ba0a0f5d2b4af562a890ced..66e1568454ee1019ecd7092703938f977c72bfd2 100644 (file)
@@ -17,7 +17,7 @@
 #include <qdragobject.h>
 #include <qstring.h>
 #include <qwidget.h>
-
+#include "messages.h"
 class KThread;
 
 class KDiskDialog;
@@ -67,6 +67,7 @@ class KInterface : public KMainWindow
          * @param text the text that is displayed in the statusbar
          */
         void slotStatusMsg( const QString &text );
+        void slotShowMessages();
 
     protected:
         /** initializes the KActions of the application */
@@ -103,6 +104,7 @@ class KInterface : public KMainWindow
   private:
 
         intf_thread_t    *p_intf;
+        KMessagesWindow *p_messagesWindow;
 
         /** to call p_intf->pf_manage every now and then */
         QTimer            *fTimer;
@@ -135,6 +137,7 @@ class KInterface : public KMainWindow
         KAction             *fast;
         KAction             *prev;
         KAction             *next;
+        KAction             *messages;
         KAction             *preferences;
 };
 
@@ -148,6 +151,7 @@ struct intf_sys_t
     KAboutData   *p_about;
 
     input_thread_t *p_input;
+    msg_subscription_t *p_msg;
 };
 
 #endif /* _KDE_INTERFACE_H_ */
index ca1e9afa2fa38b3bf4851baba971833ac7665965..69aa3271e67f78274b644ada14140d14db71ab3c 100644 (file)
@@ -2,7 +2,7 @@
  * kde.cpp : KDE plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: kde.cpp,v 1.2 2002/08/18 13:14:39 sigmunau Exp $
+ * $Id: kde.cpp,v 1.3 2002/10/03 10:15:01 sigmunau Exp $
  *
  * Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
  *
@@ -94,6 +94,7 @@ static void close(vlc_object_t *p_this)
     
     delete p_intf->p_sys->p_app;
     delete p_intf->p_sys->p_about;
+    msg_Unsubscribe(p_intf, p_intf->p_sys->p_msg);
     free( p_intf->p_sys );
 }
 
@@ -113,19 +114,16 @@ void run(intf_thread_t *p_intf)
          _("(C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 - the VideoLAN Team"),
          0, 0, "");
  
-    char *authors[][2] = {
-        { "the VideoLAN Team", "<videolan@videolan.org>" },
-        { NULL, NULL },
-    };
-
-    for ( int i = 0; NULL != authors[i][0]; i++ ) {
-        p_intf->p_sys->p_about->addAuthor( authors[i][0], 0, authors[i][1] );
-    }
+    p_intf->p_sys->p_about->addAuthor( "the VideoLAN Team", 0,
+                                       "<videolan@videolan.org>" );
 
     int argc = 1;
     char *argv[] = { p_intf->p_vlc->psz_object_name, NULL };
     KCmdLineArgs::init( argc, argv, p_intf->p_sys->p_about );
 
+    /* Subscribe to message queue */
+    p_intf->p_sys->p_msg = msg_Subscribe( p_intf );
+
     p_intf->p_sys->p_app = new KApplication();
     p_intf->p_sys->p_window = new KInterface(p_intf);
     p_intf->p_sys->p_window->setCaption( VOUT_TITLE " (KDE interface)" );
index 1705f8cadd24eb321a1d8a9ae869e9b580b887a3..af69b19da5b26610d6b372d4916eb8631a48bb68 100644 (file)
@@ -2,7 +2,7 @@
  * preferences.cpp: preferences window for the kde gui
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: preferences.cpp,v 1.4 2002/08/15 12:11:15 sam Exp $
+ * $Id: preferences.cpp,v 1.5 2002/10/03 10:15:01 sigmunau Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
  *
@@ -44,7 +44,7 @@
 #include "preferences.h"
 
 /*
- construkt a new configuration window for the given module
+ construct a new configuration window for the given module
 */
 KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
                            QWidget *parent, const QString &caption) :
index 8f0d817cfdc0bce1b7759d49a36c3fc9ba4907b7..6098346cabdcf8ab5b13bed24c2c5460a651e29a 100644 (file)
     <Separator lineSeparator="true"/>
     <Action name="file_quit"/>
   </Menu>
+  <Menu name="view" noMerge="1">
+    <text>&amp;View</text>
+    <Action name="view_messages"/>
+  </Menu>
 </MenuBar>
 
 <ToolBar name="mainToolBar" iconText="icononly" iconSize="16" noMerge="1">