diff --git a/src/gui/macosshiftclickhandler.cpp b/src/gui/macosshiftclickhandler.cpp index cf2ee36e1..43d1ab597 100644 --- a/src/gui/macosshiftclickhandler.cpp +++ b/src/gui/macosshiftclickhandler.cpp @@ -1,13 +1,41 @@ -#include "macosshiftclickhandler.h" +/* + * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2025 Your_Name_Or_Nick + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give permission to + * link this program with the OpenSSL project's "OpenSSL" library (or with + * modified versions of it that use the same license as the "OpenSSL" library), + * and distribute the linked executables. You must obey the GNU General Public + * License in all respects for all of the code used other than "OpenSSL". If you + * modify file(s), you may extend this exception to your version of the file(s), + * but you are not obligated to do so. If you do not wish to do so, delete this + * exception statement from your version. + */ + + #include "macosshiftclickhandler.h" #include #include "transferlistwidget.h" -MacOSShiftClickHandler::MacOSShiftClickHandler(TransferListWidget *parent) - : QObject(parent) - , m_treeView(parent) +MacOSShiftClickHandler::MacOSShiftClickHandler(TransferListWidget *treeView) + : QObject(treeView) + , m_treeView {treeView} { - parent->installEventFilter(this); + treeView->installEventFilter(this); } bool MacOSShiftClickHandler::eventFilter(QObject *watched, QEvent *event) @@ -42,4 +70,4 @@ bool MacOSShiftClickHandler::eventFilter(QObject *watched, QEvent *event) } return false; -} \ No newline at end of file +} diff --git a/src/gui/macosshiftclickhandler.h b/src/gui/macosshiftclickhandler.h index 8dcc4bb69..9a018149a 100644 --- a/src/gui/macosshiftclickhandler.h +++ b/src/gui/macosshiftclickhandler.h @@ -1,3 +1,31 @@ +/* + * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2025 Your_Name_Or_Nick + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give permission to + * link this program with the OpenSSL project's "OpenSSL" library (or with + * modified versions of it that use the same license as the "OpenSSL" library), + * and distribute the linked executables. You must obey the GNU General Public + * License in all respects for all of the code used other than "OpenSSL". If you + * modify file(s), you may extend this exception to your version of the file(s), + * but you are not obligated to do so. If you do not wish to do so, delete this + * exception statement from your version. + */ + #pragma once #include @@ -12,12 +40,11 @@ class MacOSShiftClickHandler final : public QObject Q_DISABLE_COPY_MOVE(MacOSShiftClickHandler) public: - explicit MacOSShiftClickHandler(TransferListWidget *parent); - -protected: - bool eventFilter(QObject *watched, QEvent *event) override; + explicit MacOSShiftClickHandler(TransferListWidget *treeView); private: + bool eventFilter(QObject *watched, QEvent *event) override; + TransferListWidget *m_treeView; QPersistentModelIndex m_lastClickedIndex; -}; \ No newline at end of file +}; diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index 39d28969c..9efb9e54d 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -159,7 +159,7 @@ TransferListWidget::TransferListWidget(IGUIApplication *app, QWidget *parent) setDropIndicatorShown(true); #if defined(Q_OS_MACOS) setAttribute(Qt::WA_MacShowFocusRect, false); - m_shiftClickHandler = new MacOSShiftClickHandler(this); + new MacOSShiftClickHandler(this); #endif header()->setFirstSectionMovable(true); header()->setStretchLastSection(false); diff --git a/src/gui/transferlistwidget.h b/src/gui/transferlistwidget.h index 2fbeb64ac..c5b24ba24 100644 --- a/src/gui/transferlistwidget.h +++ b/src/gui/transferlistwidget.h @@ -52,10 +52,6 @@ enum class CopyInfohashPolicy Version2 }; -#ifdef Q_OS_MACOS -class MacOSShiftClickHandler; // Forward declaration -#endif - class TransferListWidget final : public GUIApplicationComponent { Q_OBJECT @@ -141,10 +137,6 @@ private: QList getVisibleTorrents() const; int visibleColumnsCount() const; -#ifdef Q_OS_MACOS - MacOSShiftClickHandler *m_shiftClickHandler = nullptr; -#endif - TransferListModel *m_listModel = nullptr; TransferListSortModel *m_sortFilterModel = nullptr; };