Commit 54cfbbc8 authored by Clément Stenac's avatar Clément Stenac

* Some Qt interaction stuff

* More useless interaction cleanup
* Small fix for make beautifier
parent 1c98d750
...@@ -29,6 +29,7 @@ while(<STDIN>) ...@@ -29,6 +29,7 @@ while(<STDIN>)
$line =~ /^test\s\-z\s/ || $line =~ /^test\s\-z\s/ ||
$line =~ /^Making\sclean\sin\s\./ || $line =~ /^Making\sclean\sin\s\./ ||
$line =~ /then\smv\s-f/ || $line =~ /then\smv\s-f/ ||
$line =~ /.*make\s\s.*/ ||
$line =~ /make\s\sall-recursive/ || $line =~ /make\s\sall-recursive/ ||
$line =~ /[A-z0-9-]*ar\s[A-z0-9]*\s([A-z0-9\-_\/\.]*)\s.*/ || $line =~ /[A-z0-9-]*ar\s[A-z0-9]*\s([A-z0-9\-_\/\.]*)\s.*/ ||
$line =~ /^[A-z0-9-]*ranlib\s[A-z0-9-_]*plugin(.*)/ || $line =~ /^[A-z0-9-]*ranlib\s[A-z0-9-_]*plugin(.*)/ ||
...@@ -42,11 +43,10 @@ while(<STDIN>) ...@@ -42,11 +43,10 @@ while(<STDIN>)
$line =~ s/^.* (lib.*\.so).*/ LINK : $1/g || $line =~ s/^.* (lib.*\.so).*/ LINK : $1/g ||
$line =~ s/^.* (lib.*\.o)\s\.\/(.*)/ COMPILE : $2/g || $line =~ s/^.* (lib.*\.o)\s\.\/(.*)/ COMPILE : $2/g ||
$line =~ s/^.* (lib.*\.o)\s`.*`(.*);\ \\/ COMPILE : $2/ || $line =~ s/^.* (lib.*\.o)\s`.*`(.*);\ \\/ COMPILE : $2/ ||
$line =~ s/.*\-o\s([^\s]*)\s`.*`([^\s]*);.*/ COMPILE : $2/g ||
$line =~ s/^[A-z0-9-]*ranlib\s(.*)/ RANLIB : $1/g || $line =~ s/^[A-z0-9-]*ranlib\s(.*)/ RANLIB : $1/g ||
$line =~ s/^Making\sall\sin\s(.*)/MAKE : $1/g || $line =~ s/^Making\sall\sin\s(.*)/MAKE : $1/g ||
$line =~ s/^Making\sclean\sin\s(.*)/CLEAN : $1/g || $line =~ s/^Making\sclean\sin\s(.*)/CLEAN : $1/g )
$line =~ s/.*\-o\s([^\s]*)\s.*/ BUILD : $1/g)
{ {
print $info.$line.$reset."\n"; print $info.$line.$reset."\n";
} }
...@@ -68,5 +68,4 @@ while(<STDIN>) ...@@ -68,5 +68,4 @@ while(<STDIN>)
{ {
print $line."\n"; print $line."\n";
} }
} }
...@@ -81,19 +81,17 @@ struct interaction_dialog_t ...@@ -81,19 +81,17 @@ struct interaction_dialog_t
}; };
/** /**
* Possible flags . Reusable and button types * Possible flags . Dialog types
*/ */
#define DIALOG_REUSABLE 0x01 #define DIALOG_GOT_ANSWER 0x01
#define DIALOG_YES_NO_CANCEL 0x04 #define DIALOG_YES_NO_CANCEL 0x02
#define DIALOG_CLEAR_NOSHOW 0x08 #define DIALOG_LOGIN_PW_OK_CANCEL 0x04
#define DIALOG_GOT_ANSWER 0x10 #define DIALOG_PSZ_INPUT_OK_CANCEL 0x08
#define DIALOG_LOGIN_PW_OK_CANCEL 0x20 #define DIALOG_BLOCKING_ERROR 0x10
#define DIALOG_BLOCKING_ERROR 0x24 #define DIALOG_NONBLOCKING_ERROR 0x20
#define DIALOG_NONBLOCKING_ERROR 0x200 #define DIALOG_WARNING 0x40
#define DIALOG_USER_PROGRESS 0x40 #define DIALOG_USER_PROGRESS 0x80
#define DIALOG_PSZ_INPUT_OK_CANCEL 0x80
#define DIALOG_INTF_PROGRESS 0x100 #define DIALOG_INTF_PROGRESS 0x100
#define DIALOG_WARNING 0x400
/** /**
* Possible return codes * Possible return codes
......
...@@ -559,7 +559,7 @@ aviindex: ...@@ -559,7 +559,7 @@ aviindex:
_( "This AVI file is broken. Seeking will not " _( "This AVI file is broken. Seeking will not "
"work correctly.\nDo you want to " "work correctly.\nDo you want to "
"try to repair it (this might take a long time) ?" ), "try to repair it (this might take a long time) ?" ),
_( "Repair" ), _( "Don't repair" ), NULL ); _( "Repair" ), _( "Don't repair" ), _( "Cancel") );
if( i_create == DIALOG_OK_YES ) if( i_create == DIALOG_OK_YES )
{ {
b_index = VLC_TRUE; b_index = VLC_TRUE;
......
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
#define AVI_DEBUG 1 #define AVI_DEBUG 1
#define FREE( p ) \
if( p ) {free( p ); p = NULL; }
#define __EVEN( x ) ( (x)&0x01 ? (x)+1 : (x) ) #define __EVEN( x ) ( (x)&0x01 ? (x)+1 : (x) )
static vlc_fourcc_t GetFOURCC( byte_t *p_buff ) static vlc_fourcc_t GetFOURCC( byte_t *p_buff )
...@@ -417,11 +414,11 @@ static void AVI_ChunkFree_strf( avi_chunk_t *p_chk ) ...@@ -417,11 +414,11 @@ static void AVI_ChunkFree_strf( avi_chunk_t *p_chk )
avi_chunk_strf_t *p_strf = (avi_chunk_strf_t*)p_chk; avi_chunk_strf_t *p_strf = (avi_chunk_strf_t*)p_chk;
if( p_strf->common.i_cat == AUDIO_ES ) if( p_strf->common.i_cat == AUDIO_ES )
{ {
FREE( p_strf->auds.p_wf ); FREENULL( p_strf->auds.p_wf );
} }
else if( p_strf->common.i_cat == VIDEO_ES ) else if( p_strf->common.i_cat == VIDEO_ES )
{ {
FREE( p_strf->vids.p_bih ); FREENULL( p_strf->vids.p_bih );
} }
} }
...@@ -471,7 +468,7 @@ static void AVI_ChunkFree_idx1( avi_chunk_t *p_chk ) ...@@ -471,7 +468,7 @@ static void AVI_ChunkFree_idx1( avi_chunk_t *p_chk )
{ {
p_chk->idx1.i_entry_count = 0; p_chk->idx1.i_entry_count = 0;
p_chk->idx1.i_entry_max = 0; p_chk->idx1.i_entry_max = 0;
FREE( p_chk->idx1.entry ) FREENULL( p_chk->idx1.entry )
} }
...@@ -556,9 +553,9 @@ static void AVI_ChunkFree_indx( avi_chunk_t *p_chk ) ...@@ -556,9 +553,9 @@ static void AVI_ChunkFree_indx( avi_chunk_t *p_chk )
{ {
avi_chunk_indx_t *p_indx = (avi_chunk_indx_t*)p_chk; avi_chunk_indx_t *p_indx = (avi_chunk_indx_t*)p_chk;
FREE( p_indx->idx.std ); FREENULL( p_indx->idx.std );
FREE( p_indx->idx.field ); FREENULL( p_indx->idx.field );
FREE( p_indx->idx.super ); FREENULL( p_indx->idx.super );
} }
...@@ -629,8 +626,8 @@ static int AVI_ChunkRead_strz( stream_t *s, avi_chunk_t *p_chk ) ...@@ -629,8 +626,8 @@ static int AVI_ChunkRead_strz( stream_t *s, avi_chunk_t *p_chk )
static void AVI_ChunkFree_strz( avi_chunk_t *p_chk ) static void AVI_ChunkFree_strz( avi_chunk_t *p_chk )
{ {
avi_chunk_STRING_t *p_strz = (avi_chunk_STRING_t*)p_chk; avi_chunk_STRING_t *p_strz = (avi_chunk_STRING_t*)p_chk;
FREE( p_strz->p_type ); FREENULL( p_strz->p_type );
FREE( p_strz->p_str ); FREENULL( p_strz->p_str );
} }
static int AVI_ChunkRead_nothing( stream_t *s, avi_chunk_t *p_chk ) static int AVI_ChunkRead_nothing( stream_t *s, avi_chunk_t *p_chk )
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
#include <QMessageBox>
#include "dialogs/interaction.hpp" #include "dialogs/interaction.hpp"
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
#include <vlc/intf.h> #include <vlc/intf.h>
...@@ -29,15 +30,14 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, ...@@ -29,15 +30,14 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
interaction_dialog_t *_p_dialog ) : QWidget( 0 ), interaction_dialog_t *_p_dialog ) : QWidget( 0 ),
p_intf( _p_intf), p_dialog( _p_dialog ) p_intf( _p_intf), p_dialog( _p_dialog )
{ {
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout( this );
int i_ret = -1;
uiLogin = NULL; uiLogin = NULL;
uiProgress = NULL; uiProgress = NULL;
uiInput = NULL; uiInput = NULL;
if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR ) if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR )
{ {
} }
else if( p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR ) else if( p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
{ {
...@@ -45,9 +45,15 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, ...@@ -45,9 +45,15 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
} }
else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
{ {
description = new QLabel( 0 ); i_ret = QMessageBox::question( this,
description->setText( qfu(p_dialog->psz_description) ); qfu( p_dialog->psz_title), qfu( p_dialog->psz_description ),
layout->addWidget(description); p_dialog->psz_default_button ?
qfu( p_dialog->psz_default_button ) : QString::null,
p_dialog->psz_alternate_button ?
qfu( p_dialog->psz_alternate_button ) : QString::null,
p_dialog->psz_other_button ?
qfu( p_dialog->psz_other_button ) : QString::null, 0,
p_dialog->psz_other_button ? 2 : -1 );
} }
else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL ) else if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
{ {
...@@ -65,19 +71,30 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf, ...@@ -65,19 +71,30 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
else else
msg_Err( p_intf, "unknown dialog type" ); msg_Err( p_intf, "unknown dialog type" );
/* We used a message box */
if( i_ret != -1 )
{
if( i_ret == 0 ) Finish( DIALOG_OK_YES );
else if ( i_ret == 1 ) Finish( DIALOG_NO );
else Finish( DIALOG_CANCELLED );
}
else
/* Custom box, finish it */
{
QVLCFrame::doButtons( this, layout, QVLCFrame::doButtons( this, layout,
defaultButton, p_dialog->psz_default_button, &defaultButton, p_dialog->psz_default_button,
altButton, p_dialog->psz_alternate_button, &altButton, p_dialog->psz_alternate_button,
otherButton, p_dialog->psz_other_button ); &otherButton, p_dialog->psz_other_button );
if( p_dialog->psz_default_button ) if( p_dialog->psz_default_button )
connect( defaultButton, SIGNAL( clicked() ), this, SLOT( defaultB() ) ); connect( defaultButton, SIGNAL( clicked() ),
this, SLOT( defaultB() ) );
if( p_dialog->psz_alternate_button ) if( p_dialog->psz_alternate_button )
connect( altButton, SIGNAL( clicked() ), this, SLOT( altB() ) ); connect( altButton, SIGNAL( clicked() ), this, SLOT( altB() ) );
if( p_dialog->psz_other_button ) if( p_dialog->psz_other_button )
connect( otherButton, SIGNAL( clicked() ), this, SLOT( otherB() ) ); connect( otherButton, SIGNAL( clicked() ), this, SLOT( otherB() ) );
setLayout( layout ); setLayout( layout );
setWindowTitle( qfu( p_dialog->psz_title ) ); setWindowTitle( qfu( p_dialog->psz_title ) );
}
} }
void InteractionDialog::Update() void InteractionDialog::Update()
......
...@@ -57,9 +57,9 @@ public: ...@@ -57,9 +57,9 @@ public:
#endif #endif
} }
static void doButtons( QWidget *w, QBoxLayout *l, static void doButtons( QWidget *w, QBoxLayout *l,
QPushButton *defaul, char *psz_default, QPushButton **defaul, char *psz_default,
QPushButton *alt, char *psz_alt, QPushButton **alt, char *psz_alt,
QPushButton *other, char *psz_other ) QPushButton **other, char *psz_other )
{ {
#ifdef QT42 #ifdef QT42
#else #else
...@@ -70,21 +70,21 @@ public: ...@@ -70,21 +70,21 @@ public:
if( psz_default ) if( psz_default )
{ {
defaul = new QPushButton; *defaul = new QPushButton(0);
buttons_layout->addWidget( defaul ); buttons_layout->addWidget( *defaul );
defaul->setText( qfu( psz_default ) ); (*defaul)->setText( qfu( psz_default ) );
} }
if( psz_alt ) if( psz_alt )
{ {
alt = new QPushButton; *alt = new QPushButton(0);
buttons_layout->addWidget( alt ); buttons_layout->addWidget( *alt );
alt->setText( qfu( psz_alt ) ); (*alt)->setText( qfu( psz_alt ) );
} }
if( psz_other ) if( psz_other )
{ {
other = new QPushButton; *other = new QPushButton( 0 );
buttons_layout->addWidget( other ); buttons_layout->addWidget( *other );
other->setText( qfu( psz_other ) ); (*other)->setText( qfu( psz_other ) );
} }
l->addLayout( buttons_layout ); l->addLayout( buttons_layout );
#endif #endif
......
...@@ -178,6 +178,7 @@ void InteractionDialog::Render() ...@@ -178,6 +178,7 @@ void InteractionDialog::Render()
buttons_sizer->AddButton( no ); buttons_sizer->AddButton( no );
buttons_sizer->AddButton( cancel ); buttons_sizer->AddButton( cancel );
} }
#if 0
else if( p_dialog->i_flags & DIALOG_CLEAR_NOSHOW ) else if( p_dialog->i_flags & DIALOG_CLEAR_NOSHOW )
{ {
wxCheckBox *noshow = new wxCheckBox( buttons_panel, wxCheckBox *noshow = new wxCheckBox( buttons_panel,
...@@ -196,6 +197,7 @@ void InteractionDialog::Render() ...@@ -196,6 +197,7 @@ void InteractionDialog::Render()
buttons_sizer->AddButton( close ); buttons_sizer->AddButton( close );
buttons_sizer->SetAffirmativeButton( close ); buttons_sizer->SetAffirmativeButton( close );
} }
#endif
widgets_sizer->Layout(); widgets_sizer->Layout();
widgets_panel->SetSizerAndFit( widgets_sizer ); widgets_panel->SetSizerAndFit( widgets_sizer );
buttons_sizer->Realize(); buttons_sizer->Realize();
......
...@@ -136,13 +136,10 @@ void intf_InteractionManage( playlist_t *p_playlist ) ...@@ -136,13 +136,10 @@ void intf_InteractionManage( playlist_t *p_playlist )
break; break;
case HIDDEN_DIALOG: case HIDDEN_DIALOG:
if( !(p_dialog->i_flags & DIALOG_GOT_ANSWER) ) break; if( !(p_dialog->i_flags & DIALOG_GOT_ANSWER) ) break;
if( !(p_dialog->i_flags & DIALOG_REUSABLE) )
{
p_dialog->i_action = INTERACT_DESTROY; p_dialog->i_action = INTERACT_DESTROY;
val.p_address = p_dialog; val.p_address = p_dialog;
if( p_interaction->p_intf ) if( p_interaction->p_intf )
var_Set( p_interaction->p_intf, "interaction", val ); var_Set( p_interaction->p_intf, "interaction", val );
}
break; break;
case DESTROYED_DIALOG: case DESTROYED_DIALOG:
// Interface has now destroyed it, remove it // Interface has now destroyed it, remove it
...@@ -175,6 +172,7 @@ void intf_InteractionManage( playlist_t *p_playlist ) ...@@ -175,6 +172,7 @@ void intf_InteractionManage( playlist_t *p_playlist )
memset( p_new, 0, sizeof( interaction_dialog_t ) ); \ memset( p_new, 0, sizeof( interaction_dialog_t ) ); \
p_new->b_cancelled = VLC_FALSE; \ p_new->b_cancelled = VLC_FALSE; \
p_new->i_status = NEW_DIALOG; \ p_new->i_status = NEW_DIALOG; \
p_new->i_flags = 0; \
p_new->i_type = INTERACT_DIALOG_##type; \ p_new->i_type = INTERACT_DIALOG_##type; \
p_new->psz_returned[0] = NULL; \ p_new->psz_returned[0] = NULL; \
p_new->psz_returned[1] = NULL; p_new->psz_returned[1] = NULL;
......
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