fixed column scale issues when menu toggling

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@829 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2008-02-20 02:01:44 +00:00
parent c27e83346e
commit 38151d3a09
9 changed files with 118 additions and 98 deletions

View File

@ -10,16 +10,16 @@
<projectname>projectMTrunk</projectname>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description></description>
<defaultencoding></defaultencoding>
<versioncontrol>kdevsubversion</versioncontrol>
<description/>
<defaultencoding/>
<versioncontrol/>
</general>
<kdevcustomproject>
<run>
<directoryradio>executable</directoryradio>
<mainprogram>/home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/qprojectM-pulseaudio</mainprogram>
<programargs></programargs>
<globaldebugarguments></globaldebugarguments>
<programargs/>
<globaldebugarguments/>
<globalcwd>/home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/</globalcwd>
<useglobalprogram>false</useglobalprogram>
<terminal>false</terminal>
@ -51,22 +51,22 @@
</build>
<other>
<prio>0</prio>
<otherbin></otherbin>
<defaulttarget></defaulttarget>
<otheroptions></otheroptions>
<otherbin/>
<defaulttarget/>
<otheroptions/>
<selectedenvironment>default</selectedenvironment>
<environments>
<default/>
</environments>
</other>
<make>
<abortonerror>false</abortonerror>
<numberofjobs>1</numberofjobs>
<abortonerror>true</abortonerror>
<numberofjobs>2</numberofjobs>
<prio>0</prio>
<dontact>false</dontact>
<makebin></makebin>
<defaulttarget></defaulttarget>
<makeoptions></makeoptions>
<makebin/>
<defaulttarget/>
<makeoptions/>
<selectedenvironment>default</selectedenvironment>
<environments>
<default/>
@ -75,11 +75,11 @@
</kdevcustomproject>
<kdevdebugger>
<general>
<dbgshell></dbgshell>
<gdbpath></gdbpath>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
<runGdbScript></runGdbScript>
<dbgshell/>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
@ -180,7 +180,7 @@
<includePaths>.;</includePaths>
</codecompletion>
<creategettersetter>
<prefixGet></prefixGet>
<prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>

View File

@ -57,6 +57,7 @@ src/projectM-engine/PresetLoader.cpp
src/projectM-engine/PresetLoader.hpp
src/projectM-engine/PresetMerge.cpp
src/projectM-engine/PresetMerge.hpp
src/projectM-engine/RandomNumberGenerators.hpp
src/projectM-engine/Renderer.cpp
src/projectM-engine/Renderer.hpp
src/projectM-engine/RingBuffer.hpp
@ -157,19 +158,3 @@ src/qprojectM-pulseaudio/QPulseAudioDeviceModel.hpp
src/qprojectM-pulseaudio/QPulseAudioThread.cpp
src/qprojectM-pulseaudio/QPulseAudioThread.hpp
src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp
src/qprojectM/src
src/qprojectM/src/CMakeLists.txt
src/qprojectM/src/ConfigFile.cpp
src/qprojectM/src/ConfigFile.h
src/qprojectM/src/Makefile
src/qprojectM/src/QPlaylistFileDialog.hpp
src/qprojectM/src/QPlaylistModel.cpp
src/qprojectM/src/QPlaylistModel.hpp
src/qprojectM/src/QProjectMConfigDialog.cpp
src/qprojectM/src/QProjectMConfigDialog.hpp
src/qprojectM/src/QProjectM_MainWindow.cpp
src/qprojectM/src/QProjectM_MainWindow.hpp
src/qprojectM/src/QXmlPlaylistHandler.hpp
src/qprojectM/src/moc_QProjectMFileDialog.cxx
src/qprojectM/src/moc_QProjectM_MainWindow.cxx
src/qprojectM/src/qrc_application.cxx

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
<DocsAndViews NumberOfDocuments="13" >
<DocsAndViews NumberOfDocuments="27" >
<Doc0 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.cpp" >
<View0 Encoding="ISO 8859-1" Type="Source" />
</Doc0>
@ -11,36 +11,78 @@
<Doc2 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.cpp" >
<View0 Encoding="ISO 8859-1" Type="Source" />
</Doc2>
<Doc3 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioThread.cpp" >
<View0 Encoding="ISO 8859-1" Type="Source" />
<Doc3 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.hpp" >
<View0 Encoding="" Type="Source" />
</Doc3>
<Doc4 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioThread.hpp" >
<Doc4 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp" >
<View0 Encoding="" Type="Source" />
</Doc4>
<Doc5 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioDeviceChooser.hpp" >
<Doc5 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/projectM.cpp" >
<View0 Encoding="" Type="Source" />
</Doc5>
<Doc6 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/qprojectM-pulseaudio.cpp" >
<Doc6 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/projectM.hpp" >
<View0 Encoding="" Type="Source" />
</Doc6>
<Doc7 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/src/QProjectMConfigDialog.hpp" >
<View0 Encoding="" line="17" Type="Source" />
<Doc7 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/QProjectM_MainWindow.cpp" >
<View0 Encoding="" Type="Source" />
</Doc7>
<Doc8 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/src/QProjectM_MainWindow.cpp" >
<View0 Encoding="" line="329" Type="Source" />
<Doc8 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/QProjectM_MainWindow.hpp" >
<View0 Encoding="" Type="Source" />
</Doc8>
<Doc9 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/src/QProjectM_MainWindow.hpp" >
<View0 Encoding="ISO 8859-1" line="148" Type="Source" />
<Doc9 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioThread.cpp" >
<View0 Encoding="" Type="Source" />
</Doc9>
<Doc10 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/projectM.cpp" >
<View0 Encoding="" line="3" Type="Source" />
<Doc10 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioThread.hpp" >
<View0 Encoding="" Type="Source" />
</Doc10>
<Doc11 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/projectM.hpp" >
<Doc11 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc11>
<Doc12 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/src/QProjectMConfigDialog.cpp" >
<View0 Encoding="" line="82" Type="Source" />
<Doc12 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/PresetLoader.cpp" >
<View0 Encoding="" Type="Source" />
</Doc12>
<Doc13 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc13>
<Doc14 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc14>
<Doc15 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-engine/libprojectM.pc.in" >
<View0 Encoding="" Type="Source" />
</Doc15>
<Doc16 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/libqprojectM.pc.in" >
<View0 Encoding="" Type="Source" />
</Doc16>
<Doc17 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc17>
<Doc18 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/ConfigFile.cpp" >
<View0 Encoding="" Type="Source" />
</Doc18>
<Doc19 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM-jack/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc19>
<Doc20 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-jack/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc20>
<Doc21 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-libvisual/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc21>
<Doc22 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-test/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc22>
<Doc23 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/projectM-xmms/CMakeLists.txt" >
<View0 Encoding="" Type="Source" />
</Doc23>
<Doc24 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/QPlaylistFileDialog.hpp" >
<View0 Encoding="" Type="Source" />
</Doc24>
<Doc25 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/QPlaylistModel.hpp" >
<View0 Encoding="" Type="Source" />
</Doc25>
<Doc26 NumberOfViews="1" URL="file:///home/carm/projects/projectM/trunk/src/qprojectM/QPlaylistModel.cpp" >
<View0 Encoding="" line="171" Type="Source" />
</Doc26>
</DocsAndViews>
<pluginList>
<kdevdebugger>
@ -56,12 +98,15 @@
<bookmark url="/home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioDeviceModel.hpp" >
<mark line="33" />
</bookmark>
<bookmark url="/home/carm/projects/projectM/trunk/src/qprojectM/CMakeLists.txt" >
<mark line="24" />
</bookmark>
<bookmark url="/home/carm/projects/projectM/trunk/src/qprojectM/src/QProjectM_MainWindow.cpp" >
<mark line="323" />
</bookmark>
<bookmark url="/home/carm/projects/projectM/trunk/src/qprojectM-pulseaudio/QPulseAudioThread.cpp" >
<mark line="0" />
<mark line="176" />
<mark line="184" />
</bookmark>
</bookmarks>
</kdevbookmarks>

View File

@ -28,8 +28,9 @@
{
Q_OBJECT // must include this if you use Qt signals/slots
public:
QPlaylistFileDialog(QWidget * parent = 0):
inline QPlaylistFileDialog(QWidget * parent = 0):
QFileDialog(parent, "Open a playlist file or directory", QString(), "Preset Playlists (*.ppl)" ) {
this->setFileMode(QFileDialog::ExistingFiles);
@ -38,6 +39,8 @@
~QPlaylistFileDialog() { }
private:
};
#endif

View File

@ -77,8 +77,6 @@ bool QPlaylistModel::setData ( const QModelIndex & index, const QVariant & value
{
if ( role == QPlaylistModel::RatingRole )
{
//QAbstractTableModel::setData(index, ratingToIcon(value.toInt()), Qt::DecorationRole);
//std::cerr << "here" << std::endl;
m_ratings[index.row() ] = value.toInt();
emit ( dataChanged ( index, index ) );
return true;
@ -125,7 +123,8 @@ QVariant QPlaylistModel::data ( const QModelIndex & index, int role = Qt::Displa
return QVariant ( QString ( m_projectM.getPresetName ( index.row() ).c_str() ) );
else
return ratingToIcon ( m_ratings[index.row() ] );
case Qt::ToolTip:
case Qt::ToolTipRole:
if ( index.column() == 0 )
return QVariant ( QString ( m_projectM.getPresetName ( index.row() ).c_str() ) );
else
@ -137,16 +136,13 @@ QVariant QPlaylistModel::data ( const QModelIndex & index, int role = Qt::Displa
return QVariant();
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:
@ -159,11 +155,6 @@ QVariant QPlaylistModel::headerData ( int section, Qt::Orientation orientation,
if ( orientation == Qt::Vertical )
return QAbstractTableModel::headerData ( section, orientation, role );
if ( ( section == 0 ) && ( role == Qt::SizeHintRole ) )
return QVariant ( 500 );
// if ((section == 1) && (role == Qt::SizeHintRole))
// return QVariant(60);
if ( ( section == 0 ) && ( role == Qt::DisplayRole ) )
return QString ( tr ( "Preset" ) );
if ( ( section == 1 ) && ( role == Qt::DisplayRole ) )
@ -181,7 +172,6 @@ int QPlaylistModel::rowCount ( const QModelIndex & parent ) const
int QPlaylistModel::columnCount ( const QModelIndex & parent ) const
{
// eventually add ratings here so size should be 2
if ( rowCount() > 0 )
return 2;
else

View File

@ -46,7 +46,6 @@ 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= QModelIndex()) const ;

View File

@ -71,8 +71,9 @@ class PlaylistWriteFunctor {
};
QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file, QMutex * audioMutex)
:m_QPresetFileDialog ( new QPresetFileDialog ( this ) ), m_QPlaylistFileDialog ( new QPlaylistFileDialog ( this ) ),
oldPresetIndex ( -1 ), playlistModel(0), configDialog(0), _menuVisible(true)
:m_QPresetFileDialog ( new QPresetFileDialog ( this ) ), m_QPlaylistFileDialog
( new QPlaylistFileDialog ( this )), oldPresetIndex ( -1 ), playlistModel(0),
configDialog(0), hHeader(0), vHeader(0), _menuVisible(true)
{
@ -97,7 +98,6 @@ QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file, QM
m_timer->start ( 0 );
//readConfig(config_file);
setCentralWidget ( m_QProjectMWidget );
createActions();
createMenus();
@ -116,19 +116,13 @@ QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file, QM
}
/// @bug diffferent params necessary
void QProjectM_MainWindow::writeConfig() {
}
void QProjectM_MainWindow::readConfig(const std::string & configFile ) {
QSettings settings ( "projectM", "qprojectM" );
if ( settings.value("FullscreenOnStartup", false).toBool() )
this->setWindowState ( this->windowState() | Qt::WindowFullScreen );
else
else
this->setWindowState ( this->windowState() & ~Qt::WindowFullScreen );
setMenuVisible(settings.value("MenuOnStartup", false).toBool());
@ -142,8 +136,6 @@ void QProjectM_MainWindow::readConfig(const std::string & configFile ) {
m_QProjectMWidget->setBaseSize ( wvw, wvh );
}
QProjectM_MainWindow::~QProjectM_MainWindow()
{
@ -155,7 +147,6 @@ QProjectM_MainWindow::~QProjectM_MainWindow()
delete ( ui );
}
void QProjectM_MainWindow::clearPlaylist()
@ -324,24 +315,33 @@ void QProjectM_MainWindow::keyReleaseEvent ( QKeyEvent * e )
if ( ui->presetSearchBarLineEdit->hasFocus() )
return;
setMenuVisible(!_menuVisible);
refreshHeaders();
return;
case Qt::Key_R:
if ( ui->presetSearchBarLineEdit->hasFocus() )
return;
//modelIndex.selectRandom()
//modelIndex = QModelIndex(0,0,0);
//selectPlaylistItem(modelIndex);
//updatePlaylistSelection(true, modelIndex.row());
return;
default:
//m_QProjectMWidget->keyReleaseEvent(e);
break;//e->ignore();
break;
}
}
void QProjectM_MainWindow::refreshHeaders() {
hHeader->setResizeMode ( 0, QHeaderView::Stretch);
hHeader->setResizeMode ( 1, QHeaderView::Fixed);
hHeader->resizeSection(1, 50);
}
void QProjectM_MainWindow::closeEvent ( QCloseEvent *event )
{
writeSettings();
@ -470,27 +470,26 @@ void QProjectM_MainWindow::copyPlaylist()
}
void QProjectM_MainWindow::refreshPlaylist()
{
copyPlaylist();
if (hHeader)
disconnect(hHeader);
hHeader = new QHeaderView ( Qt::Horizontal, this );
vHeader = new QHeaderView ( Qt::Vertical, this );
hHeader->setClickable ( false );
hHeader->setSortIndicatorShown ( false );
//hHeader->setSortIndicator(1, Qt::AscendingOrder);
hHeader->setStretchLastSection ( false );
hHeader->setStretchLastSection ( false );
ui->tableView->setVerticalHeader ( vHeader );
ui->tableView->setHorizontalHeader ( hHeader );
hHeader->setResizeMode ( 0, QHeaderView::Stretch );
hHeader->setResizeMode ( 1, QHeaderView::Fixed );
//hHeader->resizeSection(0, 500);
hHeader->resizeSection(1, 50);
refreshHeaders();
/*
hHeader->resizeSection(0, 200);
hHeader->setResizeMode(0, QHeaderView::Stretch);
@ -501,9 +500,6 @@ void QProjectM_MainWindow::refreshPlaylist()
// playlistModel->setHeaderData(0, Qt::Horizontal, tr("Preset"));//, Qt::DisplayRole);
vHeader->hide();
// playlistModel->setHeaderData(0, Qt::Horizontal, 200, Qt::SizeHintRole);
//playlistModel->setHeaderData(1, Qt::Horizontal, tr("Rating"));//, Qt::DisplayRole);
//playlistModel->setHeaderData(2, Qt::Horizontal, tr("Preset"));//, Qt::DisplayRole);
}

View File

@ -294,6 +294,7 @@ protected:
void closeEvent(QCloseEvent *event);
private slots:
void aboutQt();
void clearPlaylist();
void addPresets();
@ -308,6 +309,7 @@ private slots:
void updateFilteredPlaylist(const QString & text);
private:
void refreshHeaders();
void readConfig(const std::string & configFile);
void writeConfig();
void copyPlaylist();