mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-01 04:55:03 +00:00
playlist file / directory error handling fixes, resize playlist refresh fix
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1342 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -26,7 +26,7 @@ MilkdropPresetFactory::MilkdropPresetFactory(int gx, int gy): _usePresetOutputs(
|
||||
Eval::init_infix_ops();
|
||||
|
||||
_presetOutputs = createPresetOutputs(gx,gy);
|
||||
_presetOutputs2 = createPresetOutputs(gx, gy);
|
||||
_presetOutputs2 = createPresetOutputs(gx, gy);
|
||||
}
|
||||
|
||||
MilkdropPresetFactory::~MilkdropPresetFactory() {
|
||||
@ -37,13 +37,13 @@ MilkdropPresetFactory::~MilkdropPresetFactory() {
|
||||
BuiltinFuncs::destroy_builtin_func_db();
|
||||
std::cerr << "[~MilkdropPresetFactory] delete preset out puts" << std::endl;
|
||||
delete(_presetOutputs);
|
||||
delete(_presetOutputs2);
|
||||
delete(_presetOutputs2);
|
||||
std::cerr << "[~MilkdropPresetFactory] done" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
/* Reinitializes the engine variables to a default (conservative and sane) value */
|
||||
void resetPresetOutputs(PresetOutputs *presetOutputs)
|
||||
void resetPresetOutputs(PresetOutputs * presetOutputs)
|
||||
{
|
||||
|
||||
presetOutputs->zoom=1.0;
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
PresetFactoryManager::PresetFactoryManager() : _gx(0), _gy(0) {}
|
||||
PresetFactoryManager::PresetFactoryManager() : _gx(0), _gy(0), initialized(false) {}
|
||||
|
||||
PresetFactoryManager::~PresetFactoryManager() {
|
||||
for (std::vector<PresetFactory *>::iterator pos = _factoryList.begin();
|
||||
@ -29,11 +29,20 @@ PresetFactoryManager::~PresetFactoryManager() {
|
||||
delete(*pos);
|
||||
}
|
||||
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
void PresetFactoryManager::initialize(int gx, int gy) {
|
||||
_gx = gx;
|
||||
_gy = gy;
|
||||
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
} else {
|
||||
std::cout << "already initialized " << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
PresetFactory * factory;
|
||||
|
||||
#ifndef DISABLE_MILKDROP_PRESETS
|
||||
|
||||
@ -21,7 +21,7 @@ class PresetFactoryException : public std::exception
|
||||
virtual ~PresetFactoryException() throw() {}
|
||||
const std::string & message() const { return _message; }
|
||||
|
||||
private:
|
||||
private:
|
||||
std::string _message;
|
||||
};
|
||||
|
||||
@ -54,6 +54,6 @@ class PresetFactoryManager {
|
||||
mutable std::map<std::string, PresetFactory *> _factoryMap;
|
||||
mutable std::vector<PresetFactory *> _factoryList;
|
||||
void registerFactory(const std::string & extension, PresetFactory * factory);
|
||||
|
||||
volatile bool initialized;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -223,7 +223,6 @@ void projectM::readConfig (const std::string & configFile )
|
||||
projectM_init ( _settings.meshX, _settings.meshY, _settings.fps,
|
||||
_settings.textureSize, _settings.windowWidth,_settings.windowHeight);
|
||||
|
||||
|
||||
_settings.beatSensitivity = beatDetect->beat_sensitivity = config.read<float> ( "Hard Cut Sensitivity", 10.0 );
|
||||
|
||||
|
||||
|
||||
@ -296,9 +296,7 @@ void QPulseAudioThread::pulseQuit ( int ret )
|
||||
{
|
||||
assert ( mainloop_api );
|
||||
mainloop_api->quit ( mainloop_api, ret );
|
||||
if (*s_qprojectM_MainWindowPtr)
|
||||
delete(*s_qprojectM_MainWindowPtr);
|
||||
*s_qprojectM_MainWindowPtr = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -315,7 +313,8 @@ void QPulseAudioThread::stream_read_callback ( pa_stream *s, size_t length, void
|
||||
{
|
||||
fprintf ( stderr, "pa_stream_peek() failed: %s\n", pa_strerror ( pa_context_errno ( context ) ) );
|
||||
pulseQuit ( 1 );
|
||||
return;
|
||||
return
|
||||
;
|
||||
}
|
||||
|
||||
if ((!s_qprojectM_MainWindowPtr) || (!*s_qprojectM_MainWindowPtr))
|
||||
@ -352,16 +351,16 @@ void QPulseAudioThread::stream_state_callback ( pa_stream *s, void *userdata )
|
||||
switch ( pa_stream_get_state ( s ) )
|
||||
{
|
||||
case PA_STREAM_UNCONNECTED:
|
||||
// qDebug() << "UNCONNECTED";
|
||||
qDebug() << "UNCONNECTED";
|
||||
break;
|
||||
case PA_STREAM_CREATING:
|
||||
// qDebug() << "CREATED";
|
||||
qDebug() << "CREATED";
|
||||
break;
|
||||
case PA_STREAM_TERMINATED:
|
||||
// qDebug() << "TERMINATED";
|
||||
qDebug() << "TERMINATED";
|
||||
break;
|
||||
case PA_STREAM_READY:
|
||||
// qDebug() << "READY";
|
||||
qDebug() << "READY";
|
||||
if ( verbose )
|
||||
{
|
||||
const pa_buffer_attr *a;
|
||||
|
||||
@ -99,14 +99,14 @@ class QPlaylistTableView : public QTableView
|
||||
}
|
||||
|
||||
inline void resizeEvent(QResizeEvent * event) {
|
||||
|
||||
QTableView::resizeEvent(event);
|
||||
emit(resized(event));
|
||||
}
|
||||
|
||||
inline void mousePressEvent(QMouseEvent * event) {
|
||||
QAbstractItemView::mousePressEvent(event);
|
||||
if (event->button() == Qt::RightButton) {
|
||||
emit(mousePressed(event, selectedIndexes()));
|
||||
emit(mousePressed(event, selectedIndexes()));
|
||||
}
|
||||
else
|
||||
;
|
||||
|
||||
@ -98,7 +98,8 @@ activePresetIndex(new Nullable<long>), playlistItemCounter(0), m_QPresetEditorDi
|
||||
|
||||
connect(ui->tableView, SIGNAL(resized(QResizeEvent *)), this, SLOT(refreshHeaders(QResizeEvent*)));
|
||||
|
||||
connect(ui->tableView, SIGNAL(mousePressed(QMouseEvent*, const QModelIndexList &)), this, SLOT(popupPlaylistContextMenu(QMouseEvent*, const QModelIndexList &)));
|
||||
connect(ui->tableView, SIGNAL(mousePressed(QMouseEvent*, const QModelIndexList &)), this,
|
||||
SLOT(popupPlaylistContextMenu(QMouseEvent*, const QModelIndexList &)));
|
||||
|
||||
connect ( m_QProjectMWidget, SIGNAL ( projectM_Initialized(QProjectM*) ),
|
||||
this, SLOT ( postProjectM_Initialize() ) );
|
||||
@ -662,7 +663,7 @@ void QProjectM_MainWindow::refreshHeaders(QResizeEvent * event) {
|
||||
// Add 1 to skip the Name column
|
||||
hHeader->setResizeMode (i+1, QHeaderView::ResizeToContents);
|
||||
sizeTotal += hHeader->sectionSize(i+1);
|
||||
}
|
||||
}
|
||||
hHeader->resizeSection(0, ui->tableView->size().width()-20-sizeTotal);
|
||||
|
||||
|
||||
@ -883,11 +884,13 @@ void QProjectM_MainWindow::openPlaylistDialog()
|
||||
QString url = m_QPlaylistFileDialog->selectedFiles() [0];
|
||||
|
||||
|
||||
if ( !playlistModel->readPlaylist ( url ) ) {
|
||||
const bool loadedOk = playlistModel->readPlaylist ( url );
|
||||
|
||||
if (!loadedOk) {
|
||||
qDebug() << "could not open playlist";
|
||||
url = QString();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "url: " << url;
|
||||
updatePlaylistUrl(url);
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#ifndef QPROJECTM_WIDGET_HPP
|
||||
#define QPROJECTM_WIDGET_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include "qprojectm.hpp"
|
||||
#include <QGLWidget>
|
||||
#include <QMutex>
|
||||
@ -111,7 +112,7 @@ class QProjectMWidget : public QGLWidget
|
||||
|
||||
void resetProjectM()
|
||||
{
|
||||
|
||||
std::cout << "reseting" << std::endl;
|
||||
qDebug() << "reset start";
|
||||
|
||||
emit ( projectM_BeforeDestroy() );
|
||||
@ -246,8 +247,10 @@ class QProjectMWidget : public QGLWidget
|
||||
void initializeGL()
|
||||
{
|
||||
|
||||
this->m_projectM = new QProjectM ( m_config_file );
|
||||
projectM_Initialized ( m_projectM );
|
||||
if (m_projectM == 0) {
|
||||
this->m_projectM = new QProjectM ( m_config_file );
|
||||
projectM_Initialized ( m_projectM );
|
||||
}
|
||||
}
|
||||
|
||||
inline void paintGL()
|
||||
|
||||
Reference in New Issue
Block a user