mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-05-01 19:05:22 +00:00
almost got color indicators working in table view cells
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@659 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -824,14 +824,12 @@ void projectM::destroyPresetTools()
|
||||
/// @slow might not be necessary
|
||||
m_presetPos = 0;
|
||||
|
||||
|
||||
if ( m_presetQueuePos )
|
||||
delete ( m_presetQueuePos );
|
||||
|
||||
/// @slow might not be necessary
|
||||
m_presetQueuePos = 0;
|
||||
|
||||
|
||||
if ( m_presetChooser )
|
||||
delete ( m_presetChooser );
|
||||
|
||||
@ -944,8 +942,12 @@ bool projectM::isPresetQueued() const {
|
||||
return (*m_presetQueuePos != m_presetChooser->end());
|
||||
}
|
||||
|
||||
unsigned int projectM::selectedPresetIndex() const {
|
||||
return **m_presetPos;
|
||||
}
|
||||
|
||||
unsigned int projectM::getPlaylistSize() const
|
||||
{
|
||||
return m_presetLoader->getNumPresets();
|
||||
}
|
||||
|
||||
|
||||
@ -150,7 +150,10 @@ public:
|
||||
/// Returns true if the active preset is locked
|
||||
bool isPresetLocked() const;
|
||||
|
||||
/// Add a preset url to the play list. Appended to bottom
|
||||
/// Returns index of currently active preset
|
||||
unsigned int selectedPresetIndex() const;
|
||||
|
||||
/// Add a preset url to the play list. Appended to bottom
|
||||
unsigned int addPresetURL(const std::string & presetURL, const std::string & presetName);
|
||||
|
||||
/// Returns the url associated with a preset index
|
||||
|
||||
@ -60,6 +60,15 @@ QVariant QPlaylistModel::data ( const QModelIndex & index, int role = Qt::Displa
|
||||
case QPlaylistModel::RatingRole:
|
||||
return QVariant(m_ratings[index.row()]);
|
||||
|
||||
case Qt::BackgroundRole:
|
||||
|
||||
if (m_projectM.isPresetLocked() && (index.row() == m_projectM.selectedPresetIndex()))
|
||||
return Qt::red;
|
||||
if (!m_projectM.isPresetLocked() && (index.row() == m_projectM.selectedPresetIndex()))
|
||||
return Qt::green;
|
||||
|
||||
return Qt::white;
|
||||
|
||||
case QPlaylistModel::URLInfoRole:
|
||||
return QVariant(QString(m_projectM.getPresetURL(index.row()).c_str()));
|
||||
default:
|
||||
|
||||
@ -45,6 +45,7 @@ QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::D
|
||||
|
||||
void clear();
|
||||
|
||||
|
||||
QVariant data ( const QModelIndex & index, int role) const;
|
||||
int rowCount ( const QModelIndex & parent = QModelIndex()) const ;
|
||||
int columnCount ( const QModelIndex & parent) const ;
|
||||
|
||||
@ -92,8 +92,8 @@ void QProjectM_MainWindow::updatePlaylistSelection(bool hardCut, int index) {
|
||||
if (oldPresetIndex > 0)
|
||||
playlistModel->setData(playlistModel->index(oldPresetIndex, 0), Qt::white, Qt::BackgroundRole);
|
||||
|
||||
playlistModel->setData(playlistModel->index(index, 0), Qt::green, Qt::BackgroundRole);
|
||||
oldPresetIndex = index;
|
||||
//playlistModel->setData(playlistModel->index(index, 0), Qt::green, Qt::BackgroundRole);
|
||||
//oldPresetIndex = index;
|
||||
|
||||
}
|
||||
|
||||
@ -138,11 +138,14 @@ void QProjectM_MainWindow::keyReleaseEvent ( QKeyEvent * e ) {
|
||||
if (ui.presetSearchBarLineEdit->hasFocus())
|
||||
return;
|
||||
|
||||
if (ui.lockPresetCheckBox->checkState() == Qt::Checked)
|
||||
if (ui.lockPresetCheckBox->checkState() == Qt::Checked) {
|
||||
ui.lockPresetCheckBox->setCheckState(Qt::Unchecked);
|
||||
else
|
||||
ui.lockPresetCheckBox->setCheckState(Qt::Checked);
|
||||
|
||||
}
|
||||
else {
|
||||
ui.lockPresetCheckBox->setCheckState(Qt::Checked);
|
||||
}
|
||||
|
||||
// the projectM widget handles the actual lock
|
||||
//e->ignore();
|
||||
//m_QProjectMWidget->keyReleaseEvent(e);
|
||||
|
||||
Reference in New Issue
Block a user