[vlc-commits] Qt, help/update: code simplification
Jean-Baptiste Kempf
git at videolan.org
Wed Apr 27 13:39:29 CEST 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Apr 27 11:51:37 2011 +0200| [62f327dbfd1ab64a04b0b60f8cd044dc5530ed90] | committer: Jean-Baptiste Kempf
Qt, help/update: code simplification
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62f327dbfd1ab64a04b0b60f8cd044dc5530ed90
---
modules/gui/qt4/dialogs/help.cpp | 28 +++++-----------------------
modules/gui/qt4/dialogs/help.hpp | 17 +++++------------
modules/gui/qt4/util/qvlcframe.hpp | 4 +---
3 files changed, 11 insertions(+), 38 deletions(-)
diff --git a/modules/gui/qt4/dialogs/help.cpp b/modules/gui/qt4/dialogs/help.cpp
index 229601e..1ee9000 100644
--- a/modules/gui/qt4/dialogs/help.cpp
+++ b/modules/gui/qt4/dialogs/help.cpp
@@ -57,12 +57,14 @@ HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
setMinimumSize( 350, 300 );
QVBoxLayout *layout = new QVBoxLayout( this );
+
QTextBrowser *helpBrowser = new QTextBrowser( this );
helpBrowser->setOpenExternalLinks( true );
helpBrowser->setHtml( qtr(I_LONGHELP) );
- QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this );
+
+ QDialogButtonBox *closeButtonBox = new QDialogButtonBox( this );
closeButtonBox->addButton(
- new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole );
+ new QPushButton( qtr("&Close") ), QDialogButtonBox::RejectRole );
closeButtonBox->setFocus();
layout->addWidget( helpBrowser );
@@ -77,11 +79,6 @@ HelpDialog::~HelpDialog()
writeSettings( "Help" );
}
-void HelpDialog::close()
-{
- toggleVisible();
-}
-
AboutDialog::AboutDialog( intf_thread_t *_p_intf)
: QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
{
@@ -92,8 +89,8 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf)
setWindowTitle( qtr( "About" ) );
setWindowRole( "vlc-about" );
- resize( 600, 500 );
setMinimumSize( 600, 500 );
+ resize( 600, 500 );
setWindowModality( Qt::WindowModal );
CONNECT( ui.closeButtonBox, rejected(), this, close() );
@@ -133,15 +130,6 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf)
ui.authorsEdit->setText( qfu( psz_authors ) );
}
-AboutDialog::~AboutDialog()
-{
-}
-
-void AboutDialog::close()
-{
- toggleVisible();
-}
-
#ifdef UPDATE_CHECK
/*****************************************************************************
@@ -203,11 +191,6 @@ UpdateDialog::~UpdateDialog()
writeSettings( "Update" );
}
-void UpdateDialog::close()
-{
- toggleVisible();
-}
-
/* Check for updates */
void UpdateDialog::UpdateOrDownload()
{
@@ -283,4 +266,3 @@ void UpdateDialog::updateNotify( bool b_result )
}
#endif
-
diff --git a/modules/gui/qt4/dialogs/help.hpp b/modules/gui/qt4/dialogs/help.hpp
index 117cadf..d314f21 100644
--- a/modules/gui/qt4/dialogs/help.hpp
+++ b/modules/gui/qt4/dialogs/help.hpp
@@ -25,7 +25,7 @@
#define QVLC_HELP_DIALOG_H_ 1
#ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
#endif
#include "qt4.hpp"
@@ -35,12 +35,7 @@
#include "ui/about.h"
#include "ui/update.h"
-class QPushButton;
-class QTextBrowser;
-class QLabel;
class QEvent;
-class QPushButton;
-class QTextEdit;
class HelpDialog : public QVLCFrame, public Singleton<HelpDialog>
{
@@ -50,23 +45,20 @@ private:
virtual ~HelpDialog();
public slots:
- void close();
+ virtual void close() { toggleVisible(); }
friend class Singleton<HelpDialog>;
};
-
class AboutDialog : public QVLCDialog, public Singleton<AboutDialog>
{
Q_OBJECT
-
private:
AboutDialog( intf_thread_t * );
- virtual ~AboutDialog();
Ui::aboutWidget ui;
public slots:
- void close();
+ virtual void close() { toggleVisible(); }
friend class Singleton<AboutDialog>;
};
@@ -92,7 +84,8 @@ private:
bool b_checked;
private slots:
- void close();
+ virtual void close() { toggleVisible(); }
+
void UpdateOrDownload();
friend class Singleton<UpdateDialog>;
diff --git a/modules/gui/qt4/util/qvlcframe.hpp b/modules/gui/qt4/util/qvlcframe.hpp
index edaa08b..832a5bd 100644
--- a/modules/gui/qt4/util/qvlcframe.hpp
+++ b/modules/gui/qt4/util/qvlcframe.hpp
@@ -188,9 +188,7 @@ protected:
class QVLCMW : public QMainWindow
{
public:
- QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
- { }
- virtual ~QVLCMW() {};
+ QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf ){}
void toggleVisible()
{
if( isVisible() ) hide();
More information about the vlc-commits
mailing list