Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cc49b620 authored by Scott Wheeler's avatar Scott Wheeler

Make sure that we don't resize the columns on events that would normally trigger

width updates when we're in manual resize mode.

svn path=/trunk/kdemultimedia/juk/; revision=353831
parent d0a8d489
......@@ -60,6 +60,15 @@
using namespace ActionCollection;
/**
* Just a shortcut of sorts.
*/
static bool manualResize()
{
return action<KToggleAction>("resizeColumnsManually")->isChecked();
}
/**
* A tooltip specialized to show full filenames over the file name column.
*/
......@@ -270,8 +279,7 @@ void Playlist::SharedSettings::writeConfig()
config.writeEntry("VisibleColumns", l);
config.writeEntry("InlineCompletionMode", m_inlineCompletion);
bool resizeColumnsManually = ActionCollection::action<KToggleAction>("resizeColumnsManually")->isChecked();
config.writeEntry("ResizeColumnsManually", resizeColumnsManually);
config.writeEntry("ResizeColumnsManually", manualResize());
KGlobal::config()->sync();
}
......@@ -751,12 +759,12 @@ void Playlist::slotShowPlaying()
void Playlist::slotColumnResizeModeChanged()
{
if(action<KToggleAction>("resizeColumnsManually")->isChecked())
if(manualResize())
setHScrollBarMode(Auto);
else
setHScrollBarMode(AlwaysOff);
if(!action<KToggleAction>("resizeColumnsManually")->isChecked())
if(!manualResize())
slotUpdateColumnWidths();
SharedSettings::instance()->sync();
......@@ -862,7 +870,7 @@ bool Playlist::eventFilter(QObject *watched, QEvent *e)
if(static_cast<QMouseEvent *>(e)->button() == LeftButton)
m_mousePressed = false;
if(!action<KToggleAction>("resizeColumnsManually")->isChecked() && m_widthsDirty)
if(!manualResize() && m_widthsDirty)
QTimer::singleShot(0, this, SLOT(slotUpdateColumnWidths()));
break;
}
......@@ -962,7 +970,8 @@ void Playlist::viewportPaintEvent(QPaintEvent *pe)
{
// If there are columns that need to be updated, well, update them.
if(!m_weightDirty.isEmpty()) {
if(!m_weightDirty.isEmpty() && !manualResize())
{
calculateColumnWeights();
slotUpdateColumnWidths();
}
......@@ -975,7 +984,7 @@ void Playlist::viewportResizeEvent(QResizeEvent *re)
// If the width of the view has changed, manually update the column
// widths.
if(re->size().width() != re->oldSize().width())
if(re->size().width() != re->oldSize().width() && !manualResize())
slotUpdateColumnWidths();
KListView::viewportResizeEvent(re);
......@@ -1041,8 +1050,10 @@ void Playlist::hideColumn(int c, bool updateSearch)
m_leftColumn = leftMostVisibleColumn();
}
slotUpdateColumnWidths();
triggerUpdate();
if(!manualResize()) {
slotUpdateColumnWidths();
triggerUpdate();
}
if(this != CollectionList::instance())
CollectionList::instance()->hideColumn(c, false);
......@@ -1073,8 +1084,10 @@ void Playlist::showColumn(int c, bool updateSearch)
m_leftColumn = leftMostVisibleColumn();
}
slotUpdateColumnWidths();
triggerUpdate();
if(!manualResize()) {
slotUpdateColumnWidths();
triggerUpdate();
}
if(this != CollectionList::instance())
CollectionList::instance()->showColumn(c, false);
......@@ -1180,7 +1193,7 @@ void Playlist::setupItem(PlaylistItem *item)
if(!m_search.isEmpty())
item->setVisible(m_search.checkItem(item));
if(childCount() <= 2) {
if(childCount() <= 2 && !manualResize()) {
slotWeightDirty();
slotUpdateColumnWidths();
triggerUpdate();
......@@ -1446,7 +1459,7 @@ PlaylistItem *Playlist::addFile(const QString &file, bool importPlaylists,
void Playlist::slotUpdateColumnWidths()
{
if(m_disableColumnWidthUpdates)
if(m_disableColumnWidthUpdates || manualResize())
return;
// Make sure that the column weights have been initialized before trying to
......
......@@ -77,7 +77,9 @@ public:
virtual void playPrevious();
virtual void stop();
// Plays the top item of the playlist.
/**
* Plays the top item of the playlist.
*/
void playFirst();
/**
......@@ -446,11 +448,6 @@ private:
PlaylistItem *nextItem(PlaylistItem *current = 0) const;
/** Sets up album random play to play songs with the same album as
* the given PlaylistItem.
*/
// void initAlbumSearch(const PlaylistItem *item);
/**
* Load the playlist from a file. \a fileName should be the absolute path.
* \a fileInfo should point to the same file as \a fileName. This is a
......@@ -576,6 +573,7 @@ private:
QValueList<int> m_weightDirty;
bool m_disableColumnWidthUpdates;
/**
* The average minimum widths of columns to be used in balancing calculations.
*/
......@@ -584,10 +582,8 @@ private:
bool m_widthsDirty;
PlaylistItemList m_randomList;
// PlaylistItemList m_history;
static PlaylistItemList m_history;
PlaylistSearch m_search;
// PlaylistSearch m_albumSearch;
bool m_searchEnabled;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment