mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-01 13:06:25 +00:00
wrote thread safe "seizing" of preset lock
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@848 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -52,8 +52,7 @@ void QProjectMConfigDialog::openMenuFontFileDialog() {
|
||||
|
||||
QFileDialog dialog(this, "Select a menu font", _settings.value("Menu Font Directory", QString()).toString(), "True Type Fonts (*.ttf)" );
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
|
||||
|
||||
|
||||
if (dialog.exec()) {
|
||||
assert(!dialog.selectedFiles().empty());
|
||||
_ui.menuFontPathLineEdit->setText(dialog.selectedFiles()[0]);
|
||||
|
||||
@ -80,25 +80,31 @@ class QProjectMWidget : public QGLWidget
|
||||
inline const std::string & configFile() {
|
||||
return config_file;
|
||||
}
|
||||
|
||||
inline void seizePresetLock() {
|
||||
|
||||
m_presetSeizeMutex.lock();
|
||||
m_presetWasLocked = qprojectM()->isPresetLocked();
|
||||
qprojectM()->setPresetLock(true);
|
||||
|
||||
}
|
||||
|
||||
inline void unseizePresetLock() {
|
||||
|
||||
qprojectM()->setPresetLock(m_presetWasLocked);
|
||||
m_presetSeizeMutex.unlock();
|
||||
}
|
||||
|
||||
inline QProjectM * qprojectM() { return m_projectM; }
|
||||
|
||||
private:
|
||||
void destroyProjectM() {
|
||||
emit(projectM_BeforeDestroy());
|
||||
|
||||
if (m_projectM) {
|
||||
delete(m_projectM);
|
||||
m_projectM = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
|
||||
|
||||
void resetProjectM() {
|
||||
|
||||
qDebug() << "reset start";
|
||||
// First wait for audio thread to stop by
|
||||
// First wait for audio thread to stop by{{{
|
||||
// waiting on it's mutex
|
||||
// s_audioMutex.tryLock(20000);
|
||||
if (m_audioMutex) {
|
||||
@ -140,13 +146,22 @@ class QProjectMWidget : public QGLWidget
|
||||
void presetLockChanged(bool isLocked);
|
||||
private:
|
||||
std::string config_file;
|
||||
QProjectM * m_projectM;
|
||||
QProjectM * m_projectM;
|
||||
void destroyProjectM() {
|
||||
emit(projectM_BeforeDestroy());
|
||||
|
||||
if (m_projectM) {
|
||||
delete(m_projectM);
|
||||
m_projectM = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QMutex * m_audioMutex;
|
||||
QMutex m_presetSeizeMutex;
|
||||
bool m_presetWasLocked;
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
void keyReleaseEvent ( QKeyEvent * e ) {
|
||||
|
||||
projectMKeycode pkey;
|
||||
@ -229,7 +244,7 @@ void keyReleaseEvent ( QKeyEvent * e ) {
|
||||
*/
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@ -252,8 +267,6 @@ void keyReleaseEvent ( QKeyEvent * e ) {
|
||||
// glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0);
|
||||
//glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize);
|
||||
glLineStipple(2, 0xAAAA);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -313,10 +326,10 @@ private slots:
|
||||
void openSettingsDialog();
|
||||
void updateFilteredPlaylist(const QString & text);
|
||||
void refreshHeaders(QResizeEvent * event = 0);
|
||||
|
||||
private:
|
||||
QSize _oldPlaylistSize;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QSize _oldPlaylistSize;
|
||||
void readConfig(const std::string & configFile);
|
||||
void writeConfig();
|
||||
void copyPlaylist();
|
||||
|
||||
Reference in New Issue
Block a user