mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-18 10:05:55 +00:00
added playlist clear button functionality
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@635 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -43,6 +43,9 @@ class PresetLoader {
|
||||
/// \param url an url referencing the preset
|
||||
/// \returns The unique index assigned to the preset in the collection. Used with loadPreset
|
||||
unsigned int addPresetURL ( const std::string & url, const std::string & presetName);
|
||||
|
||||
/// Clears all presets from the collection
|
||||
void clear() { m_entries.clear(); m_presetNames.clear(); }
|
||||
|
||||
void removePreset(unsigned int index);
|
||||
|
||||
|
||||
@ -884,7 +884,12 @@ std::string projectM::getPresetName ( unsigned int index ) const
|
||||
return m_presetLoader->getPresetName(index);
|
||||
}
|
||||
|
||||
unsigned int projectM::getPlayListSize() const
|
||||
void projectM::clearPlaylist ( )
|
||||
{
|
||||
m_presetLoader->clear();
|
||||
}
|
||||
|
||||
unsigned int projectM::getPlaylistSize() const
|
||||
{
|
||||
return m_presetLoader->getNumPresets();
|
||||
}
|
||||
|
||||
@ -135,6 +135,10 @@ public:
|
||||
/// If the preset is locked the queued item will be not switched to until the lock is released
|
||||
void queuePreset(unsigned int index);
|
||||
|
||||
|
||||
/// Removes entire playlist, The currently loaded preset will end up sticking until new presets are added
|
||||
void clearPlaylist();
|
||||
|
||||
/// Turn on or off a lock that prevents projectM from switching to another preset
|
||||
void setPresetLock(bool isLocked);
|
||||
|
||||
@ -151,7 +155,7 @@ public:
|
||||
std::string getPresetName ( unsigned int index ) const;
|
||||
|
||||
/// Returns the size of the play list
|
||||
unsigned int getPlayListSize() const;
|
||||
unsigned int getPlaylistSize() const;
|
||||
|
||||
/// Occurs when active preset has switched. Switched to index is returned
|
||||
virtual void presetSwitchedEvent(bool isHardCut, unsigned int index) const {};
|
||||
|
||||
@ -41,6 +41,9 @@ QProjectM_MainWindow::QProjectM_MainWindow(const std::string & config_file)
|
||||
connect(ui.lockPresetCheckBox, SIGNAL(stateChanged(int)),
|
||||
m_QProjectMWidget, SLOT(setPresetLock(int)));
|
||||
|
||||
connect(ui.clearPresetList_PushButton, SIGNAL(pressed()),
|
||||
this, SLOT(clearPlaylist()));
|
||||
|
||||
connect(m_QProjectMWidget, SIGNAL(projectM_Initialized()), this, SLOT(postProjectM_Initialize()));
|
||||
|
||||
|
||||
@ -65,6 +68,12 @@ QProjectM_MainWindow::QProjectM_MainWindow(const std::string & config_file)
|
||||
|
||||
}
|
||||
|
||||
void QProjectM_MainWindow::clearPlaylist() {
|
||||
|
||||
getQProjectM()->clearPlaylist();
|
||||
playlistModel.clear();
|
||||
}
|
||||
|
||||
QProjectM * QProjectM_MainWindow::getQProjectM() {
|
||||
return m_QProjectMWidget->getQProjectM();
|
||||
}
|
||||
@ -170,7 +179,8 @@ void QProjectM_MainWindow::open()
|
||||
loadFile(*pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
playlistModel.setHeaderData(0, Qt::Horizontal, tr("Preset"));//, Qt::DisplayRole);
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +188,7 @@ void QProjectM_MainWindow::refreshPlaylist() {
|
||||
|
||||
playlistModel.clear();
|
||||
|
||||
for (unsigned int i = 0; i < getQProjectM()->getPlayListSize(); i++) {
|
||||
for (unsigned int i = 0; i < getQProjectM()->getPlaylistSize(); i++) {
|
||||
|
||||
const std::string & presetURL = getQProjectM()->getPresetURL(i);
|
||||
const std::string & presetName = getQProjectM()->getPresetName(i);
|
||||
|
||||
@ -68,6 +68,7 @@ class QProjectMWidget : public QGLWidget
|
||||
QProjectM * getQProjectM() { return m_projectM; }
|
||||
|
||||
public slots:
|
||||
|
||||
void setPresetLock(int state) {
|
||||
m_projectM->setPresetLock((bool)state);
|
||||
}
|
||||
@ -77,8 +78,11 @@ class QProjectMWidget : public QGLWidget
|
||||
private:
|
||||
std::string config_file;
|
||||
QProjectM * m_projectM;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
void keyReleaseEvent ( QKeyEvent * e ) {
|
||||
|
||||
projectMKeycode pkey;
|
||||
@ -212,6 +216,7 @@ protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
private slots:
|
||||
void clearPlaylist();
|
||||
void open();
|
||||
void about();
|
||||
void postProjectM_Initialize();
|
||||
|
||||
@ -164,7 +164,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Clears <span style=" font-style:italic;">all</span> items if <span style=" font-style:italic;">none are selected</span> and the currently selected items otherwise.</p></body></html></string>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Clears<span style=" font-style:italic;"> all </span>presets<span style=" font-style:italic;"> </span>in the playlist.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
|
||||
Reference in New Issue
Block a user