├── .github └── workflows │ └── build.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── application.cpp ├── application.h ├── cio ├── cfilejob.cpp ├── cfilejob.h ├── cfilesizejob.cpp └── cfilesizejob.h ├── cmake └── FindLibmpv.cmake ├── com.cutefish.FileManager.xml ├── cutefish-filemanager.desktop ├── dbusinterface.cpp ├── dbusinterface.h ├── debian ├── changelog ├── compat ├── control ├── copyright ├── rules └── source │ └── format ├── desktop ├── desktop.cpp ├── desktop.h ├── desktopsettings.cpp ├── desktopsettings.h ├── desktopview.cpp ├── desktopview.h ├── dockdbusinterface.cpp └── dockdbusinterface.h ├── desktopiconprovider.cpp ├── desktopiconprovider.h ├── dialogs ├── createfolderdialog.cpp ├── createfolderdialog.h ├── filepropertiesdialog.cpp ├── filepropertiesdialog.h ├── openwithdialog.cpp └── openwithdialog.h ├── draganddrop ├── declarativedragdropevent.cpp ├── declarativedragdropevent.h ├── declarativedroparea.cpp ├── declarativedroparea.h ├── declarativemimedata.cpp └── declarativemimedata.h ├── helper ├── datehelper.cpp ├── datehelper.h ├── filelauncher.cpp ├── filelauncher.h ├── fm.cpp ├── fm.h ├── keyboardsearchmanager.cpp ├── keyboardsearchmanager.h ├── pathhistory.cpp ├── pathhistory.h ├── shortcut.cpp └── shortcut.h ├── images ├── dark │ ├── add.svg │ ├── checked.svg │ ├── date.svg │ ├── drive-harddisk-root.svg │ ├── drive-harddisk.svg │ ├── drive-optical.svg │ ├── drive-removable-media-usb.svg │ ├── folder-desktop.svg │ ├── folder-document.svg │ ├── folder-download.svg │ ├── folder-home.svg │ ├── folder-music.svg │ ├── folder-picture.svg │ ├── folder-video.svg │ ├── go-next.svg │ ├── go-previous.svg │ ├── grid.svg │ ├── list.svg │ ├── order_by_name.svg │ ├── size.svg │ ├── up.svg │ └── user-trash.svg ├── drive-harddisk-root.svg ├── drive-harddisk.svg ├── drive-optical.svg ├── drive-removable-media-usb.svg ├── folder-desktop.svg ├── folder-document.svg ├── folder-download.svg ├── folder-home.svg ├── folder-music.svg ├── folder-picture.svg ├── folder-video.svg ├── light │ ├── add.svg │ ├── checked.svg │ ├── date.svg │ ├── drive-harddisk-root.svg │ ├── drive-harddisk.svg │ ├── drive-optical.svg │ ├── drive-removable-media-usb.svg │ ├── folder-desktop.svg │ ├── folder-document.svg │ ├── folder-download.svg │ ├── folder-home.svg │ ├── folder-music.svg │ ├── folder-picture.svg │ ├── folder-video.svg │ ├── go-next.svg │ ├── go-previous.svg │ ├── grid.svg │ ├── list.svg │ ├── order_by_name.svg │ ├── size.svg │ ├── up.svg │ └── user-trash.svg ├── media-optical-data.svg ├── media-optical-mixed-cd.svg ├── media-optical.svg └── user-trash.svg ├── main.cpp ├── mimetype ├── mimeappmanager.cpp ├── mimeappmanager.h ├── xdgdesktopfile.cpp └── xdgdesktopfile.h ├── model ├── dirlister.cpp ├── dirlister.h ├── foldermodel.cpp ├── foldermodel.h ├── pathbarmodel.cpp ├── pathbarmodel.h ├── placesitem.cpp ├── placesitem.h ├── placesmodel.cpp ├── placesmodel.h ├── positioner.cpp └── positioner.h ├── qml.qrc ├── qml ├── Controls │ └── IconButton.qml ├── Desktop │ ├── Main.qml │ └── Wallpaper.qml ├── Dialogs │ ├── CreateFolderDialog.qml │ ├── DeleteDialog.qml │ ├── EmptyTrashDialog.qml │ ├── OpenWithDialog.qml │ └── PropertiesDialog.qml ├── FolderGridItem.qml ├── FolderGridView.qml ├── FolderListItem.qml ├── FolderListView.qml ├── FolderPage.qml ├── GlobalSettings.qml ├── OptionsMenu.qml ├── PathBar.qml ├── SideBar.qml └── main.qml ├── screenshots └── Screenshot_20211025_151224.png ├── templates └── TextFile.txt ├── thumbnailer ├── thumbnailcache.cpp ├── thumbnailcache.h ├── thumbnailprovider.cpp └── thumbnailprovider.h ├── translations ├── ar_AA.ts ├── be_BY.ts ├── be_Latn.ts ├── bg_BG.ts ├── bs_BA.ts ├── cs_CZ.ts ├── da_DK.ts ├── de_DE.ts ├── en_US.ts ├── eo_XX.ts ├── es_ES.ts ├── es_MX.ts ├── fa_IR.ts ├── fi_FI.ts ├── fr_FR.ts ├── he_IL.ts ├── hi_IN.ts ├── hu_HU.ts ├── id_ID.ts ├── ie.ts ├── it_IT.ts ├── ja_JP.ts ├── lt_LT.ts ├── lv_LV.ts ├── ml_IN.ts ├── nb_NO.ts ├── ne_NP.ts ├── pl_PL.ts ├── pt_BR.ts ├── pt_PT.ts ├── ro_RO.ts ├── ru_RU.ts ├── si_LK.ts ├── sk_SK.ts ├── so.ts ├── sr_RS.ts ├── sv_SE.ts ├── sw.ts ├── ta_IN.ts ├── tr_TR.ts ├── uk_UA.ts ├── uz_UZ.ts ├── zh_CN.ts └── zh_TW.ts ├── widgets ├── itemviewadapter.cpp ├── itemviewadapter.h ├── rubberband.cpp └── rubberband.h ├── window.cpp └── window.h /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | debian: 11 | name: Debian 12 | runs-on: ubuntu-latest 13 | container: docker.io/library/debian:sid 14 | steps: 15 | - name: Checkout Source 16 | uses: actions/checkout@v2 17 | - name: Update repository 18 | run: apt-get update -y 19 | - name: Install the basic dev packages 20 | run: apt-get install -y equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++ 21 | - name: Install build dependencies 22 | run: mk-build-deps -i -t "apt-get --yes" -r 23 | - name: Build Package 24 | run: dpkg-buildpackage -b -uc -us -j$(nproc) 25 | 26 | ubuntu: 27 | name: Ubuntu 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Checkout Source 31 | uses: actions/checkout@v2 32 | - name: Update repository 33 | run: sudo apt-get update -y 34 | - name: Install the basic dev packages 35 | run: sudo apt-get install -y equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++ 36 | - name: Install build dependencies 37 | run: sudo mk-build-deps -i -t "apt-get --yes" -r 38 | - name: Build Package 39 | run: dpkg-buildpackage -b -uc -us -j$(nproc) 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | *.so.* 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | object_script.*.Release 15 | object_script.*.Debug 16 | *_plugin_import.cpp 17 | /.qmake.cache 18 | /.qmake.stash 19 | *.pro.user 20 | *.pro.user.* 21 | *.qbs.user 22 | *.qbs.user.* 23 | *.moc 24 | moc_*.cpp 25 | moc_*.h 26 | qrc_*.cpp 27 | ui_*.h 28 | *.qmlc 29 | *.jsc 30 | Makefile* 31 | *build-* 32 | *.qm 33 | *.prl 34 | 35 | # Qt unit tests 36 | target_wrapper.* 37 | 38 | # QtCreator 39 | *.autosave 40 | 41 | # QtCreator Qml 42 | *.qmlproject.user 43 | *.qmlproject.user.* 44 | 45 | # QtCreator CMake 46 | CMakeLists.txt.user* 47 | 48 | # QtCreator 4.8< compilation database 49 | compile_commands.json 50 | 51 | # QtCreator local machine specific files for imported projects 52 | *creator.user* 53 | 54 | /build/* 55 | .vscode -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | project(filemanager LANGUAGES CXX) 4 | 5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | 7 | set(CMAKE_AUTOUIC ON) 8 | set(CMAKE_AUTOMOC ON) 9 | set(CMAKE_AUTORCC ON) 10 | 11 | set(CMAKE_CXX_STANDARD 11) 12 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 13 | 14 | find_package(Qt5 COMPONENTS Core DBus Quick LinguistTools REQUIRED) 15 | # find_package(FishUI REQUIRED) 16 | 17 | find_package(KF5KIO) 18 | find_package(KF5Solid) 19 | find_package(KF5WindowSystem) 20 | find_package(KF5Config) 21 | 22 | qt5_add_dbus_adaptor(DBUS_SOURCES 23 | com.cutefish.FileManager.xml 24 | application.h Application) 25 | 26 | add_executable(cutefish-filemanager 27 | main.cpp 28 | application.cpp 29 | window.cpp 30 | dbusinterface.cpp 31 | 32 | draganddrop/declarativedroparea.cpp 33 | draganddrop/declarativedragdropevent.cpp 34 | draganddrop/declarativemimedata.cpp 35 | 36 | model/foldermodel.cpp 37 | model/placesmodel.cpp 38 | model/placesitem.cpp 39 | model/pathbarmodel.cpp 40 | model/dirlister.cpp 41 | model/positioner.cpp 42 | 43 | cio/cfilejob.cpp 44 | cio/cfilesizejob.cpp 45 | 46 | dialogs/createfolderdialog.cpp 47 | dialogs/filepropertiesdialog.cpp 48 | dialogs/openwithdialog.cpp 49 | widgets/rubberband.cpp 50 | widgets/itemviewadapter.cpp 51 | 52 | desktop/desktop.cpp 53 | desktop/desktopview.cpp 54 | desktop/desktopsettings.cpp 55 | desktop/dockdbusinterface.cpp 56 | 57 | helper/datehelper.cpp 58 | helper/pathhistory.cpp 59 | helper/fm.cpp 60 | helper/shortcut.cpp 61 | helper/filelauncher.cpp 62 | helper/keyboardsearchmanager.cpp 63 | 64 | mimetype/mimeappmanager.cpp 65 | mimetype/xdgdesktopfile.cpp 66 | 67 | thumbnailer/thumbnailprovider.cpp 68 | thumbnailer/thumbnailcache.cpp 69 | 70 | desktopiconprovider.cpp 71 | 72 | qml.qrc 73 | 74 | ${DBUS_SOURCES} 75 | ) 76 | 77 | target_link_libraries(cutefish-filemanager 78 | PRIVATE 79 | Qt5::Core 80 | Qt5::DBus 81 | Qt5::Quick 82 | 83 | KF5::KIOCore 84 | KF5::KIOFileWidgets 85 | KF5::KIOWidgets 86 | KF5::Solid 87 | KF5::WindowSystem 88 | KF5::ConfigCore 89 | 90 | # FishUI 91 | ) 92 | 93 | file(GLOB TS_FILES translations/*.ts) 94 | qt5_create_translation(QM_FILES ${TS_FILES}) 95 | add_custom_target(translations DEPENDS ${QM_FILES} SOURCES ${TS_FILES}) 96 | add_dependencies(cutefish-filemanager translations) 97 | 98 | install(TARGETS cutefish-filemanager RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 99 | install(FILES cutefish-filemanager.desktop DESTINATION "/usr/share/applications") 100 | install(FILES ${QM_FILES} DESTINATION /usr/share/cutefish-filemanager/translations) 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # File Manager 2 | 3 | Cutefish File Manager, simple to use, beautiful, and retain the classic PC interactive design. 4 | 5 | ![screenshot](screenshots/Screenshot_20211025_151224.png) 6 | 7 | ## Dependencies 8 | 9 | ### Ubuntu 10 | 11 | ``` 12 | sudo apt install equivs curl git devscripts lintian build-essential automake autotools-dev --no-install-recommends 13 | 14 | sudo mk-build-deps -i -t "apt-get --yes" -r 15 | ``` 16 | 17 | ### Debian 18 | 19 | ``` 20 | sudo apt install build-essential cmake extra-cmake-modules libkf5kio-dev libkf5solid-dev libkf5windowsystem-dev libkf5config-dev qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools 21 | ``` 22 | 23 | ### ArchLinux 24 | 25 | ```shell 26 | sudo pacman -S extra-cmake-modules qt5-base qt5-quickcontrols2 taglib kio 27 | ``` 28 | 29 | ## Build 30 | 31 | ```shell 32 | mkdir build 33 | cd build 34 | cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. 35 | make 36 | ``` 37 | 38 | ## Install 39 | 40 | ```shell 41 | sudo make install 42 | ``` 43 | 44 | ## License 45 | 46 | This project has been licensed by GPLv3. 47 | -------------------------------------------------------------------------------- /application.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef APPLICATION_H 21 | #define APPLICATION_H 22 | 23 | #include 24 | 25 | class Application : public QApplication 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit Application(int& argc, char** argv); 31 | 32 | int run(); 33 | 34 | // DBus 35 | void openFiles(const QStringList &paths); 36 | void moveToTrash(const QStringList &paths); 37 | void emptyTrash(); 38 | 39 | private: 40 | void openWindow(const QString &path); 41 | QStringList formatUriList(const QStringList &list); 42 | 43 | private: 44 | bool parseCommandLineArgs(); 45 | 46 | private: 47 | bool m_instance; 48 | }; 49 | 50 | #endif // APPLICATION_H 51 | -------------------------------------------------------------------------------- /cio/cfilejob.cpp: -------------------------------------------------------------------------------- 1 | #include "cfilejob.h" 2 | 3 | CFileJob::CFileJob(QObject *parent) 4 | : QThread(parent) 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /cio/cfilejob.h: -------------------------------------------------------------------------------- 1 | #ifndef CFILEJOB_H 2 | #define CFILEJOB_H 3 | 4 | #include 5 | 6 | class CFileJob : public QThread 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit CFileJob(QObject *parent = nullptr); 12 | 13 | signals: 14 | 15 | }; 16 | 17 | #endif // CFILEJOB_H 18 | -------------------------------------------------------------------------------- /cio/cfilesizejob.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "cfilesizejob.h" 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | CFileSizeJob::CFileSizeJob(QObject *parent) 29 | : QThread(parent) 30 | { 31 | 32 | } 33 | 34 | CFileSizeJob::~CFileSizeJob() 35 | { 36 | } 37 | 38 | qint64 CFileSizeJob::totalSize() const 39 | { 40 | return m_totalSize; 41 | } 42 | 43 | void CFileSizeJob::start(const QList &urls) 44 | { 45 | if (urls.isEmpty()) 46 | return; 47 | 48 | m_urls = urls; 49 | m_running = true; 50 | 51 | QThread::start(); 52 | } 53 | 54 | void CFileSizeJob::stop() 55 | { 56 | m_running = false; 57 | 58 | QThread::wait(); 59 | } 60 | 61 | void CFileSizeJob::run() 62 | { 63 | m_totalSize = 0; 64 | m_filesCount = 0; 65 | m_directoryCount = 0; 66 | 67 | for (QUrl &url : m_urls) { 68 | if (!m_running) 69 | return; 70 | 71 | QFileInfo i(url.toLocalFile()); 72 | 73 | if (i.filePath() == "/proc/kcore" || i.filePath() == "/dev/core") 74 | continue; 75 | 76 | if (i.isSymLink() && i.symLinkTarget() == "/proc/kcore") 77 | continue; 78 | 79 | if (i.isFile()) { 80 | m_totalSize += i.size(); 81 | m_filesCount++; 82 | emit sizeChanged(); 83 | } else if (i.isDir()) { 84 | m_directoryCount++; 85 | 86 | QDirIterator it(url.toLocalFile(), QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); 87 | 88 | while (it.hasNext()) { 89 | if (!m_running) 90 | return; 91 | 92 | QFileInfo info(it.next()); 93 | 94 | if (info.filePath() == "/proc/kcore" || info.filePath() == "/dev/core") 95 | continue; 96 | 97 | if (info.isSymLink()) 98 | continue; 99 | 100 | if (info.isFile()) 101 | m_filesCount++; 102 | else if (info.isDir()) 103 | m_directoryCount++; 104 | 105 | m_totalSize += info.size(); 106 | 107 | emit sizeChanged(); 108 | } 109 | } 110 | } 111 | 112 | emit result(); 113 | } 114 | -------------------------------------------------------------------------------- /cio/cfilesizejob.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef CFILESIZEJOB_H 21 | #define CFILESIZEJOB_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | class CFileSizeJob : public QThread 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit CFileSizeJob(QObject *parent = nullptr); 33 | ~CFileSizeJob(); 34 | 35 | qint64 totalSize() const; 36 | 37 | void start(const QList &urls); 38 | void stop(); 39 | 40 | signals: 41 | void sizeChanged(); 42 | void result(); 43 | 44 | protected: 45 | void run() override; 46 | 47 | private: 48 | bool m_running; 49 | QList m_urls; 50 | qint64 m_totalSize; 51 | int m_filesCount; 52 | int m_directoryCount; 53 | }; 54 | 55 | #endif // CFILESIZEJOB_H 56 | -------------------------------------------------------------------------------- /cmake/FindLibmpv.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-FileCopyrightText: 2006 Laurent Montel 3 | # SPDX-FileCopyrightText: 2019 Heiko Becker 4 | # SPDX-FileCopyrightText: 2020 Elvis Angelaccio 5 | # SPDX-FileCopyrightText: 2021 George Florea Bănuș 6 | # 7 | # SPDX-License-Identifier: BSD-3-Clause 8 | # 9 | # 10 | # FindLibmpv 11 | # ---------- 12 | # 13 | # Find the mpv media player client library. 14 | # 15 | # Defines the following variables: 16 | # 17 | # - Libmpv_FOUND 18 | # True if it finds the library and include directory 19 | # 20 | # - Libmpv_INCLUDE_DIRS 21 | # The libmpv include dirs for use with target_include_directories 22 | # 23 | # - Libmpvb_LIBRARIES 24 | # The libmpv libraries for use with target_link_libraries() 25 | # 26 | # - Libmpv_VERSION 27 | # The version of the found libmpv 28 | # 29 | # 30 | # Defines the following imported target if 'Libmpv_FOUND' is true: 31 | # 32 | # - Libmpv::Libmpv 33 | # 34 | 35 | find_package(PkgConfig QUIET) 36 | 37 | pkg_search_module(PC_MPV QUIET mpv) 38 | 39 | find_path(Libmpv_INCLUDE_DIRS 40 | NAMES client.h 41 | PATH_SUFFIXES mpv 42 | HINTS ${PC_MPV_INCLUDEDIR} 43 | ) 44 | 45 | 46 | find_library(Libmpv_LIBRARIES 47 | NAMES mpv 48 | HINTS ${PC_MPV_LIBDIR} 49 | ) 50 | 51 | set(Libmpv_VERSION ${PC_MPV_VERSION}) 52 | 53 | include(FindPackageHandleStandardArgs) 54 | find_package_handle_standard_args(Libmpv 55 | FOUND_VAR 56 | Libmpv_FOUND 57 | REQUIRED_VARS 58 | Libmpv_LIBRARIES 59 | Libmpv_INCLUDE_DIRS 60 | VERSION_VAR 61 | Libmpv_VERSION 62 | ) 63 | 64 | if (Libmpv_FOUND AND NOT TARGET Libmpv::Libmpv) 65 | add_library(Libmpv::Libmpv UNKNOWN IMPORTED) 66 | set_target_properties(Libmpv::Libmpv PROPERTIES 67 | IMPORTED_LOCATION "${Libmpv_LIBRARIES}" 68 | INTERFACE_INCLUDE_DIRECTORIES "${Libmpv_INCLUDE_DIRS}" 69 | ) 70 | endif() 71 | 72 | mark_as_advanced(Libmpv_LIBRARIES Libmpv_INCLUDE_DIRS) 73 | 74 | include(FeatureSummary) 75 | set_package_properties(Libmpv PROPERTIES 76 | URL "https://mpv.io" 77 | DESCRIPTION "mpv media player client library" 78 | ) 79 | -------------------------------------------------------------------------------- /com.cutefish.FileManager.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /cutefish-filemanager.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=File Manager 4 | Name[zh_CN]=文件管理 5 | GenericName=File Manager 6 | Comment=Cutefish File Manager 7 | Exec=cutefish-filemanager %u 8 | MimeType=inode/directory; 9 | Icon=file-system-manager 10 | Categories=Qt;System;FileTools;FileManager; 11 | StartupNotify=true -------------------------------------------------------------------------------- /dbusinterface.cpp: -------------------------------------------------------------------------------- 1 | #include "dbusinterface.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | DBusInterface::DBusInterface() 9 | { 10 | QDBusConnection::sessionBus().registerObject("/org/freedesktop/FileManager1", this, 11 | QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); 12 | QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface(); 13 | 14 | if (sessionInterface) { 15 | sessionInterface->registerService(QStringLiteral("org.freedesktop.FileManager1"), QDBusConnectionInterface::QueueService); 16 | } 17 | } 18 | 19 | void DBusInterface::ShowFolders(const QStringList &uriList, const QString &startUpId) 20 | { 21 | Q_UNUSED(startUpId); 22 | 23 | QProcess::startDetached("cutefish-filemanager", uriList); 24 | } 25 | 26 | void DBusInterface::ShowItems(const QStringList &uriList, const QString &startUpId) 27 | { 28 | Q_UNUSED(startUpId); 29 | 30 | QProcess::startDetached("cutefish-filemanager", uriList); 31 | } 32 | 33 | void DBusInterface::ShowItemProperties(const QStringList &uriList, const QString &startUpId) 34 | { 35 | Q_UNUSED(uriList); 36 | Q_UNUSED(startUpId); 37 | 38 | // TODO 39 | } 40 | -------------------------------------------------------------------------------- /dbusinterface.h: -------------------------------------------------------------------------------- 1 | #ifndef DBUSINTERFACE_H 2 | #define DBUSINTERFACE_H 3 | 4 | #include 5 | 6 | class DBusInterface : QObject 7 | { 8 | Q_OBJECT 9 | Q_CLASSINFO("D-Bus Interface", "org.freedesktop.FileManager1") 10 | 11 | public: 12 | explicit DBusInterface(); 13 | 14 | Q_SCRIPTABLE void ShowFolders(const QStringList& uriList, const QString& startUpId); 15 | Q_SCRIPTABLE void ShowItems(const QStringList& uriList, const QString& startUpId); 16 | Q_SCRIPTABLE void ShowItemProperties(const QStringList& uriList, const QString& startUpId); 17 | }; 18 | 19 | #endif // DBUSINTERFACE_H 20 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | cutefish-filemanager (0.8) UNRELEASED; urgency=high 2 | 3 | * Initial release (CutefishOS) 4 | 5 | -- CutefishOS Packaging Team Sat, 29 Jan 2022 03:21:19 +0800 -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: cutefish-filemanager 2 | Section: devel 3 | Priority: optional 4 | Maintainer: CutefishOS 5 | Build-Depends: cmake, 6 | debhelper (>= 9), 7 | extra-cmake-modules, 8 | libkf5kio-dev, 9 | libkf5solid-dev, 10 | libkf5windowsystem-dev, 11 | libkf5config-dev, 12 | qtbase5-dev, 13 | qtbase5-private-dev, 14 | qtdeclarative5-dev, 15 | qtquickcontrols2-5-dev, 16 | qttools5-dev, 17 | qttools5-dev-tools 18 | Standards-Version: 4.5.0 19 | Homepage: https://cutefishos.com 20 | 21 | Package: cutefish-filemanager 22 | Architecture: any 23 | Depends: qml-module-qtquick-controls2, 24 | qml-module-qtquick2, 25 | qml-module-qtquick-layouts, 26 | qml-module-qt-labs-platform, 27 | qml-module-qt-labs-settings, 28 | qml-module-qtqml, 29 | qml-module-qtquick-window2, 30 | qml-module-qtquick-shapes, 31 | qml-module-qtquick-dialogs, 32 | qml-module-qtgraphicaleffects 33 | ${misc:Depends}, 34 | ${shlibs:Depends} 35 | Description: CutefishOS File Manager 36 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: cutefish-filemanager 3 | Source: cutefishos.com 4 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | export QT_SELECT=5 4 | 5 | %: 6 | dh $@ --parallel 7 | 8 | override_dh_auto_configure: 9 | dh_auto_configure -- -DEMBED_TRANSLATIONS=ON -DBUILD_TESTING=ON 10 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /desktop/desktop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "desktop.h" 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | Desktop::Desktop(QObject *parent) 28 | : QObject(parent) 29 | { 30 | for (QScreen *screen : QGuiApplication::screens()) { 31 | screenAdded(screen); 32 | } 33 | 34 | connect(qApp, &QGuiApplication::screenAdded, this, &Desktop::screenAdded); 35 | connect(qApp, &QGuiApplication::screenRemoved, this, &Desktop::screenRemoved); 36 | } 37 | 38 | void Desktop::screenAdded(QScreen *screen) 39 | { 40 | if (!m_list.contains(screen)) { 41 | DesktopView *view = new DesktopView(screen); 42 | view->show(); 43 | m_list.insert(screen, view); 44 | } 45 | } 46 | 47 | void Desktop::screenRemoved(QScreen *screen) 48 | { 49 | if (m_list.contains(screen)) { 50 | DesktopView *view = m_list.find(screen).value(); 51 | view->setVisible(false); 52 | view->deleteLater(); 53 | m_list.remove(screen); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /desktop/desktop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef DESKTOP_H 21 | #define DESKTOP_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include "desktopview.h" 28 | 29 | class Desktop : public QObject 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit Desktop(QObject *parent = nullptr); 35 | 36 | private slots: 37 | void screenAdded(QScreen *qscreen); 38 | void screenRemoved(QScreen *qscreen); 39 | 40 | private: 41 | QMap m_list; 42 | }; 43 | 44 | #endif // DESKTOP_H 45 | -------------------------------------------------------------------------------- /desktop/desktopsettings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "desktopsettings.h" 21 | 22 | #include 23 | #include 24 | 25 | DesktopSettings::DesktopSettings(QObject *parent) 26 | : QObject(parent) 27 | , m_interface("com.cutefish.Settings", 28 | "/Theme", "com.cutefish.Theme", 29 | QDBusConnection::sessionBus(), this) 30 | { 31 | QDBusServiceWatcher *watcher = new QDBusServiceWatcher(this); 32 | watcher->setConnection(QDBusConnection::sessionBus()); 33 | watcher->addWatchedService("com.cutefish.Settings"); 34 | connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &DesktopSettings::init); 35 | 36 | init(); 37 | } 38 | 39 | QString DesktopSettings::wallpaper() const 40 | { 41 | return m_wallpaper; 42 | } 43 | 44 | bool DesktopSettings::backgroundVisible() const 45 | { 46 | return m_interface.property("backgroundVisible").toBool(); 47 | } 48 | 49 | bool DesktopSettings::dimsWallpaper() const 50 | { 51 | return m_interface.property("darkModeDimsWallpaer").toBool(); 52 | } 53 | 54 | int DesktopSettings::backgroundType() const 55 | { 56 | return m_interface.property("backgroundType").toInt(); 57 | } 58 | 59 | QString DesktopSettings::backgroundColor() const 60 | { 61 | return m_interface.property("backgroundColor").toString(); 62 | } 63 | 64 | void DesktopSettings::launch(const QString &command, const QStringList &args) 65 | { 66 | QProcess process; 67 | process.setProgram(command); 68 | process.setArguments(args); 69 | process.startDetached(); 70 | } 71 | 72 | void DesktopSettings::init() 73 | { 74 | if (m_interface.isValid()) { 75 | connect(&m_interface, SIGNAL(wallpaperChanged(QString)), this, SLOT(onWallpaperChanged(QString))); 76 | connect(&m_interface, SIGNAL(darkModeDimsWallpaerChanged()), this, SIGNAL(dimsWallpaperChanged())); 77 | connect(&m_interface, SIGNAL(backgroundTypeChanged()), this, SIGNAL(backgroundTypeChanged())); 78 | connect(&m_interface, SIGNAL(backgroundColorChanged()), this, SIGNAL(backgroundColorChanged())); 79 | connect(&m_interface, SIGNAL(backgroundVisibleChanged()), this, SIGNAL(backgroundVisibleChanged())); 80 | m_wallpaper = m_interface.property("wallpaper").toString(); 81 | emit wallpaperChanged(); 82 | } 83 | } 84 | 85 | void DesktopSettings::onWallpaperChanged(QString path) 86 | { 87 | if (path != m_wallpaper) { 88 | m_wallpaper = path; 89 | emit wallpaperChanged(); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /desktop/desktopsettings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef SETTINGS_H 21 | #define SETTINGS_H 22 | 23 | #include 24 | #include 25 | 26 | class DesktopSettings : public QObject 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(QString wallpaper READ wallpaper NOTIFY wallpaperChanged) 30 | Q_PROPERTY(bool dimsWallpaper READ dimsWallpaper NOTIFY dimsWallpaperChanged) 31 | Q_PROPERTY(bool backgroundVisible READ backgroundVisible NOTIFY backgroundVisibleChanged) 32 | Q_PROPERTY(int backgroundType READ backgroundType NOTIFY backgroundTypeChanged) 33 | Q_PROPERTY(QString backgroundColor READ backgroundColor NOTIFY backgroundColorChanged) 34 | 35 | public: 36 | explicit DesktopSettings(QObject *parent = nullptr); 37 | 38 | QString wallpaper() const; 39 | bool dimsWallpaper() const; 40 | bool backgroundVisible() const; 41 | int backgroundType() const; 42 | QString backgroundColor() const; 43 | 44 | Q_INVOKABLE void launch(const QString &command, const QStringList &args); 45 | 46 | signals: 47 | void wallpaperChanged(); 48 | void dimsWallpaperChanged(); 49 | void backgroundColorChanged(); 50 | void backgroundTypeChanged(); 51 | void backgroundVisibleChanged(); 52 | 53 | private slots: 54 | void init(); 55 | void onWallpaperChanged(QString); 56 | 57 | private: 58 | QDBusInterface m_interface; 59 | QString m_wallpaper; 60 | }; 61 | 62 | #endif // SETTINGS_H 63 | -------------------------------------------------------------------------------- /desktop/desktopview.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "desktopview.h" 21 | #include "dockdbusinterface.h" 22 | #include "thumbnailer/thumbnailprovider.h" 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | DesktopView::DesktopView(QScreen *screen, QQuickView *parent) 34 | : QQuickView(parent) 35 | , m_screen(screen) 36 | { 37 | m_screenRect = m_screen->geometry(); 38 | this->setFlag(Qt::FramelessWindowHint); 39 | this->setColor(QColor(Qt::transparent)); 40 | KWindowSystem::setType(winId(), NET::Desktop); 41 | KWindowSystem::setState(winId(), NET::KeepBelow); 42 | 43 | engine()->rootContext()->setContextProperty("desktopView", this); 44 | engine()->rootContext()->setContextProperty("Dock", DockDBusInterface::self()); 45 | QWindow::fromWinId(winId())->setOpacity(0.99); 46 | engine()->addImageProvider("thumbnailer", new ThumbnailProvider()); 47 | 48 | setTitle(tr("Desktop")); 49 | setScreen(m_screen); 50 | setResizeMode(QQuickView::SizeRootObjectToView); 51 | 52 | onGeometryChanged(); 53 | onPrimaryScreenChanged(QGuiApplication::primaryScreen()); 54 | 55 | // 主屏改变 56 | connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, &DesktopView::onPrimaryScreenChanged); 57 | 58 | connect(m_screen, &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged); 59 | connect(m_screen, &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged); 60 | } 61 | 62 | QRect DesktopView::screenRect() 63 | { 64 | return m_screenRect; 65 | } 66 | 67 | void DesktopView::onPrimaryScreenChanged(QScreen *screen) 68 | { 69 | bool isPrimaryScreen = m_screen->name() == screen->name(); 70 | 71 | onGeometryChanged(); 72 | 73 | setSource(isPrimaryScreen ? QStringLiteral("qrc:/qml/Desktop/Main.qml") 74 | : QStringLiteral("qrc:/qml/Desktop/Wallpaper.qml")); 75 | } 76 | 77 | void DesktopView::onGeometryChanged() 78 | { 79 | m_screenRect = m_screen->geometry().adjusted(0, 0, 1, 1); 80 | setGeometry(m_screenRect); 81 | emit screenRectChanged(); 82 | } 83 | -------------------------------------------------------------------------------- /desktop/desktopview.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef DESKTOPVIEW_H 21 | #define DESKTOPVIEW_H 22 | 23 | #include 24 | #include 25 | 26 | class Desktop; 27 | class DesktopView : public QQuickView 28 | { 29 | Q_OBJECT 30 | Q_PROPERTY(QRect screenRect READ screenRect NOTIFY screenRectChanged) 31 | 32 | public: 33 | explicit DesktopView(QScreen *screen = nullptr, QQuickView *parent = nullptr); 34 | 35 | QRect screenRect(); 36 | 37 | signals: 38 | void screenRectChanged(); 39 | 40 | private slots: 41 | void onPrimaryScreenChanged(QScreen *screen); 42 | void onGeometryChanged(); 43 | 44 | private: 45 | QScreen *m_screen; 46 | QRect m_screenRect; 47 | }; 48 | 49 | #endif // DESKTOPVIEW_H 50 | -------------------------------------------------------------------------------- /desktop/dockdbusinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef DOCKDBUSINTERFACE_H 21 | #define DOCKDBUSINTERFACE_H 22 | 23 | #include 24 | #include 25 | 26 | class DockDBusInterface : public QObject 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(int leftMargin READ leftMargin NOTIFY marginsChanged) 30 | Q_PROPERTY(int rightMargin READ rightMargin NOTIFY marginsChanged) 31 | Q_PROPERTY(int bottomMargin READ bottomMargin NOTIFY marginsChanged) 32 | 33 | public: 34 | static DockDBusInterface *self(); 35 | explicit DockDBusInterface(QObject *parent = nullptr); 36 | 37 | int leftMargin() const; 38 | int rightMargin() const; 39 | int bottomMargin() const; 40 | 41 | signals: 42 | void marginsChanged(); 43 | 44 | private slots: 45 | void updateMargins(); 46 | 47 | private: 48 | QDBusInterface m_dockInterface; 49 | 50 | int m_leftMargin; 51 | int m_rightMargin; 52 | int m_bottomMargin; 53 | }; 54 | 55 | #endif // DOCKDBUSINTERFACE_H 56 | -------------------------------------------------------------------------------- /desktopiconprovider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "desktopiconprovider.h" 21 | #include 22 | 23 | DesktopIconProvider::DesktopIconProvider() 24 | : QQuickImageProvider(QQuickImageProvider::Pixmap) 25 | { 26 | 27 | } 28 | 29 | QPixmap DesktopIconProvider::requestPixmap(const QString &id, QSize *realSize, 30 | const QSize &requestedSize) 31 | { 32 | QSize size(requestedSize); 33 | if (size.width() < 1) 34 | size.setWidth(1); 35 | if (size.height() < 1) 36 | size.setHeight(1); 37 | 38 | if (realSize) 39 | *realSize = size; 40 | 41 | if (id.startsWith(QLatin1Char('/'))) 42 | return QPixmap(id).scaled(size); 43 | 44 | QIcon icon = QIcon::fromTheme(id); 45 | if (icon.isNull()) 46 | icon = QIcon::fromTheme(QLatin1String("application-x-desktop")); 47 | 48 | return icon.pixmap(size); 49 | } 50 | -------------------------------------------------------------------------------- /desktopiconprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef DESKTOPICONPROVIDER_H 21 | #define DESKTOPICONPROVIDER_H 22 | 23 | #include 24 | 25 | class DesktopIconProvider : public QQuickImageProvider 26 | { 27 | public: 28 | DesktopIconProvider(); 29 | 30 | QPixmap requestPixmap(const QString &id, QSize *realSize, const QSize &requestedSize); 31 | }; 32 | 33 | #endif // DESKTOPICONPROVIDER_H 34 | -------------------------------------------------------------------------------- /dialogs/createfolderdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "createfolderdialog.h" 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | CreateFolderDialog::CreateFolderDialog(QObject *parent) 28 | : QObject(parent) 29 | { 30 | 31 | } 32 | 33 | void CreateFolderDialog::setPath(const QString &path) 34 | { 35 | m_path = path; 36 | } 37 | 38 | void CreateFolderDialog::show() 39 | { 40 | QQmlApplicationEngine *engine = new QQmlApplicationEngine; 41 | engine->rootContext()->setContextProperty("main", this); 42 | engine->load(QUrl("qrc:/qml/Dialogs/CreateFolderDialog.qml")); 43 | } 44 | 45 | void CreateFolderDialog::newFolder(const QString &folderName) 46 | { 47 | if (m_path.isEmpty() || folderName.isEmpty()) 48 | return; 49 | 50 | auto job = KIO::mkdir(QUrl(m_path + "/" + folderName)); 51 | job->start(); 52 | } 53 | -------------------------------------------------------------------------------- /dialogs/createfolderdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef CREATEFOLDERDIALOG_H 21 | #define CREATEFOLDERDIALOG_H 22 | 23 | #include 24 | 25 | class CreateFolderDialog : public QObject 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit CreateFolderDialog(QObject *parent = nullptr); 31 | 32 | void setPath(const QString &path); 33 | void show(); 34 | 35 | Q_INVOKABLE void newFolder(const QString &folderName); 36 | 37 | private: 38 | QString m_path; 39 | }; 40 | 41 | #endif // CREATEFOLDERDIALOG_H 42 | -------------------------------------------------------------------------------- /dialogs/openwithdialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "openwithdialog.h" 21 | #include "../mimetype/mimeappmanager.h" 22 | #include "../helper/filelauncher.h" 23 | 24 | #include 25 | #include 26 | 27 | OpenWithDialog::OpenWithDialog(const QUrl &url, QQuickView *parent) 28 | : QQuickView(parent) 29 | , m_url(url.toLocalFile()) 30 | { 31 | setFlag(Qt::Dialog); 32 | setTitle(tr("Open With")); 33 | setResizeMode(QQuickView::SizeViewToRootObject); 34 | 35 | engine()->rootContext()->setContextProperty("main", this); 36 | engine()->rootContext()->setContextProperty("mimeAppManager", MimeAppManager::self()); 37 | engine()->rootContext()->setContextProperty("launcher", FileLauncher::self()); 38 | 39 | setSource(QUrl("qrc:/qml/Dialogs/OpenWithDialog.qml")); 40 | 41 | QRect rect = geometry(); 42 | setMinimumSize(rect.size()); 43 | setMaximumSize(rect.size()); 44 | 45 | connect(this, &QQuickView::visibleChanged, this, [=] { 46 | if (!this->isVisible()) 47 | this->deleteLater(); 48 | }); 49 | } 50 | 51 | QString OpenWithDialog::url() const 52 | { 53 | return m_url; 54 | } 55 | -------------------------------------------------------------------------------- /dialogs/openwithdialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef OPENWITHDIALOG_H 21 | #define OPENWITHDIALOG_H 22 | 23 | #include 24 | 25 | class OpenWithDialog : public QQuickView 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QString url READ url CONSTANT) 29 | 30 | public: 31 | explicit OpenWithDialog(const QUrl &url, QQuickView *parent = nullptr); 32 | 33 | QString url() const; 34 | 35 | private: 36 | QString m_url; 37 | }; 38 | 39 | #endif // OPENWITHDIALOG_H 40 | -------------------------------------------------------------------------------- /draganddrop/declarativedragdropevent.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2010 BetterInbox 3 | SPDX-FileContributor: Gregory Schlomoff 4 | SPDX-FileCopyrightText: 2013 Sebastian Kügler 5 | 6 | SPDX-License-Identifier: MIT 7 | */ 8 | 9 | #include "declarativedragdropevent.h" 10 | 11 | DeclarativeDragDropEvent::DeclarativeDragDropEvent(QDropEvent *e, DeclarativeDropArea *parent) 12 | : QObject(parent) 13 | , m_x(e->pos().x()) 14 | , m_y(e->pos().y()) 15 | , m_buttons(e->mouseButtons()) 16 | , m_modifiers(e->keyboardModifiers()) 17 | , m_data(nullptr) 18 | , m_event(e) 19 | { 20 | } 21 | 22 | DeclarativeDragDropEvent::DeclarativeDragDropEvent(QDragLeaveEvent *e, DeclarativeDropArea *parent) 23 | : QObject(parent) 24 | , m_x(0) 25 | , m_y(0) 26 | , m_buttons(Qt::NoButton) 27 | , m_modifiers(Qt::NoModifier) 28 | , m_data(nullptr) 29 | , m_event(nullptr) 30 | { 31 | Q_UNUSED(e); 32 | } 33 | 34 | void DeclarativeDragDropEvent::accept(int action) 35 | { 36 | m_event->setDropAction(static_cast(action)); 37 | // qDebug() << "-----> Accepting event: " << this << m_data.urls() << m_data.text() << m_data.html() << ( m_data.hasColor() ? m_data.color().name() : " 38 | // no color"); 39 | m_event->accept(); 40 | } 41 | 42 | void DeclarativeDragDropEvent::ignore() 43 | { 44 | m_event->ignore(); 45 | } 46 | 47 | DeclarativeMimeData *DeclarativeDragDropEvent::mimeData() 48 | { 49 | if (!m_data && m_event) { 50 | // TODO This should be using MimeDataWrapper eventually, although this is an API break, 51 | // so will need to be done carefully. 52 | m_data.reset(new DeclarativeMimeData(m_event->mimeData())); 53 | } 54 | return m_data.data(); 55 | } 56 | -------------------------------------------------------------------------------- /draganddrop/declarativedroparea.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2010 BetterInbox 3 | SPDX-FileContributor: Gregory Schlomoff 4 | 5 | SPDX-License-Identifier: MIT 6 | */ 7 | 8 | #ifndef DECLARATIVEDROPAREA_H 9 | #define DECLARATIVEDROPAREA_H 10 | 11 | #include 12 | 13 | class DeclarativeDragDropEvent; 14 | 15 | class DeclarativeDropArea : public QQuickItem 16 | { 17 | Q_OBJECT 18 | 19 | /** 20 | * If false the area will receive no drop events 21 | */ 22 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) 23 | 24 | /** 25 | * 26 | */ 27 | Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged) 28 | 29 | Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged) 30 | 31 | public: 32 | DeclarativeDropArea(QQuickItem *parent = nullptr); 33 | bool isEnabled() const; 34 | void setEnabled(bool enabled); 35 | 36 | bool preventStealing() const; 37 | void setPreventStealing(bool prevent); 38 | bool containsDrag() const; 39 | 40 | Q_SIGNALS: 41 | /** 42 | * Emitted when the mouse cursor dragging something enters in the drag area 43 | * @param event description of the dragged content 44 | * @see DeclarativeDragDropEvent 45 | */ 46 | void dragEnter(DeclarativeDragDropEvent *event); 47 | 48 | /** 49 | * Emitted when the mouse cursor dragging something leaves the drag area 50 | * @param event description of the dragged content 51 | * @see DeclarativeDragDropEvent 52 | */ 53 | void dragLeave(DeclarativeDragDropEvent *event); 54 | 55 | /** 56 | * Emitted when the mouse cursor dragging something moves over the drag area 57 | * @param event description of the dragged content 58 | * @see DeclarativeDragDropEvent 59 | */ 60 | void dragMove(DeclarativeDragDropEvent *event); 61 | 62 | /** 63 | * Emitted when the user drops something in the area 64 | * @param event description of the dragged content 65 | * @see DeclarativeDragDropEvent 66 | */ 67 | void drop(DeclarativeDragDropEvent *event); 68 | 69 | // Notifiers 70 | void enabledChanged(); 71 | 72 | void preventStealingChanged(); 73 | 74 | void containsDragChanged(bool contained); 75 | 76 | protected: 77 | void dragEnterEvent(QDragEnterEvent *event) override; 78 | void dragLeaveEvent(QDragLeaveEvent *event) override; 79 | void dragMoveEvent(QDragMoveEvent *event) override; 80 | void dropEvent(QDropEvent *event) override; 81 | 82 | private Q_SLOTS: 83 | void temporaryInhibitParent(bool inhibit); 84 | 85 | private: 86 | void setContainsDrag(bool dragging); 87 | 88 | bool m_enabled : 1; 89 | bool m_preventStealing : 1; 90 | bool m_temporaryInhibition : 1; 91 | bool m_containsDrag : 1; 92 | QPoint m_oldDragMovePos; 93 | }; 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /draganddrop/declarativemimedata.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2010 BetterInbox 3 | SPDX-FileContributor: Gregory Schlomoff 4 | 5 | SPDX-License-Identifier: MIT 6 | */ 7 | 8 | #ifndef DECLARATIVEMIMEDATA_H 9 | #define DECLARATIVEMIMEDATA_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | class DeclarativeMimeData : public QMimeData 18 | { 19 | Q_OBJECT 20 | 21 | /** 22 | * A plain text (MIME type text/plain) representation of the data. 23 | */ 24 | Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) 25 | 26 | /** 27 | * A string if the data stored in the object is HTML (MIME type text/html); otherwise returns an empty string. 28 | */ 29 | Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) 30 | 31 | /** 32 | * Url contained in the mimedata 33 | */ 34 | Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) 35 | 36 | /** 37 | * A list of URLs contained within the MIME data object. 38 | * URLs correspond to the MIME type text/uri-list. 39 | */ 40 | Q_PROPERTY(QJsonArray urls READ urls WRITE setUrls NOTIFY urlsChanged) 41 | 42 | /** 43 | * A color if the data stored in the object represents a color (MIME type application/x-color); otherwise QColor(). 44 | */ 45 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) 46 | 47 | /** 48 | * The graphical item on the scene that started the drag event. It may be null. 49 | */ 50 | Q_PROPERTY(QQuickItem *source READ source WRITE setSource NOTIFY sourceChanged) 51 | 52 | /** @see QMimeData::hasUrls */ 53 | Q_PROPERTY(bool hasUrls READ hasUrls NOTIFY urlsChanged) 54 | // TODO: Image property 55 | 56 | /** 57 | * @sa QMimeData::formats 58 | */ 59 | Q_PROPERTY(QStringList formats READ formats) 60 | public: 61 | DeclarativeMimeData(); 62 | DeclarativeMimeData(const QMimeData *copy); 63 | 64 | QUrl url() const; 65 | void setUrl(const QUrl &url); 66 | 67 | QJsonArray urls() const; 68 | void setUrls(const QJsonArray &urls); 69 | 70 | QColor color() const; 71 | void setColor(const QColor &color); 72 | Q_INVOKABLE bool hasColor() const; 73 | 74 | Q_INVOKABLE void setData(const QString &mimeType, const QVariant &data); 75 | 76 | QQuickItem *source() const; 77 | void setSource(QQuickItem *source); 78 | 79 | Q_INVOKABLE QByteArray getDataAsByteArray(const QString &format); 80 | 81 | /* 82 | QString text() const; //TODO: Reimplement this to issue the onChanged signals 83 | void setText(const QString &text); 84 | QString html() const; 85 | void setHtml(const QString &html); 86 | */ 87 | 88 | Q_SIGNALS: 89 | void textChanged(); // FIXME not being used 90 | void htmlChanged(); // FIXME not being used 91 | void urlChanged(); 92 | void urlsChanged(); 93 | void colorChanged(); 94 | void sourceChanged(); 95 | 96 | private: 97 | QQuickItem *m_source; 98 | }; 99 | 100 | #endif // DECLARATIVEMIMEDATA_H 101 | -------------------------------------------------------------------------------- /helper/datehelper.cpp: -------------------------------------------------------------------------------- 1 | #include "datehelper.h" 2 | #include 3 | 4 | DateHelper::DateHelper(QObject *parent) : QObject(parent) 5 | { 6 | 7 | } 8 | 9 | QString DateHelper::friendlyTime(const QDateTime &time) 10 | { 11 | QDateTime now = QDateTime::currentDateTime(); 12 | qint64 minutes = qRound64(time.secsTo(now) / 60.0f); 13 | 14 | if (minutes < 1) 15 | return tr("Now"); 16 | else if (minutes == 1) 17 | return tr("1 minute ago"); 18 | else if (minutes < 60) 19 | return tr("%1 minutes ago").arg(minutes); 20 | 21 | qint64 hours = qRound64(minutes / 60.0f); 22 | if (hours == 1) 23 | return tr("1 hour ago"); 24 | else if (hours < 24) 25 | return tr("%1 hours ago").arg(hours); 26 | 27 | qint64 days = qRound64(hours / 24.0f); 28 | if (days == 1) 29 | return tr("1 day ago"); 30 | else if (days <= 10) 31 | return tr("%1 days ago").arg(days); 32 | 33 | return time.toString(Qt::DefaultLocaleShortDate); 34 | } 35 | -------------------------------------------------------------------------------- /helper/datehelper.h: -------------------------------------------------------------------------------- 1 | #ifndef DATEHELPER_H 2 | #define DATEHELPER_H 3 | 4 | #include 5 | 6 | class DateHelper : public QObject 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit DateHelper(QObject *parent = nullptr); 12 | 13 | Q_INVOKABLE static QString friendlyTime(const QDateTime &time); 14 | }; 15 | 16 | #endif // DATEHELPER_H 17 | -------------------------------------------------------------------------------- /helper/filelauncher.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "filelauncher.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | FileLauncher *SELF = nullptr; 31 | 32 | FileLauncher *FileLauncher::self() 33 | { 34 | if (SELF == nullptr) 35 | SELF = new FileLauncher; 36 | 37 | return SELF; 38 | } 39 | 40 | FileLauncher::FileLauncher(QObject *parent) 41 | : QObject(parent) 42 | { 43 | 44 | } 45 | 46 | bool FileLauncher::launchApp(const QString &desktopFile, const QString &fileName) 47 | { 48 | QSettings settings(desktopFile, QSettings::IniFormat); 49 | settings.beginGroup("Desktop Entry"); 50 | 51 | QStringList list = settings.value("Exec").toString().split(' '); 52 | QStringList args; 53 | 54 | if (list.isEmpty() || list.size() < 0) 55 | return false; 56 | 57 | QString exec = list.first(); 58 | list.removeOne(exec); 59 | 60 | for (const QString &arg : list) { 61 | QString newArg = arg; 62 | 63 | if (newArg.startsWith("%F", Qt::CaseInsensitive)) 64 | newArg.replace("%F", fileName, Qt::CaseInsensitive); 65 | 66 | if (newArg.startsWith("%U", Qt::CaseInsensitive)) 67 | newArg.replace("%U", fileName, Qt::CaseInsensitive); 68 | 69 | args.append(newArg); 70 | } 71 | 72 | qDebug() << "launchApp()" << exec << args; 73 | 74 | return startDetached(exec, args); 75 | } 76 | 77 | bool FileLauncher::launchExecutable(const QString &fileName) 78 | { 79 | return startDetached(fileName); 80 | } 81 | 82 | bool FileLauncher::startDetached(const QString &exec, QStringList args) 83 | { 84 | QDBusInterface iface("com.cutefish.Session", 85 | "/Session", 86 | "com.cutefish.Session", QDBusConnection::sessionBus()); 87 | 88 | if (iface.isValid()) { 89 | iface.asyncCall("launch", exec, args).waitForFinished(); 90 | } else { 91 | QProcess::startDetached(exec, args); 92 | } 93 | 94 | return true; 95 | } 96 | 97 | bool FileLauncher::startDetached(const QString &exec, const QString &workingDir, QStringList args) 98 | { 99 | QDBusInterface iface("com.cutefish.Session", 100 | "/Session", 101 | "com.cutefish.Session", QDBusConnection::sessionBus()); 102 | 103 | if (iface.isValid()) { 104 | iface.asyncCall("launch", exec, workingDir, args).waitForFinished(); 105 | } 106 | 107 | return true; 108 | } 109 | -------------------------------------------------------------------------------- /helper/filelauncher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef FILELAUNCHER_H 21 | #define FILELAUNCHER_H 22 | 23 | #include 24 | 25 | class FileLauncher : public QObject 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | static FileLauncher *self(); 31 | explicit FileLauncher(QObject *parent = nullptr); 32 | 33 | Q_INVOKABLE bool launchApp(const QString &desktopFile, const QString &fileName); 34 | Q_INVOKABLE bool launchExecutable(const QString &fileName); 35 | 36 | static bool startDetached(const QString &exec, QStringList args = QStringList()); 37 | static bool startDetached(const QString &exec, const QString &workingDir, QStringList args = QStringList()); 38 | }; 39 | 40 | #endif // FILELAUNCHER_H 41 | -------------------------------------------------------------------------------- /helper/fm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "fm.h" 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | Fm::Fm(QObject *parent) : QObject(parent) 28 | { 29 | 30 | } 31 | 32 | QString Fm::rootPath() 33 | { 34 | return QDir::rootPath(); 35 | } 36 | 37 | void Fm::emptyTrash() 38 | { 39 | KIO::Job *job = KIO::emptyTrash(); 40 | job->start(); 41 | } 42 | 43 | bool Fm::isFixedFolder(const QUrl &folderUrl) 44 | { 45 | const QString folder = folderUrl.toLocalFile(); 46 | 47 | return folder == QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first() || 48 | folder == QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).first() || 49 | folder == QStandardPaths::standardLocations(QStandardPaths::MusicLocation).first() || 50 | folder == QStandardPaths::standardLocations(QStandardPaths::MoviesLocation).first() || 51 | folder == QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first() || 52 | folder == QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first() || 53 | folder == QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first(); 54 | } 55 | -------------------------------------------------------------------------------- /helper/fm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef FM_H 21 | #define FM_H 22 | 23 | #include 24 | 25 | class Fm : public QObject 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit Fm(QObject *parent = nullptr); 31 | 32 | Q_INVOKABLE QString rootPath(); 33 | Q_INVOKABLE static void emptyTrash(); 34 | static bool isFixedFolder(const QUrl &folderUrl); 35 | }; 36 | 37 | #endif // FM_H 38 | -------------------------------------------------------------------------------- /helper/keyboardsearchmanager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "keyboardsearchmanager.h" 21 | 22 | KeyboardSearchManager *KEYBORDSRARCH_MANAGER_SELF = nullptr; 23 | 24 | KeyboardSearchManager *KeyboardSearchManager::self() 25 | { 26 | if (!KEYBORDSRARCH_MANAGER_SELF) 27 | KEYBORDSRARCH_MANAGER_SELF = new KeyboardSearchManager; 28 | 29 | return KEYBORDSRARCH_MANAGER_SELF; 30 | } 31 | 32 | KeyboardSearchManager::KeyboardSearchManager(QObject *parent) 33 | : QObject(parent) 34 | , m_timeout(500) 35 | { 36 | // m_timer.setInterval(m_timeout); 37 | // connect(&m_timer, &QTimer::timeout, this, [=] { 38 | // m_searchText.clear(); 39 | // }); 40 | } 41 | 42 | void KeyboardSearchManager::addKeys(const QString &keys) 43 | { 44 | if (!keys.isEmpty()) { 45 | // m_timer.stop(); 46 | // m_searchText.append(keys); 47 | 48 | // const QChar firstKey = m_searchText.length() > 0 ? m_searchText.at(0) : QChar(); 49 | // const bool sameKey = m_searchText.length() > 1 && m_searchText.count(firstKey) == m_searchText.length(); 50 | 51 | // emit searchTextChanged(sameKey ? firstKey : m_searchText, false); 52 | emit searchTextChanged(keys, false); 53 | 54 | // m_timer.start(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /helper/keyboardsearchmanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | 21 | #ifndef KEYBOARDSEARCHMANAGER_H 22 | #define KEYBOARDSEARCHMANAGER_H 23 | 24 | #include 25 | #include 26 | 27 | class KeyboardSearchManager : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | static KeyboardSearchManager *self(); 33 | explicit KeyboardSearchManager(QObject *parent = nullptr); 34 | 35 | void addKeys(const QString &keys); 36 | 37 | signals: 38 | void searchTextChanged(const QString &string, bool searchFromNextItem); 39 | 40 | private: 41 | QString m_searchText; 42 | qint64 m_timeout; 43 | // QTimer m_timer; 44 | }; 45 | 46 | #endif // KEYBOARDSEARCHMANAGER_H 47 | -------------------------------------------------------------------------------- /helper/pathhistory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "pathhistory.h" 21 | #include 22 | 23 | PathHistory::PathHistory(QObject *parent) 24 | : QObject(parent) 25 | { 26 | 27 | } 28 | 29 | void PathHistory::append(const QUrl &path) 30 | { 31 | m_prevHistory.append(path); 32 | } 33 | 34 | QUrl PathHistory::first() 35 | { 36 | return m_prevHistory.first(); 37 | } 38 | 39 | QUrl PathHistory::last() 40 | { 41 | return m_prevHistory.last(); 42 | } 43 | 44 | QUrl PathHistory::at(int i) 45 | { 46 | return m_prevHistory.at(i); 47 | } 48 | 49 | int PathHistory::count() 50 | { 51 | return m_prevHistory.count(); 52 | } 53 | 54 | bool PathHistory::isEmpty() 55 | { 56 | return m_prevHistory.isEmpty(); 57 | } 58 | 59 | QUrl PathHistory::posteriorPath() 60 | { 61 | if (m_postHistory.isEmpty()) 62 | return QUrl(); 63 | 64 | return m_postHistory.takeLast(); 65 | } 66 | 67 | QUrl PathHistory::previousPath() 68 | { 69 | if (m_prevHistory.isEmpty()) 70 | return QUrl(); 71 | 72 | if (m_prevHistory.length() < 2) 73 | return m_prevHistory.at(0); 74 | 75 | m_postHistory.append(m_prevHistory.takeLast()); 76 | return m_prevHistory.takeLast(); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /helper/pathhistory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef PATHHISTORY_H 21 | #define PATHHISTORY_H 22 | 23 | #include 24 | #include 25 | 26 | class PathHistory : public QObject 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit PathHistory(QObject *parent = nullptr); 32 | 33 | void append(const QUrl &path); 34 | 35 | QUrl first(); 36 | QUrl last(); 37 | 38 | QUrl at(int i); 39 | int count(); 40 | 41 | bool isEmpty(); 42 | 43 | QUrl posteriorPath(); 44 | QUrl previousPath(); 45 | 46 | private: 47 | QVector m_prevHistory; 48 | QVector m_postHistory; 49 | }; 50 | 51 | #endif // PATHHISTORY_H 52 | -------------------------------------------------------------------------------- /helper/shortcut.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright 2021 Reion Wong * 3 | * Copyright Ken * 4 | * Copyright 2016 Leslie Zhai * 5 | * * 6 | * This program is free software; you can redistribute it and/or modify * 7 | * it under the terms of the GNU General Public License as published by * 8 | * the Free Software Foundation; either version 2 of the License, or * 9 | * (at your option) any later version. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program; if not, write to the * 18 | * Free Software Foundation, Inc., * 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 20 | ***************************************************************************/ 21 | 22 | #ifndef SHORTCUT_H 23 | #define SHORTCUT_H 24 | 25 | #include 26 | 27 | class ShortCut : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit ShortCut(QObject *parent = nullptr); 33 | 34 | Q_INVOKABLE void install(QObject *target = nullptr); 35 | 36 | signals: 37 | void open(); 38 | void copy(); 39 | void cut(); 40 | void paste(); 41 | void rename(); 42 | void refresh(); 43 | void openPathEditor(); 44 | void selectAll(); 45 | void backspace(); 46 | void deleteFile(); 47 | void showHidden(); 48 | void keyPressed(const QString &text); 49 | void close(); 50 | void undo(); 51 | 52 | protected: 53 | bool eventFilter(QObject *obj, QEvent *e) override; 54 | 55 | private: 56 | QObject *m_object; 57 | }; 58 | 59 | #endif // SHORTCUT_H 60 | -------------------------------------------------------------------------------- /images/dark/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 51 | 58 | 66 | 67 | -------------------------------------------------------------------------------- /images/dark/checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 53 | 57 | 58 | -------------------------------------------------------------------------------- /images/dark/date.svg: -------------------------------------------------------------------------------- 1 | 2 | image/svg+xml 44 | 45 | 51 | 54 | 58 | 59 | 62 | 65 | 69 | 70 | 71 | 73 | 74 | 76 | 77 | 79 | 80 | 82 | 83 | 85 | 86 | 88 | 89 | 91 | 92 | 94 | 95 | 97 | 98 | 100 | 101 | 103 | 104 | 106 | 107 | 109 | 110 | 112 | 113 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /images/dark/drive-harddisk-root.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 50 | 52 | 55 | 56 | 62 | 66 | 72 | 78 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /images/dark/drive-harddisk.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 50 | 52 | 55 | 56 | 62 | 66 | 72 | 78 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /images/dark/drive-removable-media-usb.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 52 | 57 | 61 | 65 | 74 | 83 | 84 | 88 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /images/dark/folder-desktop.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 48 | 50 | 53 | 54 | 61 | 62 | -------------------------------------------------------------------------------- /images/dark/folder-download.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 48 | 50 | 53 | 54 | 60 | 61 | -------------------------------------------------------------------------------- /images/dark/folder-home.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 48 | 50 | 53 | 54 | 60 | 61 | -------------------------------------------------------------------------------- /images/dark/folder-music.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 47 | 49 | 52 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /images/dark/folder-picture.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 47 | 49 | 52 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /images/dark/folder-video.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 47 | 49 | 52 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /images/dark/go-next.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /images/dark/go-previous.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /images/dark/grid.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /images/dark/list.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /images/dark/order_by_name.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 39 | 41 | 42 | 44 | image/svg+xml 45 | 47 | 48 | 49 | 50 | 51 | 55 | 60 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /images/dark/up.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 47 | 49 | 56 | 57 | 62 | 63 | -------------------------------------------------------------------------------- /images/dark/user-trash.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 47 | 49 | 52 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /images/drive-harddisk-root.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /images/drive-harddisk.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /images/drive-optical.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /images/drive-removable-media-usb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /images/folder-desktop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/folder-document.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /images/folder-download.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/folder-home.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/folder-music.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/folder-picture.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/folder-video.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/light/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 51 | 58 | 66 | 67 | -------------------------------------------------------------------------------- /images/light/checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 53 | 57 | 58 | -------------------------------------------------------------------------------- /images/light/date.svg: -------------------------------------------------------------------------------- 1 | 2 | image/svg+xml 44 | 45 | 50 | 53 | 57 | 58 | 60 | 62 | 65 | 66 | 67 | 69 | 70 | 72 | 73 | 75 | 76 | 78 | 79 | 81 | 82 | 84 | 85 | 87 | 88 | 90 | 91 | 93 | 94 | 96 | 97 | 99 | 100 | 102 | 103 | 105 | 106 | 108 | 109 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /images/light/drive-harddisk-root.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 49 | 51 | 54 | 55 | 60 | 63 | 68 | 73 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /images/light/drive-harddisk.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 49 | 51 | 54 | 55 | 60 | 63 | 68 | 73 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /images/light/drive-removable-media-usb.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 51 | 55 | 58 | 61 | 69 | 77 | 78 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /images/light/folder-desktop.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 48 | 50 | 53 | 54 | 61 | 62 | -------------------------------------------------------------------------------- /images/light/folder-download.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 48 | 50 | 53 | 54 | 60 | 61 | -------------------------------------------------------------------------------- /images/light/folder-home.svg: -------------------------------------------------------------------------------- 1 | 2 | 16 | 18 | 19 | 21 | image/svg+xml 22 | 24 | 25 | 26 | 27 | 28 | 48 | 50 | 53 | 54 | 60 | 61 | -------------------------------------------------------------------------------- /images/light/folder-music.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /images/light/folder-picture.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /images/light/folder-video.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /images/light/go-next.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /images/light/go-previous.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /images/light/grid.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /images/light/list.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /images/light/order_by_name.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 39 | 41 | 42 | 44 | image/svg+xml 45 | 47 | 48 | 49 | 50 | 51 | 55 | 60 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /images/light/up.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 46 | 48 | 55 | 56 | 61 | 62 | -------------------------------------------------------------------------------- /images/light/user-trash.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /images/media-optical-data.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | 9 | 11 | 12 | -------------------------------------------------------------------------------- /images/media-optical-mixed-cd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /images/media-optical.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /images/user-trash.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "application.h" 21 | #include "model/placesmodel.h" 22 | #include "model/foldermodel.h" 23 | #include "model/pathbarmodel.h" 24 | #include "model/positioner.h" 25 | #include "widgets/rubberband.h" 26 | #include "widgets/itemviewadapter.h" 27 | #include "desktop/desktop.h" 28 | #include "desktop/desktopsettings.h" 29 | #include "desktop/desktopview.h" 30 | #include "helper/datehelper.h" 31 | #include "helper/fm.h" 32 | #include "helper/shortcut.h" 33 | 34 | #include "draganddrop/declarativedragdropevent.h" 35 | #include "draganddrop/declarativedroparea.h" 36 | #include "draganddrop/declarativemimedata.h" 37 | 38 | #include 39 | 40 | int main(int argc, char *argv[]) 41 | { 42 | QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); 43 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); 44 | 45 | // Register QML Type. 46 | const char *uri = "Cutefish.FileManager"; 47 | const char *dragandrop_uri = "Cutefish.DragDrop"; 48 | 49 | qmlRegisterType(uri, 1, 0, "PlacesModel"); 50 | qmlRegisterType(uri, 1, 0, "FolderModel"); 51 | qmlRegisterType(uri, 1, 0, "PathBarModel"); 52 | qmlRegisterType(uri, 1, 0, "Positioner"); 53 | qmlRegisterType(uri, 1, 0, "RubberBand"); 54 | qmlRegisterType(uri, 1, 0, "ItemViewAdapter"); 55 | qmlRegisterType(uri, 1, 0, "DesktopSettings"); 56 | qmlRegisterType(uri, 1, 0, "Fm"); 57 | qmlRegisterType(uri, 1, 0, "ShortCut"); 58 | 59 | #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 60 | qmlRegisterType(); 61 | qmlRegisterType(); 62 | #else 63 | qmlRegisterAnonymousType(uri, 1); 64 | qmlRegisterAnonymousType(dragandrop_uri, 1); 65 | #endif 66 | 67 | qmlRegisterType(dragandrop_uri, 1, 0, "DropArea"); 68 | qmlRegisterUncreatableType(dragandrop_uri, 1, 0, "MimeData", QStringLiteral("MimeData cannot be created from QML.")); 69 | qmlRegisterUncreatableType(dragandrop_uri, 2, 0, "DragDropEvent", QStringLiteral("DragDropEvent cannot be created from QML.")); 70 | 71 | Application app(argc, argv); 72 | return app.run(); 73 | } 74 | -------------------------------------------------------------------------------- /mimetype/mimeappmanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef MIMEAPPMANAGER_H 21 | #define MIMEAPPMANAGER_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "xdgdesktopfile.h" 30 | 31 | class QMimeType; 32 | class MimeAppManager : public QObject 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | static MimeAppManager *self(); 38 | explicit MimeAppManager(QObject *parent = nullptr); 39 | 40 | QStringList desktopPaths(); 41 | QString mimeAppsListFilePath(); 42 | void initApplications(); 43 | 44 | QString getDefaultAppByFilePath(const QString &filePath); 45 | QString getDefaultAppByMimeType(const QMimeType &mimeType); 46 | QString getDefaultAppDesktopByMimeType(const QString &mimeType); 47 | Q_INVOKABLE bool setDefaultAppForType(const QString &mimeType, const QString &app); 48 | Q_INVOKABLE bool setDefaultAppForFile(const QString &filePath, const QString &desktop); 49 | 50 | QStringList getRecommendedAppsByFilePath(const QString &filePath); 51 | QStringList getRecommendedAppsByMimeType(const QMimeType &mimeType); 52 | 53 | Q_INVOKABLE QVariantList recommendedApps(const QUrl &url); 54 | 55 | Q_INVOKABLE void launchTerminal(const QString &path); 56 | 57 | private slots: 58 | void onFileChanged(const QString &path); 59 | 60 | private: 61 | QStringList m_desktopFiles; 62 | QMap m_mimeApps; 63 | 64 | QMap m_videoMimeApps; 65 | QMap m_imageMimeApps; 66 | QMap m_textMimeApps; 67 | QMap m_audioMimeApps; 68 | QMap m_desktopObjects; 69 | 70 | QList m_terminalApps; 71 | 72 | QFileSystemWatcher *m_fileSystemWatcher; 73 | QTimer *m_updateTimer; 74 | }; 75 | 76 | #endif // MIMEAPPMANAGER_H 77 | -------------------------------------------------------------------------------- /mimetype/xdgdesktopfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef XDGDESKTOPFILE_H 21 | #define XDGDESKTOPFILE_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | class XdgDesktopFile 28 | { 29 | public: 30 | explicit XdgDesktopFile(const QString &fileName = QString()); 31 | 32 | bool valid() const; 33 | 34 | QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; 35 | void setValue(const QString &key, const QVariant &value); 36 | 37 | bool load(); 38 | bool save(); 39 | 40 | QStringList keys() const; 41 | 42 | QString localeName() const; 43 | QString prefix() const; 44 | 45 | QString fileName() const; 46 | 47 | private: 48 | bool read(const QString &prefix); 49 | 50 | private: 51 | bool m_isValid; 52 | QString m_fileName; 53 | QMap m_items; 54 | }; 55 | 56 | #endif // XDGDESKTOPFILE_H 57 | -------------------------------------------------------------------------------- /model/dirlister.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "dirlister.h" 21 | 22 | DirLister::DirLister(QObject *parent) 23 | : KDirLister(parent) 24 | { 25 | } 26 | 27 | DirLister::~DirLister() 28 | { 29 | } 30 | 31 | void DirLister::handleError(KIO::Job *job) 32 | { 33 | if (!autoErrorHandlingEnabled()) { 34 | emit error(job->errorString()); 35 | return; 36 | } 37 | 38 | KDirLister::handleError(job); 39 | } 40 | -------------------------------------------------------------------------------- /model/dirlister.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef DIRLISTER_H 21 | #define DIRLISTER_H 22 | 23 | #include 24 | #include 25 | 26 | class DirLister : public KDirLister 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DirLister(QObject *parent = nullptr); 32 | ~DirLister() override; 33 | 34 | Q_SIGNALS: 35 | void error(const QString &string); 36 | 37 | protected: 38 | void handleError(KIO::Job *job) override; 39 | }; 40 | 41 | #endif // DIRLISTER_H 42 | -------------------------------------------------------------------------------- /model/pathbarmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef PATHBARMODEL_H 21 | #define PATHBARMODEL_H 22 | 23 | #include 24 | #include 25 | 26 | struct PathBarItem { 27 | QString name; 28 | QUrl url; 29 | }; 30 | 31 | class PathBarModel : public QAbstractItemModel 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) 35 | 36 | public: 37 | enum DataRole { 38 | NameRole = Qt::UserRole + 1, 39 | UrlRole, 40 | PathRole 41 | }; 42 | Q_ENUMS(DataRole); 43 | 44 | explicit PathBarModel(QObject *parent = nullptr); 45 | ~PathBarModel(); 46 | 47 | QString url() const; 48 | void setUrl(const QString &url); 49 | 50 | QHash roleNames() const override; 51 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 52 | int columnCount(const QModelIndex &parent = QModelIndex()) const override; 53 | 54 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 55 | 56 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; 57 | QModelIndex parent(const QModelIndex &child) const override; 58 | 59 | signals: 60 | void urlChanged(); 61 | 62 | private: 63 | QString m_url; 64 | QList m_pathList; 65 | }; 66 | 67 | #endif // PATHBARMODEL_H 68 | -------------------------------------------------------------------------------- /model/placesitem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef PLACESITEM_H 21 | #define PLACESITEM_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | class PlacesItem : public QObject 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit PlacesItem(const QString &displayName = QString(), 36 | QUrl url = QUrl(), 37 | QObject *parent = nullptr); 38 | 39 | QString displayName() const; 40 | void setDisplayName(const QString &name); 41 | 42 | QString iconName() const; 43 | void setIconName(const QString &name); 44 | 45 | QString iconPath() const; 46 | void setIconPath(const QString &path); 47 | 48 | QUrl url() const; 49 | void setUrl(const QUrl &url); 50 | 51 | QString path() const; 52 | 53 | QString udi() const; 54 | void setUdi(const QString &udi); 55 | 56 | bool isDevice(); 57 | bool setupNeeded(); 58 | 59 | QString category() const; 60 | void setCategory(const QString &category); 61 | 62 | bool isOpticalDisc() const; 63 | 64 | signals: 65 | void itemChanged(PlacesItem *); 66 | 67 | private slots: 68 | void updateDeviceInfo(const QString &udi); 69 | void onAccessibilityChanged(bool isAccessible); 70 | 71 | private: 72 | QString m_displayName; 73 | QString m_iconName; 74 | QString m_iconPath; 75 | QString m_udi; 76 | QUrl m_url; 77 | QString m_category; 78 | 79 | bool m_isOpticalDisc; 80 | bool m_isAccessible; 81 | 82 | Solid::Device m_device; 83 | QPointer m_access; 84 | }; 85 | 86 | #endif // PLACESITEM_H 87 | -------------------------------------------------------------------------------- /model/placesmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef PLACESMODEL_H 21 | #define PLACESMODEL_H 22 | 23 | #include 24 | #include 25 | #include "placesitem.h" 26 | 27 | class PlacesModel : public QAbstractItemModel 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | enum DataRole { 33 | NameRole = Qt::UserRole + 1, 34 | IconNameRole, 35 | IconPathRole, 36 | UrlRole, 37 | PathRole, 38 | IsDeviceRole, 39 | IsOpticalDisc, 40 | setupNeededRole, 41 | CategoryRole 42 | }; 43 | Q_ENUMS(DataRole); 44 | 45 | explicit PlacesModel(QObject *parent = nullptr); 46 | ~PlacesModel() override; 47 | 48 | QHash roleNames() const override; 49 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 50 | int columnCount(const QModelIndex &parent = QModelIndex()) const override; 51 | 52 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 53 | 54 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; 55 | QModelIndex parent(const QModelIndex &child) const override; 56 | 57 | Q_INVOKABLE QVariantMap get(const int &index) const; 58 | Q_INVOKABLE void requestSetup(const int &index); 59 | Q_INVOKABLE void requestEject(const int &index); 60 | Q_INVOKABLE void requestTeardown(const int &index); 61 | 62 | signals: 63 | void deviceSetupDone(const QString &filePath); 64 | 65 | private slots: 66 | void onDeviceAdded(const QString &udi); 67 | void onDeviceRemoved(const QString &udi); 68 | void onItemChanged(PlacesItem *); 69 | 70 | private: 71 | QList m_items; 72 | Solid::Predicate m_predicate; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /qml/Controls/IconButton.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | import QtQuick 2.12 21 | import FishUI 1.0 as FishUI 22 | 23 | Item { 24 | id: control 25 | width: 24 26 | height: 24 27 | 28 | property alias source: _image.source 29 | property color backgroundColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.secondBackgroundColor, 1.3) 30 | : FishUI.Theme.secondBackgroundColor 31 | property color hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.secondBackgroundColor, 1.7) 32 | : Qt.darker(FishUI.Theme.secondBackgroundColor, 1.2) 33 | property color pressedColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.secondBackgroundColor, 1.4) 34 | : Qt.darker(FishUI.Theme.secondBackgroundColor, 1.3) 35 | 36 | signal clicked() 37 | 38 | Rectangle { 39 | id: _background 40 | anchors.fill: parent 41 | radius: FishUI.Theme.smallRadius 42 | color: _mouseArea.pressed ? pressedColor : _mouseArea.containsMouse ? control.hoveredColor : control.backgroundColor 43 | } 44 | 45 | Image { 46 | id: _image 47 | anchors.centerIn: parent 48 | width: 18 49 | height: width 50 | sourceSize: Qt.size(width, height) 51 | smooth: false 52 | antialiasing: true 53 | } 54 | 55 | MouseArea { 56 | id: _mouseArea 57 | anchors.fill: parent 58 | hoverEnabled: true 59 | acceptedButtons: Qt.LeftButton 60 | onClicked: control.clicked() 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /qml/Desktop/Wallpaper.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.12 2 | import QtQuick.Controls 2.12 3 | import QtQuick.Layouts 1.12 4 | import QtQuick.Window 2.12 5 | import QtGraphicalEffects 1.0 6 | 7 | import Cutefish.FileManager 1.0 as FM 8 | import FishUI 1.0 as FishUI 9 | 10 | Item { 11 | id: control 12 | 13 | FM.DesktopSettings { 14 | id: settings 15 | } 16 | 17 | Loader { 18 | id: backgroundLoader 19 | anchors.fill: parent 20 | anchors.margins: 0 21 | sourceComponent: settings.backgroundType === 0 ? wallpaper : background 22 | } 23 | 24 | Component { 25 | id: background 26 | 27 | Rectangle { 28 | anchors.fill: parent 29 | visible: settings.backgroundVisible 30 | color: settings.backgroundColor 31 | } 32 | } 33 | 34 | Component { 35 | id: wallpaper 36 | 37 | Image { 38 | source: "file://" + settings.wallpaper 39 | sourceSize: Qt.size(width * Screen.devicePixelRatio, 40 | height * Screen.devicePixelRatio) 41 | fillMode: Image.PreserveAspectCrop 42 | clip: true 43 | visible: settings.backgroundVisible 44 | cache: false 45 | 46 | // Clear cache 47 | onSourceChanged: dirModel.clearPixmapCache() 48 | 49 | ColorOverlay { 50 | id: dimsWallpaper 51 | anchors.fill: parent 52 | source: parent 53 | color: "#000000" 54 | opacity: FishUI.Theme.darkMode && settings.dimsWallpaper ? 0.4 : 0.0 55 | 56 | Behavior on opacity { 57 | NumberAnimation { 58 | duration: 200 59 | } 60 | } 61 | 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /qml/Dialogs/CreateFolderDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | import QtQuick 2.12 20 | import QtQuick.Controls 2.12 21 | import QtQuick.Window 2.12 22 | import QtQuick.Layouts 1.12 23 | import FishUI 1.0 as FishUI 24 | 25 | Window { 26 | id: control 27 | 28 | title: qsTr("New folder name") 29 | flags: Qt.Dialog 30 | visible: true 31 | 32 | width: 400 + FishUI.Units.largeSpacing * 2 33 | height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 34 | 35 | minimumWidth: width 36 | minimumHeight: height 37 | maximumWidth: width 38 | maximumHeight: height 39 | 40 | Rectangle { 41 | anchors.fill: parent 42 | color: FishUI.Theme.secondBackgroundColor 43 | } 44 | 45 | ColumnLayout { 46 | id: _mainLayout 47 | anchors.fill: parent 48 | anchors.margins: FishUI.Units.largeSpacing 49 | spacing: FishUI.Units.largeSpacing 50 | 51 | FishUI.ActionTextField { 52 | id: _textField 53 | Layout.fillWidth: true 54 | Keys.onEscapePressed: control.close() 55 | text: qsTr("New folder") 56 | focus: true 57 | 58 | onAccepted: { 59 | main.newFolder(_textField.text) 60 | control.close() 61 | } 62 | 63 | Component.onCompleted: { 64 | _textField.selectAll() 65 | } 66 | 67 | rightActions: [ 68 | Action { 69 | icon.source: "image://icontheme/edit-clear" 70 | onTriggered: { 71 | _textField.text = "" 72 | } 73 | } 74 | ] 75 | } 76 | 77 | RowLayout { 78 | spacing: FishUI.Units.largeSpacing 79 | 80 | Button { 81 | text: qsTr("Cancel") 82 | Layout.fillWidth: true 83 | onClicked: control.close() 84 | } 85 | 86 | Button { 87 | text: qsTr("OK") 88 | Layout.fillWidth: true 89 | onClicked: { 90 | main.newFolder(_textField.text) 91 | control.close() 92 | } 93 | enabled: _textField.text 94 | flat: true 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /qml/Dialogs/DeleteDialog.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | import QtQuick 2.12 21 | import QtQuick.Controls 2.12 22 | import QtQuick.Window 2.12 23 | import QtQuick.Layouts 1.12 24 | import FishUI 1.0 as FishUI 25 | import Cutefish.FileManager 1.0 26 | 27 | FishUI.Window { 28 | id: control 29 | 30 | flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint 31 | minimizeButtonVisible: false 32 | visible: true 33 | 34 | width: contentWidth 35 | height: contentHeight 36 | 37 | minimumWidth: contentWidth 38 | minimumHeight: contentHeight 39 | maximumWidth: contentWidth 40 | maximumHeight: contentHeight 41 | 42 | property var contentWidth: _mainLayout.implicitWidth + FishUI.Units.largeSpacing * 2 43 | property var contentHeight: _mainLayout.implicitHeight + control.header.height + FishUI.Units.largeSpacing * 2 44 | 45 | background.color: FishUI.Theme.secondBackgroundColor 46 | 47 | ColumnLayout { 48 | id: _mainLayout 49 | anchors.fill: parent 50 | anchors.leftMargin: FishUI.Units.largeSpacing 51 | anchors.rightMargin: FishUI.Units.largeSpacing 52 | anchors.bottomMargin: FishUI.Units.smallSpacing 53 | spacing: FishUI.Units.largeSpacing 54 | 55 | Label { 56 | text: qsTr("Do you want to delete it permanently?") 57 | Layout.fillWidth: true 58 | wrapMode: Text.Wrap 59 | } 60 | 61 | RowLayout { 62 | spacing: FishUI.Units.largeSpacing 63 | 64 | Button { 65 | text: qsTr("Cancel") 66 | Layout.fillWidth: true 67 | onClicked: control.close() 68 | } 69 | 70 | Button { 71 | text: qsTr("Delete") 72 | focus: true 73 | Layout.fillWidth: true 74 | onClicked: { 75 | control.close() 76 | model.deleteSelected() 77 | } 78 | flat: true 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /qml/GlobalSettings.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | import QtQuick 2.12 21 | import Qt.labs.settings 1.0 22 | 23 | Settings { 24 | property int viewMethod: 1 // controls display mode: list or grid 25 | 26 | // Port to C++ 27 | // property bool showHiddenFiles: false 28 | 29 | // Name, Date, Size 30 | property int orderBy: 0 31 | property int sortMode: 0 32 | 33 | // UI 34 | property int width: 900 35 | property int height: 580 36 | property int desktopIconSize: 72 37 | property int maximumIconSize: 256 38 | property int minimumIconSize: 64 39 | 40 | property int gridIconSize: 64 41 | } 42 | -------------------------------------------------------------------------------- /screenshots/Screenshot_20211025_151224.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cutefishos/filemanager/821a05d067396973383df635328d8d8a589adfaa/screenshots/Screenshot_20211025_151224.png -------------------------------------------------------------------------------- /templates/TextFile.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /thumbnailer/thumbnailcache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef THUMBNAILCACHE_H 21 | #define THUMBNAILCACHE_H 22 | 23 | #include 24 | 25 | class QImageReader; 26 | class ThumbnailCache : public QObject 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | static ThumbnailCache *self(); 32 | explicit ThumbnailCache(QObject *parent = nullptr); 33 | 34 | QString requestThumbnail(const QString &filePath, const QSize &requestedSize); 35 | QString generateThumbnail(const QString &source, const QString &target, const QSize &requestedSize); 36 | QString writeCacheFile(const QString &path, const QImage &image); 37 | 38 | private: 39 | // thumbnail cache folder 40 | QString m_thumbnailsDir; 41 | }; 42 | 43 | #endif // THUMBNAILCACHE_H 44 | -------------------------------------------------------------------------------- /thumbnailer/thumbnailprovider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "thumbnailprovider.h" 21 | #include "thumbnailcache.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | QImage ThumbnailProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) 28 | { 29 | if (!requestedSize.isValid()) { 30 | return QImage(); 31 | } 32 | 33 | if (size) 34 | *size = requestedSize; 35 | 36 | QString f = id; 37 | QString thumbnail = ThumbnailCache::self()->requestThumbnail(id, requestedSize); 38 | 39 | if (!thumbnail.isEmpty()) { 40 | return QImage(thumbnail); 41 | } 42 | 43 | return QImage(); 44 | } 45 | -------------------------------------------------------------------------------- /thumbnailer/thumbnailprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef THUMBNAILPROVIDER_H 21 | #define THUMBNAILPROVIDER_H 22 | 23 | #include 24 | 25 | class ThumbnailProvider : public QQuickImageProvider 26 | { 27 | public: 28 | ThumbnailProvider() 29 | : QQuickImageProvider(QQuickImageProvider::Image) 30 | { 31 | } 32 | 33 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); 34 | }; 35 | 36 | #endif // THUMBNAILPROVIDER_H 37 | -------------------------------------------------------------------------------- /widgets/itemviewadapter.cpp: -------------------------------------------------------------------------------- 1 | #include "itemviewadapter.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | ItemViewAdapter::ItemViewAdapter(QObject *parent) 8 | : QObject(parent) 9 | , m_adapterView(nullptr) 10 | , m_adapterModel(nullptr) 11 | , m_adapterIconSize(-1) 12 | { 13 | } 14 | 15 | QAbstractItemModel *ItemViewAdapter::model() const 16 | { 17 | return m_adapterModel; 18 | } 19 | 20 | QSize ItemViewAdapter::iconSize() const 21 | { 22 | return QSize(m_adapterIconSize, m_adapterIconSize); 23 | } 24 | 25 | QPalette ItemViewAdapter::palette() const 26 | { 27 | return QPalette(); 28 | } 29 | 30 | QRect ItemViewAdapter::visibleArea() const 31 | { 32 | return m_adapterVisibleArea; 33 | } 34 | 35 | QRect ItemViewAdapter::visualRect(const QModelIndex &index) const 36 | { 37 | // FIXME TODO: Implemented on DND branch. 38 | 39 | Q_UNUSED(index); 40 | 41 | return QRect(); 42 | } 43 | 44 | void ItemViewAdapter::connect(Signal signal, QObject *receiver, const char *slot) 45 | { 46 | if (signal == ScrollBarValueChanged) { 47 | QObject::connect(this, SIGNAL(viewScrolled()), receiver, slot); 48 | } else if (signal == IconSizeChanged) { 49 | QObject::connect(this, SIGNAL(adapterIconSizeChanged()), receiver, slot); 50 | } 51 | } 52 | 53 | QAbstractItemModel *ItemViewAdapter::adapterModel() const 54 | { 55 | return m_adapterModel; 56 | } 57 | 58 | QObject *ItemViewAdapter::adapterView() const 59 | { 60 | return m_adapterView; 61 | } 62 | 63 | void ItemViewAdapter::setAdapterView(QObject *view) 64 | { 65 | if (m_adapterView != view) { 66 | m_adapterView = view; 67 | 68 | emit adapterViewChanged(); 69 | } 70 | } 71 | 72 | void ItemViewAdapter::setAdapterModel(QAbstractItemModel *model) 73 | { 74 | if (m_adapterModel != model) { 75 | m_adapterModel = model; 76 | 77 | emit adapterModelChanged(); 78 | } 79 | } 80 | 81 | int ItemViewAdapter::adapterIconSize() const 82 | { 83 | return m_adapterIconSize; 84 | } 85 | 86 | void ItemViewAdapter::setAdapterIconSize(int size) 87 | { 88 | if (m_adapterIconSize != size) { 89 | m_adapterIconSize = size; 90 | 91 | emit adapterIconSizeChanged(); 92 | } 93 | } 94 | 95 | QRect ItemViewAdapter::adapterVisibleArea() const 96 | { 97 | return m_adapterVisibleArea; 98 | } 99 | 100 | void ItemViewAdapter::setAdapterVisibleArea(QRect rect) 101 | { 102 | if (m_adapterVisibleArea != rect) { 103 | m_adapterVisibleArea = rect; 104 | 105 | emit adapterVisibleAreaChanged(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /widgets/itemviewadapter.h: -------------------------------------------------------------------------------- 1 | #ifndef ITEMVIEWADAPTER_H 2 | #define ITEMVIEWADAPTER_H 3 | 4 | #include 5 | #include 6 | 7 | class ItemViewAdapter : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | Q_PROPERTY(QObject *adapterView READ adapterView WRITE setAdapterView NOTIFY adapterViewChanged) 12 | Q_PROPERTY(QAbstractItemModel *adapterModel READ adapterModel WRITE setAdapterModel NOTIFY adapterModelChanged) 13 | Q_PROPERTY(int adapterIconSize READ adapterIconSize WRITE setAdapterIconSize NOTIFY adapterIconSizeChanged) 14 | Q_PROPERTY(QRect adapterVisibleArea READ adapterVisibleArea WRITE setAdapterVisibleArea NOTIFY adapterVisibleAreaChanged) 15 | 16 | public: 17 | enum Signal { ScrollBarValueChanged, IconSizeChanged }; 18 | 19 | explicit ItemViewAdapter(QObject *parent = nullptr); 20 | 21 | QAbstractItemModel *model() const; 22 | QSize iconSize() const; 23 | QPalette palette() const; 24 | QRect visibleArea() const; 25 | QRect visualRect(const QModelIndex &index) const; 26 | void connect(Signal signal, QObject *receiver, const char *slot); 27 | 28 | QObject *adapterView() const; 29 | void setAdapterView(QObject *view); 30 | 31 | QAbstractItemModel *adapterModel() const; 32 | void setAdapterModel(QAbstractItemModel *model); 33 | 34 | int adapterIconSize() const; 35 | void setAdapterIconSize(int size); 36 | 37 | QRect adapterVisibleArea() const; 38 | void setAdapterVisibleArea(QRect rect); 39 | 40 | Q_SIGNALS: 41 | void viewScrolled() const; 42 | void adapterViewChanged() const; 43 | void adapterModelChanged() const; 44 | void adapterIconSizeChanged() const; 45 | void adapterVisibleAreaChanged() const; 46 | 47 | private: 48 | QObject *m_adapterView; 49 | QAbstractItemModel *m_adapterModel; 50 | int m_adapterIconSize; 51 | QRect m_adapterVisibleArea; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /widgets/rubberband.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "rubberband.h" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | RubberBand::RubberBand(QQuickItem *parent) 27 | : QQuickPaintedItem(parent) 28 | { 29 | } 30 | 31 | RubberBand::~RubberBand() 32 | { 33 | } 34 | 35 | void RubberBand::paint(QPainter *painter) 36 | { 37 | if (!qApp) { 38 | return; 39 | } 40 | 41 | QPalette palette; 42 | palette.setColor(QPalette::Highlight, m_color); 43 | 44 | QStyleOptionRubberBand opt; 45 | opt.state = QStyle::State_None; 46 | opt.direction = qApp->layoutDirection(); 47 | opt.styleObject = this; 48 | opt.palette = palette; 49 | opt.shape = QRubberBand::Rectangle; 50 | opt.opaque = false; 51 | opt.rect = contentsBoundingRect().toRect(); 52 | qApp->style()->drawControl(QStyle::CE_RubberBand, &opt, painter); 53 | } 54 | 55 | bool RubberBand::intersects(const QRectF &rect) const 56 | { 57 | return m_geometry.intersects(rect); 58 | } 59 | 60 | QColor RubberBand::color() const 61 | { 62 | return m_color; 63 | } 64 | 65 | void RubberBand::setColor(QColor color) 66 | { 67 | if (m_color != color) { 68 | m_color = color; 69 | update(); 70 | emit colorChanged(); 71 | } 72 | } 73 | 74 | void RubberBand::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) 75 | { 76 | Q_UNUSED(oldGeometry); 77 | 78 | m_geometry = newGeometry; 79 | 80 | update(); 81 | 82 | QQuickItem::geometryChanged(newGeometry, oldGeometry); 83 | } 84 | -------------------------------------------------------------------------------- /widgets/rubberband.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: revenmartin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef RUBBERBAND_H 21 | #define RUBBERBAND_H 22 | 23 | #include 24 | 25 | class RubberBand : public QQuickPaintedItem 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) 29 | 30 | public: 31 | explicit RubberBand(QQuickItem *parent = nullptr); 32 | ~RubberBand() override; 33 | 34 | void paint(QPainter *painter) override; 35 | 36 | Q_INVOKABLE bool intersects(const QRectF &rect) const; 37 | 38 | QColor color() const; 39 | void setColor(QColor color); 40 | 41 | signals: 42 | void colorChanged(); 43 | 44 | protected: 45 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; 46 | 47 | private: 48 | QRectF m_geometry; 49 | QColor m_color; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /window.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "window.h" 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | Window::Window(QObject *parent) 27 | : QQmlApplicationEngine(parent) 28 | { 29 | } 30 | 31 | void Window::load(const QUrl &url) 32 | { 33 | QQmlApplicationEngine::load(url); 34 | 35 | QQuickWindow *w = qobject_cast(rootObjects().first()); 36 | 37 | if (w) 38 | w->installEventFilter(this); 39 | } 40 | 41 | bool Window::eventFilter(QObject *obj, QEvent *e) 42 | { 43 | if (e->type() == QEvent::Close) { 44 | QPixmapCache::clear(); 45 | clearComponentCache(); 46 | deleteLater(); 47 | e->accept(); 48 | } 49 | 50 | return QObject::eventFilter(obj, e); 51 | } 52 | -------------------------------------------------------------------------------- /window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 CutefishOS Team. 3 | * 4 | * Author: Reion Wong 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef WINDOW_H 21 | #define WINDOW_H 22 | 23 | #include 24 | 25 | class Window : public QQmlApplicationEngine 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit Window(QObject *parent = nullptr); 31 | 32 | void load(const QUrl &url); 33 | 34 | protected: 35 | bool eventFilter(QObject *o, QEvent *e); 36 | }; 37 | 38 | #endif // WINDOW_H 39 | --------------------------------------------------------------------------------