From 90365041f463f6c062b154e94fedbf75f96fb880 Mon Sep 17 00:00:00 2001 From: Tannin Date: Tue, 12 May 2015 18:56:44 +0200 Subject: workaround to prevent repeated checking of mods with the mouse was interpreted as double click --- src/mainwindow.cpp | 7 ++++++- src/modlist.cpp | 6 ++++++ src/modlist.h | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5a2ef6fd..44ccc642 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2538,6 +2538,12 @@ void MainWindow::on_modList_doubleClicked(const QModelIndex &index) if (!index.isValid()) { return; } + + if (m_OrganizerCore.modList()->timeElapsedSinceLastChecked() <= QApplication::doubleClickInterval()) { + // don't interpret double click if we only just checked a mod + return; + } + QModelIndex sourceIdx = mapToModel(m_OrganizerCore.modList(), index); if (!sourceIdx.isValid()) { return; @@ -2545,7 +2551,6 @@ void MainWindow::on_modList_doubleClicked(const QModelIndex &index) try { m_ContextRow = m_ModListSortProxy->mapToSource(index).row(); -// displayModInformation(m_ModListSortProxy->mapToSource(index).row()); displayModInformation(sourceIdx.row()); // workaround to cancel the editor that might have opened because of // selection-click diff --git a/src/modlist.cpp b/src/modlist.cpp index 8c1d56b7..e05935ef 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -454,6 +454,7 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) if (m_Profile->modEnabled(modID) != enabled) { m_Profile->setModEnabled(modID, enabled); m_Modified = true; + m_LastCheck.restart(); emit modlist_changed(index, role); } result = true; @@ -665,6 +666,11 @@ void ModList::disconnectSlots() { m_ModStateChanged.disconnect_all_slots(); } +int ModList::timeElapsedSinceLastChecked() const +{ + return m_LastCheck.elapsed(); +} + IModList::ModStates ModList::state(unsigned int modIndex) const { IModList::ModStates result; diff --git a/src/modlist.h b/src/modlist.h index 6a10cb3e..d2cd00ce 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -111,6 +111,8 @@ public: void disconnectSlots(); + int timeElapsedSinceLastChecked() const; + public: /// \copydoc MOBase::IModList::displayName @@ -311,6 +313,8 @@ private: std::map > m_ContentIcons; + QTime m_LastCheck; + }; #endif // MODLIST_H -- cgit v1.3.1