* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "dialogs/errors.hpp"
#include "dialogs/interaction.hpp"
-#include "main_interface.hpp"
#include <QLabel>
#include <QLineEdit>
p_intf( _p_intf), p_dialog( _p_dialog )
{
QVBoxLayout *layout = NULL;
+ description = NULL;
int i_ret = -1;
panel = NULL;
dialog = NULL;
+ altButton = NULL;
if( p_dialog->i_flags & DIALOG_BLOCKING_ERROR )
{
ErrorsDialog::getInstance( p_intf )->addError(
qfu( p_dialog->psz_title ), qfu( p_dialog->psz_description ) );
i_ret = 0;
- // QApplication::style()->standardPixmap(QStyle::SP_MessageBoxCritical)
}
else if( p_dialog->i_flags & DIALOG_WARNING )
{
panel->setLayout( grid );
layout->addWidget( panel );
}
- else if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
+ else if( (p_dialog->i_flags & DIALOG_INTF_PROGRESS ) ||
+ ( p_dialog->i_flags & DIALOG_USER_PROGRESS ) )
{
dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog );
layout->setMargin( 2 );
progressBar->setOrientation( Qt::Horizontal );
layout->addWidget( progressBar );
}
- else if( p_dialog->i_flags & DIALOG_INTF_PROGRESS )
- {
- progressBar = p_intf->p_sys->p_mi->pgBar;
- progressBar->show();
- }
else if( p_dialog->i_flags & DIALOG_PSZ_INPUT_OK_CANCEL )
{
dialog = new QWidget( 0 );layout = new QVBoxLayout( dialog );
layout->addWidget( inputEdit );
}
else
- msg_Err( p_intf, "unknown dialog type %i", p_dialog->i_flags );
+ {
+ msg_Err( p_intf, "Unknown dialog type %i", p_dialog->i_flags );
+ return;
+ }
/* 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 if ( i_ret == 2 ) return ;
else Finish( DIALOG_CANCELLED );
}
else
/* Custom box, finish it */
{
+ assert( dialog );
+ /* Start the DialogButtonBox config */
QDialogButtonBox *buttonBox = new QDialogButtonBox;
if( p_dialog->psz_default_button )
buttonBox->addButton( otherButton, QDialogButtonBox::ActionRole );
}
layout->addWidget( buttonBox );
+ /* End the DialogButtonBox */
+
+ /* CONNECTs */
if( p_dialog->psz_default_button )
BUTTONACT( defaultButton, defaultB() );
if( p_dialog->psz_alternate_button )
BUTTONACT( altButton, altB() );
if( p_dialog->psz_other_button )
BUTTONACT( otherButton, otherB() );
+
+ /* set the layouts and thte title */
dialog->setLayout( layout );
dialog->setWindowTitle( qfu( p_dialog->psz_title ) );
}
{
assert( progressBar );
progressBar->setValue( (int)( p_dialog->val.f_float * 10 ) );
- description->setText( qfu( p_dialog->psz_description ) );
- msg_Dbg( p_intf, "Setting progress to %i", progressBar->value() );
+ if( description )
+ description->setText( qfu( p_dialog->psz_description ) );
}
+ else return;
if( ( p_dialog->i_flags & DIALOG_INTF_PROGRESS ) &&
( p_dialog->val.f_float >= 100.0 ) )
+ {
progressBar->hide();
+ msg_Dbg( p_intf, "Progress Done" );
+ }
+
+ if( ( p_dialog->i_flags & DIALOG_USER_PROGRESS ) &&
+ ( p_dialog->val.f_float >= 100.0 ) )
+ {
+ assert( altButton );
+ altButton->setText( qtr( "&Close" ) );
+ }
}
InteractionDialog::~InteractionDialog()
{
-// if( panel ) delete panel;
- if( dialog ) delete dialog;
+// delete panel;
+ delete dialog;
}
void InteractionDialog::defaultB()
void InteractionDialog::Finish( int i_ret )
{
- vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
+ vlc_object_lock( (vlc_object_t *)(p_dialog->p_interaction) );
if( p_dialog->i_flags & DIALOG_LOGIN_PW_OK_CANCEL )
{
p_dialog->b_cancelled = true;
hide();
- vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
- playlist_Signal( THEPL );
+ vlc_object_unlock( (vlc_object_t *)(p_dialog->p_interaction) );
}