void DirectoryConfigControl::updateField() { QString dir = QFileDialog::getExistingDirectory( NULL, qtr( I_OP_SEL_DIR ), text->text().isEmpty() ? QVLCUserDir( VLC_HOME_DIR ) : text->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); if( dir.isNull() ) return; text->setText( toNativeSepNoSlash( dir ) ); }
void DirectoryConfigControl::updateField() { QString dir = QFileDialog::getExistingDirectory( NULL, qtr( "Select Directory" ), text->text().isEmpty() ? qfu( config_GetHomeDir() ) : text->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); if( dir.isNull() ) return; text->setText( toNativeSepNoSlash( dir ) ); }
/* Check for updates */ void UpdateDialog::UpdateOrDownload() { if( !b_checked ) { ui.stackedWidget->setCurrentWidget( ui.updateRequestPage ); update_Check( p_update, UpdateCallback, this ); } else { QString dest_dir = QDir::tempPath(); if( !dest_dir.isEmpty() ) { dest_dir = toNativeSepNoSlash( dest_dir ) + DIR_SEP; msg_Dbg( p_intf, "Downloading to folder: %s", qtu( dest_dir ) ); toggleVisible(); update_Download( p_update, qtu( dest_dir ) ); /* FIXME: We should trigger a change to another dialog here ! */ } } }
/* Check for updates */ void UpdateDialog::UpdateOrDownload() { if( !b_checked ) { updateButton->setEnabled( false ); updateLabelTop->setText( qtr( "Launching an update request..." ) ); update_Check( p_update, UpdateCallback, this ); } else { QString dest_dir = QFileDialog::getExistingDirectory( this, qtr( "Select a directory..." ), qfu( config_GetHomeDir() ) ); if( !dest_dir.isEmpty() ) { dest_dir = toNativeSepNoSlash( dest_dir ) + DIR_SEP; msg_Dbg( p_intf, "Downloading to folder: %s", qtu( dest_dir ) ); toggleVisible(); update_Download( p_update, qtu( dest_dir ) ); } } }
/* Generic open file */ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) { if( p_arg == NULL ) { msg_Warn( p_intf, "openFileGenericDialog() called with NULL arg" ); return; } /* Replace the extensions to a Qt format */ int i = 0; QString extensions = qfu( p_arg->psz_extensions ); while ( ( i = extensions.indexOf( "|", i ) ) != -1 ) { if( ( extensions.count( "|" ) % 2 ) == 0 ) extensions.replace( i, 1, ");;" ); else extensions.replace( i, 1, "(" ); } extensions.replace( ";*", " *" ); extensions.append( ")" ); /* Save */ if( p_arg->b_save ) { QString file = QFileDialog::getSaveFileName( NULL, qfu( p_arg->psz_title ), p_intf->p_sys->filepath, extensions ); if( !file.isEmpty() ) { p_arg->i_results = 1; p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) ); p_arg->psz_results[0] = strdup( qtu( toNativeSepNoSlash( file ) ) ); } else p_arg->i_results = 0; } else /* non-save mode */ { QStringList files = QFileDialog::getOpenFileNames( NULL, qfu( p_arg->psz_title ), p_intf->p_sys->filepath, extensions ); p_arg->i_results = files.count(); p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) ); i = 0; foreach( const QString &file, files ) p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) ); if(i == 0) p_intf->p_sys->filepath = QString::fromLatin1(""); else p_intf->p_sys->filepath = qfu( p_arg->psz_results[i-1] ); } /* Callback */ if( p_arg->pf_callback ) p_arg->pf_callback( p_arg ); /* Clean afterwards */ if( p_arg->psz_results ) { for( i = 0; i < p_arg->i_results; i++ ) free( p_arg->psz_results[i] ); free( p_arg->psz_results ); } free( p_arg->psz_title ); free( p_arg->psz_extensions ); free( p_arg ); }