mirror of https://code.videolan.org/videolan/vlc
qt: use singleton in OpenDialog
This commit is contained in:
parent
960a101ec8
commit
63033c7cb7
|
@ -36,16 +36,15 @@
|
|||
# define DEBUG_QT 1
|
||||
#endif
|
||||
|
||||
OpenDialog *OpenDialog::instance = NULL;
|
||||
|
||||
OpenDialog* OpenDialog::getInstance( qt_intf_t *p_intf,
|
||||
bool b_rawInstance, int _action_flag, bool b_selectMode )
|
||||
{
|
||||
/* Creation */
|
||||
if( !instance )
|
||||
instance = new OpenDialog( nullptr, p_intf, b_selectMode,
|
||||
_action_flag );
|
||||
else if( !b_rawInstance )
|
||||
const auto instance = Singleton<OpenDialog>::getInstance(nullptr,
|
||||
p_intf,
|
||||
b_selectMode,
|
||||
_action_flag);
|
||||
|
||||
if( !b_rawInstance )
|
||||
{
|
||||
/* Request the instance but change small details:
|
||||
- Button menu */
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "widgets/native/qvlcframe.hpp"
|
||||
#include "dialogs/open/open_panels.hpp"
|
||||
#include "util/singleton.hpp"
|
||||
|
||||
/* Auto-generated from .ui files */
|
||||
#include "ui_open.h"
|
||||
|
@ -55,20 +56,16 @@ enum {
|
|||
|
||||
class QString;
|
||||
|
||||
class OpenDialog : public QVLCDialog
|
||||
class OpenDialog : public QVLCDialog, public Singleton<OpenDialog>
|
||||
{
|
||||
friend Singleton<OpenDialog>;
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
static OpenDialog * getInstance(qt_intf_t *p_intf,
|
||||
bool b_rawInstance = false, int _action_flag = 0,
|
||||
bool b_selectMode = false );
|
||||
|
||||
static void killInstance()
|
||||
{
|
||||
delete instance;
|
||||
instance = NULL;
|
||||
}
|
||||
|
||||
void showTab( int = OPEN_FILE_TAB );
|
||||
QString getMRL( bool b = true );
|
||||
|
||||
|
@ -87,8 +84,6 @@ private:
|
|||
int _action_flag = 0 );
|
||||
virtual ~OpenDialog();
|
||||
|
||||
static OpenDialog *instance;
|
||||
|
||||
QString optionsMRL;
|
||||
QString storedMethod;
|
||||
QStringList itemsMRL;
|
||||
|
|
Loading…
Reference in New Issue