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
......@@ -23,30 +23,30 @@ while(<STDIN>)
$line = $_;
chomp $line;
# Skip entering/leaving directories and incomplete lines
if(
if(
$line =~ /make\[([0-9]*)\]:.*/ ||
# $line =~ /.*\s\\$/ ||
$line =~ /^test\s\-z\s/ ||
# $line =~ /.*\s\\$/ ||
$line =~ /^test\s\-z\s/ ||
$line =~ /^Making\sclean\sin\s\./ ||
$line =~ /then\smv\s-f/ ||
$line =~ /.*make\s\s.*/ ||
$line =~ /make\s\sall-recursive/ ||
$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 =~ /^touch.*/ ||
$line =~ /^srcdir=.*/ ||
$line =~ /^.* (lib[A-z0-9-_]*plugin.so).*/ ||
$line =~ /^.* (lib[A-z0-9-_]*plugin.so).*/ ||
$line =~ s/^rm\s\-f\s(.*)//g )
{}
# Info
elsif(
# Info
elsif(
$line =~ s/^.* (lib.*\.so).*/ LINK : $1/g ||
$line =~ s/^.* (lib.*\.o)\s\.\/(.*)/ COMPILE : $2/g ||
$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/^Making\sall\sin\s(.*)/MAKE : $1/g ||
$line =~ s/^Making\sclean\sin\s(.*)/CLEAN : $1/g ||
$line =~ s/.*\-o\s([^\s]*)\s.*/ BUILD : $1/g)
$line =~ s/^Making\sclean\sin\s(.*)/CLEAN : $1/g )
{
print $info.$line.$reset."\n";
}
......@@ -63,10 +63,9 @@ while(<STDIN>)
{
print $error.$line.$reset."\n";
}
# Print unmatched lines
# Print unmatched lines
else
{
print $line."\n";
}
}
......@@ -81,19 +81,17 @@ struct interaction_dialog_t
};
/**
* Possible flags . Reusable and button types
* Possible flags . Dialog types
*/
#define DIALOG_REUSABLE 0x01
#define DIALOG_YES_NO_CANCEL 0x04
#define DIALOG_CLEAR_NOSHOW 0x08
#define DIALOG_GOT_ANSWER 0x10
#define DIALOG_LOGIN_PW_OK_CANCEL 0x20
#define DIALOG_BLOCKING_ERROR 0x24
#define DIALOG_NONBLOCKING_ERROR 0x200
#define DIALOG_USER_PROGRESS 0x40
#define DIALOG_PSZ_INPUT_OK_CANCEL 0x80
#define DIALOG_GOT_ANSWER 0x01
#define DIALOG_YES_NO_CANCEL 0x02
#define DIALOG_LOGIN_PW_OK_CANCEL 0x04
#define DIALOG_PSZ_INPUT_OK_CANCEL 0x08
#define DIALOG_BLOCKING_ERROR 0x10
#define DIALOG_NONBLOCKING_ERROR 0x20
#define DIALOG_WARNING 0x40
#define DIALOG_USER_PROGRESS 0x80
#define DIALOG_INTF_PROGRESS 0x100
#define DIALOG_WARNING 0x400
/**
* Possible return codes
......
......@@ -559,7 +559,7 @@ aviindex:
_( "This AVI file is broken. Seeking will not "
"work correctly.\nDo you want to "
"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 )
{
b_index = VLC_TRUE;
......
......@@ -30,9 +30,6 @@
#define AVI_DEBUG 1
#define FREE( p ) \
if( p ) {free( p ); p = NULL; }
#define __EVEN( x ) ( (x)&0x01 ? (x)+1 : (x) )
static vlc_fourcc_t GetFOURCC( byte_t *p_buff )
......@@ -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;
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 )
{
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 )
{
p_chk->idx1.i_entry_count = 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 )
{
avi_chunk_indx_t *p_indx = (avi_chunk_indx_t*)p_chk;
FREE( p_indx->idx.std );
FREE( p_indx->idx.field );
FREE( p_indx->idx.super );
FREENULL( p_indx->idx.std );
FREENULL( p_indx->idx.field );
FREENULL( p_indx->idx.super );
}
......@@ -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 )
{
avi_chunk_STRING_t *p_strz = (avi_chunk_STRING_t*)p_chk;
FREE( p_strz->p_type );
FREE( p_strz->p_str );
FREENULL( p_strz->p_type );
FREENULL( p_strz->p_str );
}
static int AVI_ChunkRead_nothing( stream_t *s, avi_chunk_t *p_chk )
......
......@@ -20,6 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
#include <QMessageBox>
#include "dialogs/interaction.hpp"
#include "util/qvlcframe.hpp"
#include <vlc/intf.h>
......@@ -29,15 +30,14 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
interaction_dialog_t *_p_dialog ) : QWidget( 0 ),
p_intf( _p_intf), p_dialog( _p_dialog )
{
QVBoxLayout *layout = new QVBoxLayout;
QVBoxLayout *layout = new QVBoxLayout( this );
int i_ret = -1;
uiLogin = NULL;
uiProgress = NULL;
uiInput = NULL;
if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR )
{
}
else if( p_dialog->i_flags & DIALOG_NONBLOCKING_ERROR )
{
......@@ -45,9 +45,15 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
}
else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
{
description = new QLabel( 0 );
description->setText( qfu(p_dialog->psz_description) );
layout->addWidget(description);
i_ret = QMessageBox::question( this,
qfu( p_dialog->psz_title), qfu( p_dialog->psz_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 )
{
......@@ -65,19 +71,30 @@ InteractionDialog::InteractionDialog( intf_thread_t *_p_intf,
else
msg_Err( p_intf, "unknown dialog type" );
QVLCFrame::doButtons( this, layout,
defaultButton, p_dialog->psz_default_button,
altButton, p_dialog->psz_alternate_button,
otherButton, p_dialog->psz_other_button );
if( p_dialog->psz_default_button )
connect( defaultButton, SIGNAL( clicked() ), this, SLOT( defaultB() ) );
if( p_dialog->psz_alternate_button )
connect( altButton, SIGNAL( clicked() ), this, SLOT( altB() ) );
if( p_dialog->psz_other_button )
connect( otherButton, SIGNAL( clicked() ), this, SLOT( otherB() ) );
setLayout( layout );
setWindowTitle( qfu( p_dialog->psz_title ) );
/* 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,
&defaultButton, p_dialog->psz_default_button,
&altButton, p_dialog->psz_alternate_button,
&otherButton, p_dialog->psz_other_button );
if( p_dialog->psz_default_button )
connect( defaultButton, SIGNAL( clicked() ),
this, SLOT( defaultB() ) );
if( p_dialog->psz_alternate_button )
connect( altButton, SIGNAL( clicked() ), this, SLOT( altB() ) );
if( p_dialog->psz_other_button )
connect( otherButton, SIGNAL( clicked() ), this, SLOT( otherB() ) );
setLayout( layout );
setWindowTitle( qfu( p_dialog->psz_title ) );
}
}
void InteractionDialog::Update()
......@@ -106,7 +123,7 @@ void InteractionDialog::otherB()
void InteractionDialog::Finish( int i_ret )
{
vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
{
......@@ -123,5 +140,5 @@ void InteractionDialog::Finish( int i_ret )
p_dialog->i_status = ANSWERED_DIALOG;
p_dialog->i_return = i_ret;
hide();
vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
}
......@@ -57,9 +57,9 @@ public:
#endif
}
static void doButtons( QWidget *w, QBoxLayout *l,
QPushButton *defaul, char *psz_default,
QPushButton *alt, char *psz_alt,
QPushButton *other, char *psz_other )
QPushButton **defaul, char *psz_default,
QPushButton **alt, char *psz_alt,
QPushButton **other, char *psz_other )
{
#ifdef QT42
#else
......@@ -70,21 +70,21 @@ public:
if( psz_default )
{
defaul = new QPushButton;
buttons_layout->addWidget( defaul );
defaul->setText( qfu( psz_default ) );
*defaul = new QPushButton(0);
buttons_layout->addWidget( *defaul );
(*defaul)->setText( qfu( psz_default ) );
}
if( psz_alt )
{
alt = new QPushButton;
buttons_layout->addWidget( alt );
alt->setText( qfu( psz_alt ) );
*alt = new QPushButton(0);
buttons_layout->addWidget( *alt );
(*alt)->setText( qfu( psz_alt ) );
}
if( psz_other )
{
other = new QPushButton;
buttons_layout->addWidget( other );
other->setText( qfu( psz_other ) );
*other = new QPushButton( 0 );
buttons_layout->addWidget( *other );
(*other)->setText( qfu( psz_other ) );
}
l->addLayout( buttons_layout );
#endif
......
......@@ -178,6 +178,7 @@ void InteractionDialog::Render()
buttons_sizer->AddButton( no );
buttons_sizer->AddButton( cancel );
}
#if 0
else if( p_dialog->i_flags & DIALOG_CLEAR_NOSHOW )
{
wxCheckBox *noshow = new wxCheckBox( buttons_panel,
......@@ -196,6 +197,7 @@ void InteractionDialog::Render()
buttons_sizer->AddButton( close );
buttons_sizer->SetAffirmativeButton( close );
}
#endif
widgets_sizer->Layout();
widgets_panel->SetSizerAndFit( widgets_sizer );
buttons_sizer->Realize();
......
......@@ -136,13 +136,10 @@ void intf_InteractionManage( playlist_t *p_playlist )
break;
case HIDDEN_DIALOG:
if( !(p_dialog->i_flags & DIALOG_GOT_ANSWER) ) break;
if( !(p_dialog->i_flags & DIALOG_REUSABLE) )
{
p_dialog->i_action = INTERACT_DESTROY;
val.p_address = p_dialog;
if( p_interaction->p_intf )
var_Set( p_interaction->p_intf, "interaction", val );
}
p_dialog->i_action = INTERACT_DESTROY;
val.p_address = p_dialog;
if( p_interaction->p_intf )
var_Set( p_interaction->p_intf, "interaction", val );
break;
case DESTROYED_DIALOG:
// Interface has now destroyed it, remove it
......@@ -175,6 +172,7 @@ void intf_InteractionManage( playlist_t *p_playlist )
memset( p_new, 0, sizeof( interaction_dialog_t ) ); \
p_new->b_cancelled = VLC_FALSE; \
p_new->i_status = NEW_DIALOG; \
p_new->i_flags = 0; \
p_new->i_type = INTERACT_DIALOG_##type; \
p_new->psz_returned[0] = NULL; \
p_new->psz_returned[1] = NULL;
......@@ -196,7 +194,7 @@ int __intf_UserFatal( vlc_object_t *p_this, vlc_bool_t b_blocking,
{
va_list args;
DIALOG_INIT( ONEWAY );
p_new->psz_title = strdup( psz_title );
FORMAT_DESC;
......
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