Sayonara Player
GUI_MTP.h
1 /* GUI_MTP.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef GUI_MTP_H
24 #define GUI_MTP_H
25 
26 
27 #include "GUI/MTP/ui_GUI_MTP.h"
28 #include "Components/MTP/MTP.h"
29 #include "Components/MTP/MTP_CopyFiles.h"
30 #include "GUI/Helper/CustomMimeData.h"
31 #include "GUI/Helper/SayonaraWidget/SayonaraDialog.h"
32 
33 #include <QDragEnterEvent>
34 #include <QDragMoveEvent>
35 #include <QDragLeaveEvent>
36 #include <QDropEvent>
37 
38 class GUI_MTP :
39  public SayonaraDialog,
40  private Ui::GUI_MTP
41 {
42  Q_OBJECT
43 
44 public:
45  GUI_MTP(QWidget* parent=nullptr);
46  virtual ~GUI_MTP();
47 
48  void device_opened(MTP_DevicePtr device);
49 
50 private slots:
51  void scan_thread_finished();
52 
53  void device_idx_changed(int idx);
54  void storage_idx_changed(int idx);
55  void folder_idx_changed(QTreeWidgetItem* item, int column);
56  void folder_idx_expanded(QTreeWidgetItem* item);
57 
58  void refresh_clicked();
59  void delete_clicked();
60 
61  void progress_changed(int progress);
62  void copy_thread_finished();
63 
64 private:
65  MTP* _mtp=nullptr;
66  MTP_CopyFiles* _mtp_copy_files=nullptr;
67 
68  QVector<MTP_RawDevicePtr> _raw_devices;
69  QVector<MTP_DevicePtr> _open_devices;
70  QVector<MTP_StoragePtr> _storages;
71 
72  QHash<quint32, MTP_FolderPtr> _folders;
73  QHash<quint32, MTP_FilePtr> _files;
74 
75 
76 private:
77  void enable_drag_drop(bool b);
78 
79  void dragEnterEvent(QDragEnterEvent* e) override;
80  void dragMoveEvent(QDragMoveEvent* e) override;
81  void dragLeaveEvent(QDragLeaveEvent* e) override;
82  void dropEvent(QDropEvent* e) override;
83 
84 };
85 
86 #endif // GUI_MTP_H
Definition: ui_GUI_MTP.h:109
The MTP class.
Definition: MTP.h:42
Definition: GUI_MTP.h:38
std::shared_ptr< MTP_Device > MTP_DevicePtr
MTP_DevicePtr.
Definition: MTP_Typedefs.h:69
Dialog with Settings connection. Also contains triggers for language_changed() and skin_changed()...
Definition: SayonaraDialog.h:38
The MTP_CopyFiles class.
Definition: MTP_CopyFiles.h:36