made CLI rendering smoother
Suppressed a message box that would pop up in command line interface causing a crash and made lmms act properly when a rendering plugin fails. Need to figure out how to terminate program in project_renderer line 222.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "audio_file_device.h"
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
class projectRenderer : public QThread
|
||||
{
|
||||
@@ -83,6 +84,10 @@ public:
|
||||
static ExportFileFormats getFileFormatFromExtension(
|
||||
const QString & _ext );
|
||||
|
||||
void setConsoleUpdateTimer(QTimer * t)
|
||||
{
|
||||
m_consoleUpdateTimer = t;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void startProcessing( void );
|
||||
@@ -105,6 +110,8 @@ private:
|
||||
volatile int m_progress;
|
||||
volatile bool m_abort;
|
||||
|
||||
QTimer * m_consoleUpdateTimer;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "audio_file_device.h"
|
||||
#include "export_project_dialog.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
audioFileDevice::audioFileDevice( const sample_rate_t _sample_rate,
|
||||
@@ -51,17 +53,24 @@ audioFileDevice::audioFileDevice( const sample_rate_t _sample_rate,
|
||||
|
||||
if( m_outputFile.open( QFile::WriteOnly | QFile::Truncate ) == FALSE )
|
||||
{
|
||||
QMessageBox::critical( NULL,
|
||||
exportProjectDialog::tr( "Could not open file" ),
|
||||
exportProjectDialog::tr( "Could not open file %1 "
|
||||
"for writing.\nPlease make "
|
||||
"sure you have write-"
|
||||
"permission to the file and "
|
||||
"the directory containing the "
|
||||
"file and try again!" ).arg(
|
||||
_file ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::NoButton );
|
||||
QString warningMessage = exportProjectDialog::tr(
|
||||
"Could not open file %1 "
|
||||
"for writing.\nPlease make "
|
||||
"sure you have write-"
|
||||
"permission to the file and "
|
||||
"the directory containing the "
|
||||
"file and try again!" ).arg( _file );
|
||||
if( engine::hasGUI() ){
|
||||
QMessageBox::critical( NULL,
|
||||
exportProjectDialog::tr( "Could not open file" ),
|
||||
warningMessage,
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::NoButton );
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << warningMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,6 +499,7 @@ int main( int argc, char * * argv )
|
||||
|
||||
// timer for progress-updates
|
||||
QTimer * t = new QTimer( r );
|
||||
r->setConsoleUpdateTimer(t);
|
||||
r->connect( t, SIGNAL( timeout() ),
|
||||
SLOT( updateConsoleProgress() ) );
|
||||
t->start( 200 );
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QTimer>
|
||||
|
||||
#include "project_renderer.h"
|
||||
#include "song.h"
|
||||
@@ -214,6 +215,14 @@ void projectRenderer::updateConsoleProgress( void )
|
||||
char buf[80];
|
||||
char prog[cols+1];
|
||||
|
||||
if( m_fileDev == NULL ){
|
||||
qWarning("Error occured. Aborting render.");
|
||||
m_consoleUpdateTimer->stop();
|
||||
delete m_consoleUpdateTimer;
|
||||
// TODO: kill the program. I can't figure out how to do it...
|
||||
return;
|
||||
}
|
||||
|
||||
for( int i = 0; i < cols; ++i )
|
||||
{
|
||||
prog[i] = ( i*100/cols <= m_progress ? '-' : ' ' );
|
||||
|
||||
Reference in New Issue
Block a user