Commit 62f327db authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt, help/update: code simplification

parent 25bf26b9
...@@ -57,12 +57,14 @@ HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -57,12 +57,14 @@ HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
setMinimumSize( 350, 300 ); setMinimumSize( 350, 300 );
QVBoxLayout *layout = new QVBoxLayout( this ); QVBoxLayout *layout = new QVBoxLayout( this );
QTextBrowser *helpBrowser = new QTextBrowser( this ); QTextBrowser *helpBrowser = new QTextBrowser( this );
helpBrowser->setOpenExternalLinks( true ); helpBrowser->setOpenExternalLinks( true );
helpBrowser->setHtml( qtr(I_LONGHELP) ); helpBrowser->setHtml( qtr(I_LONGHELP) );
QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this );
QDialogButtonBox *closeButtonBox = new QDialogButtonBox( this );
closeButtonBox->addButton( closeButtonBox->addButton(
new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole ); new QPushButton( qtr("&Close") ), QDialogButtonBox::RejectRole );
closeButtonBox->setFocus(); closeButtonBox->setFocus();
layout->addWidget( helpBrowser ); layout->addWidget( helpBrowser );
...@@ -77,11 +79,6 @@ HelpDialog::~HelpDialog() ...@@ -77,11 +79,6 @@ HelpDialog::~HelpDialog()
writeSettings( "Help" ); writeSettings( "Help" );
} }
void HelpDialog::close()
{
toggleVisible();
}
AboutDialog::AboutDialog( intf_thread_t *_p_intf) AboutDialog::AboutDialog( intf_thread_t *_p_intf)
: QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf ) : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
{ {
...@@ -92,8 +89,8 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) ...@@ -92,8 +89,8 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf)
setWindowTitle( qtr( "About" ) ); setWindowTitle( qtr( "About" ) );
setWindowRole( "vlc-about" ); setWindowRole( "vlc-about" );
resize( 600, 500 );
setMinimumSize( 600, 500 ); setMinimumSize( 600, 500 );
resize( 600, 500 );
setWindowModality( Qt::WindowModal ); setWindowModality( Qt::WindowModal );
CONNECT( ui.closeButtonBox, rejected(), this, close() ); CONNECT( ui.closeButtonBox, rejected(), this, close() );
...@@ -133,15 +130,6 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) ...@@ -133,15 +130,6 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf)
ui.authorsEdit->setText( qfu( psz_authors ) ); ui.authorsEdit->setText( qfu( psz_authors ) );
} }
AboutDialog::~AboutDialog()
{
}
void AboutDialog::close()
{
toggleVisible();
}
#ifdef UPDATE_CHECK #ifdef UPDATE_CHECK
/***************************************************************************** /*****************************************************************************
...@@ -203,11 +191,6 @@ UpdateDialog::~UpdateDialog() ...@@ -203,11 +191,6 @@ UpdateDialog::~UpdateDialog()
writeSettings( "Update" ); writeSettings( "Update" );
} }
void UpdateDialog::close()
{
toggleVisible();
}
/* Check for updates */ /* Check for updates */
void UpdateDialog::UpdateOrDownload() void UpdateDialog::UpdateOrDownload()
{ {
...@@ -283,4 +266,3 @@ void UpdateDialog::updateNotify( bool b_result ) ...@@ -283,4 +266,3 @@ void UpdateDialog::updateNotify( bool b_result )
} }
#endif #endif
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define QVLC_HELP_DIALOG_H_ 1 #define QVLC_HELP_DIALOG_H_ 1
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" # include "config.h"
#endif #endif
#include "qt4.hpp" #include "qt4.hpp"
...@@ -35,12 +35,7 @@ ...@@ -35,12 +35,7 @@
#include "ui/about.h" #include "ui/about.h"
#include "ui/update.h" #include "ui/update.h"
class QPushButton;
class QTextBrowser;
class QLabel;
class QEvent; class QEvent;
class QPushButton;
class QTextEdit;
class HelpDialog : public QVLCFrame, public Singleton<HelpDialog> class HelpDialog : public QVLCFrame, public Singleton<HelpDialog>
{ {
...@@ -50,23 +45,20 @@ private: ...@@ -50,23 +45,20 @@ private:
virtual ~HelpDialog(); virtual ~HelpDialog();
public slots: public slots:
void close(); virtual void close() { toggleVisible(); }
friend class Singleton<HelpDialog>; friend class Singleton<HelpDialog>;
}; };
class AboutDialog : public QVLCDialog, public Singleton<AboutDialog> class AboutDialog : public QVLCDialog, public Singleton<AboutDialog>
{ {
Q_OBJECT Q_OBJECT
private: private:
AboutDialog( intf_thread_t * ); AboutDialog( intf_thread_t * );
virtual ~AboutDialog();
Ui::aboutWidget ui; Ui::aboutWidget ui;
public slots: public slots:
void close(); virtual void close() { toggleVisible(); }
friend class Singleton<AboutDialog>; friend class Singleton<AboutDialog>;
}; };
...@@ -92,7 +84,8 @@ private: ...@@ -92,7 +84,8 @@ private:
bool b_checked; bool b_checked;
private slots: private slots:
void close(); virtual void close() { toggleVisible(); }
void UpdateOrDownload(); void UpdateOrDownload();
friend class Singleton<UpdateDialog>; friend class Singleton<UpdateDialog>;
......
...@@ -188,9 +188,7 @@ protected: ...@@ -188,9 +188,7 @@ protected:
class QVLCMW : public QMainWindow class QVLCMW : public QMainWindow
{ {
public: public:
QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf ) QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf ){}
{ }
virtual ~QVLCMW() {};
void toggleVisible() void toggleVisible()
{ {
if( isVisible() ) hide(); if( isVisible() ) hide();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment