Use SH_ItemView_ActivateItemOnSingleClick to detect single click mode in Qt build.

This commit is contained in:
craig
2012-04-04 18:45:02 +00:00
committed by craig
parent cf2c04940e
commit 99beebf68b
3 changed files with 15 additions and 8 deletions

View File

@@ -50,6 +50,8 @@
(asf/wmv/mp4v) - these seem to crash TagLib.
34. When using MPRISv2 interface, dont attempt to play a song if the playqueue
is empty!
35. Use SH_ItemView_ActivateItemOnSingleClick to detect single click mode in Qt
build.
0.5.1
-----

View File

@@ -37,6 +37,7 @@
#include <QtGui/QInputDialog>
#include <QtGui/QAction>
#include <QtGui/QMessageBox>
#include <QtGui/QStyle>
#endif
PlaylistsPage::PlaylistsPage(MainWindow *p)
@@ -282,9 +283,11 @@ void PlaylistsPage::itemDoubleClicked(const QModelIndex &index)
{
if (
#ifdef ENABLE_KDE_SUPPORT
KGlobalSettings::singleClick() ||
KGlobalSettings::singleClick()
#else
style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)
#endif
!static_cast<PlaylistsModel::Item *>(proxy.mapToSource(index).internalPointer())->isPlaylist()) {
|| !static_cast<PlaylistsModel::Item *>(proxy.mapToSource(index).internalPointer())->isPlaylist()) {
QModelIndexList indexes;
indexes.append(index);
addItemsToPlayQueue(indexes, false);

View File

@@ -40,6 +40,12 @@
#include <KDE/KPixmapSequenceOverlayPainter>
#endif
#ifdef ENABLE_KDE_SUPPORT
#define SINGLE_CLICK KGlobalSettings::singleClick()
#else
#define SINGLE_CLICK style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)
#endif
EscapeKeyEventHandler::EscapeKeyEventHandler(QAbstractItemView *v, QAction *a)
: QObject(v)
, view(v)
@@ -364,11 +370,9 @@ void ItemView::allowGroupedView()
groupedView->setAutoExpand(false);
treeLayout->addWidget(groupedView);
connect(groupedView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool)));
#ifdef ENABLE_KDE_SUPPORT
if (KGlobalSettings::singleClick()) {
if (SINGLE_CLICK) {
connect(groupedView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
}
#endif
connect(groupedView, SIGNAL(doubleClicked(const QModelIndex &)), this, SIGNAL(doubleClicked(const QModelIndex &)));
connect(groupedView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)));
}
@@ -394,11 +398,9 @@ void ItemView::init(QAction *a1, QAction *a2, QAction *t, int actionLevel)
connect(listSearch, SIGNAL(returnPressed()), this, SLOT(delaySearchItems()));
connect(listSearch, SIGNAL(textChanged(const QString)), this, SLOT(delaySearchItems()));
connect(treeView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool)));
#ifdef ENABLE_KDE_SUPPORT
if (KGlobalSettings::singleClick()) {
if (SINGLE_CLICK) {
connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
}
#endif
connect(treeView, SIGNAL(doubleClicked(const QModelIndex &)), this, SIGNAL(doubleClicked(const QModelIndex &)));
connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)));
connect(listView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool)));