parent
cf1878b64e
commit
4591188e01
@ -0,0 +1,10 @@
|
|||||||
|
build*/
|
||||||
|
src/translations/libfm-qt
|
||||||
|
|
||||||
|
# Vim.gitignore
|
||||||
|
[._]*.s[a-w][a-z]
|
||||||
|
[._]s[a-w][a-z]
|
||||||
|
*.un~
|
||||||
|
Session.vim
|
||||||
|
.netrwhist
|
||||||
|
*~
|
@ -0,0 +1,344 @@
|
|||||||
|
|
||||||
|
libfm-qt-0.11.1 / 2016-09-24
|
||||||
|
============================
|
||||||
|
|
||||||
|
* Bump version to 0.11.1 (#39)
|
||||||
|
* Fix Custom Actions Submenu (#38)
|
||||||
|
* Extend README.md
|
||||||
|
* Add C++ wrappers for libfm C APIs.
|
||||||
|
* Correct positioning of small icons in icon/thumbnail mode (#32)
|
||||||
|
* Silence new compiler warnings (#36)
|
||||||
|
* Adapt to QT_USE_QSTRINGBUILDER macro
|
||||||
|
* Fixes xcb linking error
|
||||||
|
* Use LXQtCompilerSettings cmake module
|
||||||
|
* Replaces deprecated QStyleOptionViewItemV4
|
||||||
|
* Fix item text direction with RTL layout (#33)
|
||||||
|
* Set tabstops for mount operation password dialog (#31)
|
||||||
|
* Fix memory leak in file open menu (#29)
|
||||||
|
* Fixes https://github.com/lxde/pcmanfm-qt/issues/351. (#27)
|
||||||
|
* build: Use external translations
|
||||||
|
* ts-file removal (#26)
|
||||||
|
* Fix memory leaks in file menu (#25)
|
||||||
|
* Merge pull request #24 from philippwiesemann/fix-folder-menu-leak
|
||||||
|
* translations: fix four typos in messages (#23)
|
||||||
|
* Fix memory leak if restoring files from trash
|
||||||
|
* Fix rename dialog displaying source info twice
|
||||||
|
* Enable renaming in Properties dialog Fixes https://github.com/lxde/pcmanfm-qt/issues/324.
|
||||||
|
* Cancel indexing job when closing filepropsdialog
|
||||||
|
* Bump year
|
||||||
|
|
||||||
|
0.11.0 / 2016-02-27
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Bump version number and ABI version and preparing for the initial release.
|
||||||
|
* Redirect focus operation on the folderview to the actual widget
|
||||||
|
* Use grid layout to have proper properties alignment
|
||||||
|
* Focus automatically on the first field of the filesearch dialog
|
||||||
|
* Add (folder) custom actions to foldermenu.
|
||||||
|
* Update czech translation (by Petr Balíček <pbalicek@seznam.cz>)
|
||||||
|
* Fix compiling with Qt < 5.4
|
||||||
|
* Add supports for freedesktop Xdnd direct save (XDS) protocol (closes #pcmanfm-qt/298). * Move Xdnd workarounds from pcmanfm-qt to libfm-qt.
|
||||||
|
* Protected FolderView methods for getting and setting item delegate margins
|
||||||
|
* Perform auto-completion for the path bar when the user press Tab key. This closes pcmanfm-qt/#201.
|
||||||
|
* Disable unused options in file search dialog
|
||||||
|
* Let the style engine draw the text selection rectangle.
|
||||||
|
* Fix file search with smaller than option
|
||||||
|
* Fix target language in Lithuanian translation file
|
||||||
|
* Fix memory leak if reading stream for image failed
|
||||||
|
* Update German translation
|
||||||
|
* Polish translation updated
|
||||||
|
* Polish translation updated
|
||||||
|
* Add a missing type casting to fix a compiler warning.
|
||||||
|
* Relicense libfm-qt to LGPL v.2.1.
|
||||||
|
* Avoid using blocking calls when initializing the trash can to speed up startup.
|
||||||
|
* Updated Russian translation Removed ru_RU file
|
||||||
|
* Create DnD menu with supported actions only
|
||||||
|
* make createAction public so can be hidden from view
|
||||||
|
* Adds Runtime and Devel install COMPONENT
|
||||||
|
* Quote everything that could break due to whitespaces
|
||||||
|
* Use CMake GenerateExportHeader to generate ABI header file
|
||||||
|
* Use no exceptions also with Clang
|
||||||
|
* Uses CMAKE_VISIBILITY and CMAKE_CXX_VISIBILITY flags
|
||||||
|
* Use QString() instead of ""
|
||||||
|
* Fix duplicated mtp mounts in the side pane by adding workarounds for potential bugs of gvfs.
|
||||||
|
* Replace g_io_scheduler which is deprecated with QThread in Fm::PathEdit. * Fix compiler warnings.
|
||||||
|
* Adds .gitignore
|
||||||
|
* Makes Release the default BUILD_TYPE
|
||||||
|
* Adds INSTALL package configuration file
|
||||||
|
* Removes XCB from the dependencies
|
||||||
|
* Adds target_include_directories() for the INSTALL_INTERFACE.
|
||||||
|
* Removes CMAKE_CURRENT_BINARY_DIR usage
|
||||||
|
* Removes QTX_INCLUDE_DIRS
|
||||||
|
* Removes Qt Creator .user file
|
||||||
|
* Updates libraries dependencies
|
||||||
|
* Adds REQUIRED_PACKAGE_VERSION variables
|
||||||
|
* Adds generation of TARGETS CMake file
|
||||||
|
* Creates and installs an package version file
|
||||||
|
* Renames and moves LIBRARY_NAME variable to the top CMakeLists
|
||||||
|
* Removes sub-project
|
||||||
|
* Rename the library to libfm-qt and fix installed header files.
|
||||||
|
* Split pcmanfm-qt into two parts and move libfm-qt to its own repository.
|
||||||
|
* Update French translation
|
||||||
|
* Italian translation updates
|
||||||
|
* Fix a crash triggered when unmounting a volume from the side pane.
|
||||||
|
* Avoid duplicated volumes and mounts in the side panel. (This fixes the mtp:// problem.)
|
||||||
|
* Fix missing null pointer check in Fm::Path::parent() and use nullptr instead of NULL in path.h.
|
||||||
|
* Code cleanup, «using» directive only if necessary
|
||||||
|
* Upgrade of pcmanfm-qt to C++11
|
||||||
|
* hu translations updated
|
||||||
|
* Fixed several problems with item selection and alignment
|
||||||
|
* Remove unnecessary qDebug traces
|
||||||
|
* Update translations.
|
||||||
|
* The signal QAbstractItemView::iconSizeChanged is only available after Qt 5.5. Add workarounds for older Qt versions.
|
||||||
|
* Add more null pointer checks in the thumbnail loader to avoid crashes caused by older versions of libfm.
|
||||||
|
* Update translations
|
||||||
|
* Avoid the column resizing tricks for the detailed list view when the view contains no columns.
|
||||||
|
* Improve the column width computation for the detailed view
|
||||||
|
* PlacesView: activate on click on the second column
|
||||||
|
* SidePane: reduce size of button's column width
|
||||||
|
* Added a filterbar + Handle virtually hidden files
|
||||||
|
* Russian translation update
|
||||||
|
* Update cs_CZ translation with the strings provided by petrbal in pull request #218.
|
||||||
|
* Allow adding or removing paths in the file search dialog. Fix bugs in searching for documents.
|
||||||
|
* Try to implement file searching by using the new Fm::FileSearchDialog class.
|
||||||
|
* Fix a incorrecy free() in fm_search_free() API.
|
||||||
|
* Add Fm::Path::take() API to take the ownership of a raw FmPath pointer.
|
||||||
|
* Add class Fm::FileSearchDialog used to show a dialog for searching files.
|
||||||
|
* Add FmSearch API which is used to build a search:// URI. (implemented in C and might become part of libfm later).
|
||||||
|
* Fix #195 - Crash when rightclick on item in trash.
|
||||||
|
* Add a null check for FmFileInfo in Fm::ProxyFolderModel::lessThan(). This closes #205.
|
||||||
|
* Fix (workaround) for right-click crash in placesview.
|
||||||
|
* Russian translation: update
|
||||||
|
* Italian translation: add desktop entry files, adjust TS files
|
||||||
|
* placesview: middle-click correct item to activate (fix of segfault)
|
||||||
|
* Check for null pointers.
|
||||||
|
* Select the folder from where we have gone up.
|
||||||
|
* Paste into folder from its context menu.
|
||||||
|
* libfm-qt: updated german translation
|
||||||
|
* libfm-qt: lupdated translation files
|
||||||
|
* Add Greek (el) translation
|
||||||
|
* added support for mouse back/forward buttons
|
||||||
|
* Update German translation
|
||||||
|
* Add new signal prepareFileMenu() to Fm::SidePane and Fm::DirTree so there's a chance to customize the file menu before its shown.
|
||||||
|
* Port some missing config options from the gtk+ version of pcmanfm.
|
||||||
|
* Also show hidden dirs in the directory tree when the "Show Hidden" option in the menu is turned on.
|
||||||
|
* Fix #190 - Column layout is not always updated.
|
||||||
|
* Create New menu actions, context menu in tree side pane, #163.
|
||||||
|
* Store side pane mode setting, #157.
|
||||||
|
* Fixes an translation regression
|
||||||
|
* Updates translations
|
||||||
|
* Uses LXQt lxqt_translate_ts() to handle translations
|
||||||
|
* Fix lxde/lxqt#447 - missing actions in Places' context menus
|
||||||
|
* Remove trailing whitespaces
|
||||||
|
* polishing German translation
|
||||||
|
* Add menu items and shortcuts for new folder and blank file, fixes #163.
|
||||||
|
* Display folders first when active and sort order descending, fixes #179.
|
||||||
|
* Avoid space wasted by incorrect decoration in detailed view columns, fixes #177.
|
||||||
|
* Avoid flickering column header while resizing manually, fixes #176.
|
||||||
|
* Hungarian translation
|
||||||
|
* Fix #627 - long startup time. (This blocking is caused by checking the availability of "network:///".)
|
||||||
|
* Enable text selection in file properties dialog
|
||||||
|
* Fix some memory leaks reported by valgrind.
|
||||||
|
* Fix warnings reported by cppcheck.
|
||||||
|
* Fix warnings reported by scan-build.
|
||||||
|
* Sort indicators in detailed view, store column and order in settings, fixes #109.
|
||||||
|
* Fix lxde/lxqt#512 - pcmanfm-qt: cannot delete to trash.
|
||||||
|
* Polish translations added
|
||||||
|
* Use 'user-trash' icon for 'Move to Trash'
|
||||||
|
* The "Custom" option in the application chooser combo box inside file properties dialog is broken. Fix by preventing recursive signal handler invocation.
|
||||||
|
* The file property dialog does not show correct default applications. Fix a bug in AppChooserComboBox::setMimeType() that does incorrect app comparison.
|
||||||
|
* When converting an UID or GID to its name, show the number as string when the user or group does not exists.
|
||||||
|
* Add more null checks.
|
||||||
|
* Portuguese update
|
||||||
|
* Add very basic "remaining time" display to the progress dialog. Fix lxde/lxqt#463 - Progress dialog of pcmanfm-qt does not show remaining time.
|
||||||
|
* Fix lxde/pcmanfm-qt#120 - Foucs "Rename" button when file name changed.
|
||||||
|
* Remove unnecessary '\n' charactor from the translated strings.
|
||||||
|
* Fix translations (the newly added string comes from the translation of libfm).
|
||||||
|
* Improve trash can handling: provide an option to delete the files if moving to trashcan fails.
|
||||||
|
* Fix broken filenames of translation files.
|
||||||
|
* More migration to Qt5 new signal/slot syntax for better type safety & speed.
|
||||||
|
* Migrade to new Qt5 signal/slot syntax for better type safety and speed.
|
||||||
|
* Fix the broken sorting option.
|
||||||
|
* Fix lxde/lxqt#448 - PCmanFM-QT renaming place bookmarks does nothing.
|
||||||
|
* Support linguistic sorting of file names. This fixes #105.
|
||||||
|
* Update the folder model & view after files are changed.
|
||||||
|
* Open folders in new tabs by middle clicking on items in the side pane.
|
||||||
|
* Portuguese update
|
||||||
|
* Fix a crash of the context menu of places view caused by change of items.
|
||||||
|
* Save the result of "Edit bookmarks" to gtk+3 bookmarks file instead of the deprecated ~/.gtkbookmarks file. This fixes bug #112 partially.
|
||||||
|
* Add spanish translations
|
||||||
|
* Update Japanese translation
|
||||||
|
* Add German translation
|
||||||
|
* add Japanese translation
|
||||||
|
* Implement "UnTrash" for files in trash:/// and close lxde/lxqt#136.
|
||||||
|
* Add Russian translation
|
||||||
|
* Drop Qt4 support in code
|
||||||
|
* Clean up CMakeLists.txt and drop Qt4 support
|
||||||
|
* New files added from LXDE Pootle server based on templates
|
||||||
|
* Commit from LXDE Pootle server by user Julius22.: 1007 of 1008 strings translated (2 need review).
|
||||||
|
* Commit from LXDE Pootle server by user Julius22.: 709 of 1008 strings translated (2 need review).
|
||||||
|
* Commit from LXDE Pootle server by user mbouzada.: 364 of 364 strings translated (0 need review).
|
||||||
|
* New files added from LXDE Pootle server based on templates
|
||||||
|
* Add cs_CZ translation for libfm-qt.
|
||||||
|
* Commit from LXDE Pootle server by user dforsi.: 364 of 364 strings translated (0 need review).
|
||||||
|
* Commit from LXDE Pootle server by user dforsi.: 358 of 364 strings translated (0 need review).
|
||||||
|
* Bump package version number and library soversion to prepare for 0.2 release.
|
||||||
|
* Fix #85 - Scrolling doesn't work in compact view.
|
||||||
|
* Hide UI elements that are not usable and disable trash can when gvfs is not available. * Add new API Fm::isUriSchemeSupported().
|
||||||
|
* Avoid showing the popup menu when moving desktop items.
|
||||||
|
* Improve handling of file selection and fixing FolderView::selectAll(), which is reported in #45. Delay the handling of selectionChanged() signal to avoid too frequent UI updates.
|
||||||
|
* Little adjustment for the grid of the folder view to decrease unnecessary margins.
|
||||||
|
* Use a new way to optimize the size of filename display based on current view mode and font size. This also fixes lxde/lxde-qt #198 - PCmanFM-qt incorrectly displays 256x256 Thumbnails.
|
||||||
|
* Fully support single click activation and auto-selection with associated options added to the preference dialog.
|
||||||
|
* Add single click and auto-selection on hover support to Fm::FolderView.
|
||||||
|
* New files added from LXDE Pootle server based on templates
|
||||||
|
* New files added from LXDE Pootle server based on templates
|
||||||
|
* Improve update of translations to avoid unnecessary regeneration of ts files.
|
||||||
|
* Improve handling of fallback icons. This closes bug #57.
|
||||||
|
* Translations are lost accidentally in a previous commit. Restore them all.
|
||||||
|
* Fix a crash in Fm::PlacesModel when gvfs is not available. This closes bug #35 - Ctrl+W closes all windows.
|
||||||
|
* Do not detect filename extension and select the whole filename by default while renaming directories. This closes bug #71 - Don't try to detect extensions on directories. * API changed: Fm::renameFile() now accepect FmFileInfo as its first parameter.
|
||||||
|
* Fix bug #80 - make execute in context menu doesn't do change permissions.
|
||||||
|
* Revert "fixed selection issue #45" This patch breaks copying files by DND in icon view mode and moving desktop icons.
|
||||||
|
* Use qss instead of QPalette to set the background color of ColorButton. This fixed bug #192 of lxde-qt.
|
||||||
|
* Rename the library from libfm-qt to libfm-qt5 when built with Qt5.
|
||||||
|
* fixed selection issue #45
|
||||||
|
* Fix middle click position calculation in detailed view mode
|
||||||
|
* Fix crash when context menu is requested but selection is empty
|
||||||
|
* Activate view items only if clicked with left mouse button
|
||||||
|
* Do not emit activated signal when keyboard modifiers are on.
|
||||||
|
* Splits the checks for needed libraries
|
||||||
|
* Removes duplicated include_directories() entry
|
||||||
|
* Make sure clang compiler does not complain
|
||||||
|
* Install pkgconfig file of libfm-qt to correct location in FreeBSD
|
||||||
|
* Fix missing return values in several methods.
|
||||||
|
* Avoid endless popups of error dialogs when there are errors launching files.
|
||||||
|
* Save thumbnails as png files correctly.
|
||||||
|
* Remember custom positions for desktop icons and fix #29.
|
||||||
|
* Add template support to the folder context menus and fix #39.
|
||||||
|
* Show "owner" in the detailed list view mode. * Fix a crash when switching to detailed list mode in qt5.
|
||||||
|
* Use xcb to set EWMH window type hint to the desktop window in Qt5. * Some more cleanup for the CMakeList.txt files
|
||||||
|
* Add initial support for Qt5.
|
||||||
|
* Try to fix #36 again.
|
||||||
|
* Fix a seg fault caused by the widget being deleted during glib signal handling.
|
||||||
|
* Code cleanup, removing unnecessary header inclusion to speed up compilation.
|
||||||
|
* Avoid further handling of MountOperation in the gio finished callback if the object is deleted.
|
||||||
|
* Use modeless dialogs for app chooser and error reporting in Fm::FileLauncher and Fm::FileMenu.
|
||||||
|
* Add an small emblem for symlinks (using icon name "emblem-symbolic-link"). Fix bug #27.
|
||||||
|
* Add missing file to git.
|
||||||
|
* Move internal implementation details to private headers which are not installed to the system.
|
||||||
|
* Implement Fm::AppChooserDialog and Fm::AppMenuView classes. * Add <Open with...>/<Other Applications> menu item to Fm::FileMenu. * Add custom app to Fm::AppChooserComboBox.
|
||||||
|
* Add Fm::AppChooserComboBox and use it in Fm::FilePropsDialog.
|
||||||
|
* Redesign Fm::FileLauncher APIs to make it more usable. * Add Fm::FileMenu::setFileLauncher() and Fm::FolderView::setFileLauncher() APIs. * Move PCManFM::View::onFileClick() and other popup menu handling to Fm::FolderView.
|
||||||
|
* Improve Fm::FileLaucher to make it easy to derive subclasses. * Implement a special dialog for opening executable files (Fix bug #13 - it does not launch executables)
|
||||||
|
* Fix bug #28 - Tash can icon does not refresh when the trash can changes its empty/full status
|
||||||
|
* Load autocompletion list for Fm::PathEdit only when the widget has the keyboard focus to avoid unnecessary I/O.
|
||||||
|
* Add proper popup menu items for selected folders and fix #20 and #19. * Some code refactors, adding openFolders() and openFolderInTerminal() to Application class.
|
||||||
|
* Fix #25 - Amount of items in the folder is not refreshed when the folder content changes. * Update status bar text properly on switching tab pages, selection changes, and folder content changes.
|
||||||
|
* Fix the broken compiler definitions caused by previous commit.
|
||||||
|
* Fix bug #22 - Do not select file extension by default on file rename. * Avoid installing private headers (*_p.h files)
|
||||||
|
* Setup pcmanfm-qt to support optional Custom Actions Menubar detects if libfm was built with vala or not if so a fm-actions.h will exist and support will be compiled in if not, will still compile with no actions menu
|
||||||
|
* Allow installation path configuration with standard CMake X_INSTALL_DIR
|
||||||
|
* Support reordering bookmark items in the places view with DND.
|
||||||
|
* Support adding bookmarks to the places view using drag and drop
|
||||||
|
* Preparing for implementing dnd for places view.
|
||||||
|
* Improve the usability of icon view mode, fixing github bug #24.
|
||||||
|
* Fix crashes caused by invalid pointer access.
|
||||||
|
* Switch current dir of the folder view correctly with dir tree view in the side pane.
|
||||||
|
* Finish chdir operation for Fm::DirTreeView.
|
||||||
|
* Support hiding hidden folders from DirTreeModel.
|
||||||
|
* Move some methods from DirTreeModel to DirTreeModelItem and fix some row updating problems.
|
||||||
|
* Implement dynamic folder loading/unloading when expanding or collapsing dir tree nodes. * Enable horizontal scrollbar of dir tree view.
|
||||||
|
* Move some code from Fm::DirTreeModel to Fm::DirTreeModelItem.
|
||||||
|
* Partially implement Fm::DirTreeView and Fm::DirTreeModel. (not finished yet)
|
||||||
|
* Fix an invalid pointer
|
||||||
|
* Implment different modes for Fm::SidePane, matching libfm-qtk design. * Add basic skeleton for dir tree view/model.
|
||||||
|
* Fix the cosmetic defect introduced by the eject buttons in the places view.
|
||||||
|
* Add eject buttons to mounted volumes in the places side pane.
|
||||||
|
* Add a wrapper class Fm::Path for FmPath C struct.
|
||||||
|
* Initialize icon_ member of PlacesModelItem correctly.
|
||||||
|
* Fix fallback icon when a platform plugin is abscent. * Make Fm::IconTheme::checkUpdate() a static function.
|
||||||
|
* Remove xsettings support. Use a cleaner way to detect config changes by monitor StyleChange events. * Add Fm::IconTheme::changed() signal which is emitted when the icon theme name is changed. * Replace nested Fm::PlacesModel::Item and related classes with their own separate toplevel classes.
|
||||||
|
* Fix the icon for files of unknown mime types, again.
|
||||||
|
* Fix the icon for files of unknown mime types.
|
||||||
|
* Add DES-EMA custom actions to the popup menus.
|
||||||
|
* Make it safe to create multiple Fm::LibFmQt objects and only initialize libfm once.
|
||||||
|
* Fix incorrect export symbols and use GNUInstallDirs for installation destination
|
||||||
|
* Use the latest libfm thumbnailer APIs.
|
||||||
|
* Fix #3614873 - Thumbnails in icon view shown upside down for some jpegs.
|
||||||
|
* Adopt recent changes of libfm. FmIcon is essentially identical to GIcon now.
|
||||||
|
* Add a UI file for application chooser dialog.
|
||||||
|
* Correctly handle display names of folders in path entry auto-completion.
|
||||||
|
* Add a global header and add proper definition for LIBFM_QT_API macro.
|
||||||
|
* Add "Empty trash" and fix a memory leak.
|
||||||
|
* Fix memory leaks for bookmarks. Fix the broken "Network" item in places.
|
||||||
|
* Reduce memory usage: Paint the folder items with our own code instead of using a dirty hacks duplicating pixmaps.
|
||||||
|
* Reduce of size of QPixmapCache in the hope of decreasing memory usage.
|
||||||
|
* Add fallback icons for places item "applications" and "network".
|
||||||
|
* Add class Fm::CachedFolderModel, a convinient way to share Fm::FolderModel objects and reduce memory usage.
|
||||||
|
* Resize the columns of detailed list view when items are inserted or removed.
|
||||||
|
* Optimize column widths in detailed list mode when the view is resized.
|
||||||
|
* Only show thumbnails for the first column in detailed list mode.
|
||||||
|
* Use new "automoc" feature of cmake 2.8.6 and remove cumbersome #include "*.moc" code.
|
||||||
|
* Trivial fix.
|
||||||
|
* Add additional custom filter support to ProxyFolderModel.
|
||||||
|
* Fix some memory leaks.
|
||||||
|
* Fix some compiler errors and update translations.
|
||||||
|
* Support the latest libfm trunk. Remove -fpermissive compiler flag and fix compiler errors/warnings.
|
||||||
|
* Adopt new libfm thumbnail APIs.
|
||||||
|
* Add soname 0.0.0 for libfm-qt, preparing for 0.1 release.
|
||||||
|
* Fix crashes caused by incorrect deletion of dialog objects.
|
||||||
|
* Enable thumbnail related settings.
|
||||||
|
* Update zh_TW translations and translation templates.
|
||||||
|
* Add Portuguese translation (pt).
|
||||||
|
* Add Lithuanian translation (lt_LT).
|
||||||
|
* Adopt the latest thumbnail API in libfm (thumbnail branch) to speed up loading.
|
||||||
|
* Workardound incorrect thumbnail painting caused by bug of QStyledItemDelegate. :-(
|
||||||
|
* Fix a crash caused by accessing data for invalid model index.
|
||||||
|
* Fix a crash caused by accessing data for invalid model index.
|
||||||
|
* Add basic thumbnail support (need the latest thumbnail branch of libfm).
|
||||||
|
* Add archiver integration for file context menus.
|
||||||
|
* Add archiver integration to file context menus.
|
||||||
|
* Add mnemonics for menu items. Make confirm dialog before delete and trash can optional.
|
||||||
|
* Update side pane according to current dir. Little fix.
|
||||||
|
* Implement "Open in Terminal" and "Open as Root".
|
||||||
|
* Implement "Auto Run" for newly inserted removable devices.
|
||||||
|
* Add "Edit Bookmarks" dialog.
|
||||||
|
* Implement "Invert Selection". Little fix of UI, add a Tool menu to main window.
|
||||||
|
* Implement "Create New" menu in the folder popup menu.
|
||||||
|
* Modify make rules for translations. Avoid deleting generated ts files when "make clean". Fix a small error in zh_TW translation.
|
||||||
|
* Add auto-completion to path entry bar.
|
||||||
|
* Rename Fm::Application to Fm::LibFmQt to decrease confusion. Set required Qt version to 4.6.
|
||||||
|
* Load translation files correctly for pcmanfm-qt and libfm-qt.
|
||||||
|
* Add basic skeleton for i18n (using Qt QTranslator & Qt Linguist).
|
||||||
|
* Add separate CMakeLists.txt files for pcmanfm and libfm-qt. Hide more implementation details from libfm-qt headers.
|
||||||
|
* Fix copyright notice in all source files.
|
||||||
|
* Install a pkgconfig file for libfm-qt for use in other projects.
|
||||||
|
* Fix a memory error caused by incorrect array size. Fix incorrect spacing of icons.
|
||||||
|
* Finish chown and chmod supports.
|
||||||
|
* Try to add file opermission settings UI.
|
||||||
|
* Implement very basic drag and drop support.
|
||||||
|
* Supress the incorrect default dnd handling of QListView.
|
||||||
|
* Try to implement Dnd.
|
||||||
|
* Finish desktop preferences.
|
||||||
|
* Improve desktop preferences and apply settings (partially done).
|
||||||
|
* Add desktop preferences dialog.
|
||||||
|
* Apply side pane icon size correctly. Add basic skeleton for archiver integration.
|
||||||
|
* Set shortcuts for frequently used menu options. Implement "rename file" support. Hide tabs when there is only one tab left (optional).
|
||||||
|
* Delete windows properly when they're closed with setAttribute(Qt::WA_DeleteOnClose); Apply settings to windows after clicking OK in the preference dialog.
|
||||||
|
* Improve preferences dialog. Change base class of SidePane to QWidget.
|
||||||
|
* Sync the state of folder popup menu and main menu bar.
|
||||||
|
* Implement sort options for main window.
|
||||||
|
* Fix file sorting options for Fm::FolderMenu.
|
||||||
|
* Correctly implement browse history and fix crashes.
|
||||||
|
* Add very simple browse history (back/forward) handling.
|
||||||
|
* Apply gcc visiblility attributes to export less symbols.
|
||||||
|
* Correctly handle file rename/overwrite during file operations.
|
||||||
|
* Exclude unnecessary files from CPack.
|
||||||
|
* Improve folder popup menu.
|
||||||
|
* Add folder popup menu. Some UI polishing.
|
||||||
|
* Fix a little crash.
|
||||||
|
* Fix crashes when turning off desktop manager.
|
||||||
|
* Show popup menu for blank area of folders.
|
||||||
|
* Do some refactor to make Fm::FolderView cleaner. Add PCManFM::View to do file manager-specific operations.
|
||||||
|
* Move files for libfm-qt and pcmanfm-qt to separate subdirs.
|
@ -1,21 +1,27 @@
|
|||||||
# libfm-qt
|
# libfm-qt
|
||||||
|
|
||||||
Includes libfm-qt, the Qt port of the libfm - a library providing components to
|
## Overview
|
||||||
build desktop file managers.
|
|
||||||
|
|
||||||
Issue tracker:
|
libfm-qt is the Qt port of libfm, a library providing components to build desktop file managers which belongs to [LXDE](http://lxde.org).
|
||||||
https://github.com/lxde/pcmanfm-qt/issues
|
|
||||||
|
|
||||||
LXQt website:
|
libfm-qt is licensed under the terms of the [LGPLv2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) or any later version. See file LICENSE for its full text.
|
||||||
http://lxqt.org
|
|
||||||
|
|
||||||
LXDE website:
|
## Installation
|
||||||
http://lxde.org
|
|
||||||
|
|
||||||
|
### Compiling source code
|
||||||
|
|
||||||
# License
|
Runtime dependencies are qtx11extras and libfm ≥ 1,2 (not all features are provided by libfm-qt yet).
|
||||||
|
Additional build dependencies are CMake and optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
|
||||||
|
|
||||||
libfm-qt is licensed under the terms of the
|
Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems, depending on the way library paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well.
|
||||||
[LGPLv2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) or any later version.
|
|
||||||
|
|
||||||
See the LICENSE file for the full text of the license.
|
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
|
||||||
|
|
||||||
|
### Binary packages
|
||||||
|
|
||||||
|
Official binary packages are available in Arch Linux, Debian (as of Debian stretch) and openSUSE (Leap 42.1 and Tumbleweed).
|
||||||
|
The library is still missing in Fedora which is providing version 0.10.0 of PCManFM-Qt only so far. This version was still including the code outsourced into libfm-qt later so libfm-qt will have to be provided by Fedora, too, as soon as the distribution upgrades to PCManFM-Qt ≥ 0.10.1.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
Issues should go to the tracker of PCManFM-Qt at https://github.com/lxde/pcmanfm-qt/issues.
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
#.rst:
|
||||||
|
# FindXCB
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# Find XCB libraries
|
||||||
|
#
|
||||||
|
# Tries to find xcb libraries on unix systems.
|
||||||
|
#
|
||||||
|
# - Be sure to set the COMPONENTS to the components you want to link to
|
||||||
|
# - The XCB_LIBRARIES variable is set ONLY to your COMPONENTS list
|
||||||
|
# - To use only a specific component check the XCB_LIBRARIES_${COMPONENT} variable
|
||||||
|
#
|
||||||
|
# The following values are defined
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# XCB_FOUND - True if xcb is available
|
||||||
|
# XCB_INCLUDE_DIRS - Include directories for xcb
|
||||||
|
# XCB_LIBRARIES - List of libraries for xcb
|
||||||
|
# XCB_DEFINITIONS - List of definitions for xcb
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright (c) 2015 Jari Vetoniemi
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
include(FeatureSummary)
|
||||||
|
set_package_properties(XCB PROPERTIES
|
||||||
|
URL "http://xcb.freedesktop.org/"
|
||||||
|
DESCRIPTION "X protocol C-language Binding")
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_XCB QUIET xcb ${XCB_FIND_COMPONENTS})
|
||||||
|
|
||||||
|
find_library(XCB_LIBRARIES xcb HINTS ${PC_XCB_LIBRARY_DIRS})
|
||||||
|
find_path(XCB_INCLUDE_DIRS xcb/xcb.h PATH_SUFFIXES xcb HINTS ${PC_XCB_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
foreach(COMPONENT ${XCB_FIND_COMPONENTS})
|
||||||
|
find_library(XCB_LIBRARIES_${COMPONENT} ${COMPONENT} HINTS ${PC_XCB_LIBRARY_DIRS})
|
||||||
|
list(APPEND XCB_LIBRARIES ${XCB_LIBRARIES_${COMPONENT}})
|
||||||
|
mark_as_advanced(XCB_LIBRARIES_${COMPONENT})
|
||||||
|
endforeach(COMPONENT ${XCB_FIND_COMPONENTS})
|
||||||
|
|
||||||
|
set(XCB_DEFINITIONS ${PC_XCB_CFLAGS_OTHER})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS)
|
||||||
|
mark_as_advanced(XCB_INCLUDE_DIRS XCB_LIBRARIES XCB_DEFINITIONS)
|
@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_ARCHIVER_H__
|
||||||
|
#define __LIBFM_QT_FM_ARCHIVER_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Archiver {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Archiver() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Archiver(Archiver&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmArchiver*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~Archiver() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Archiver wrapPtr(FmArchiver* dataPtr) {
|
||||||
|
Archiver obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmArchiver*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmArchiver* takeDataPtr() {
|
||||||
|
FmArchiver* data = reinterpret_cast<FmArchiver*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmArchiver* dataPtr() {
|
||||||
|
return reinterpret_cast<FmArchiver*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmArchiver*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Archiver& operator=(Archiver&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmArchiver*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void setDefault(void) {
|
||||||
|
fm_archiver_set_default(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Archiver getDefault( ) {
|
||||||
|
return wrapPtr(fm_archiver_get_default());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool extractArchivesTo(GAppLaunchContext* ctx, FmPathList* files, FmPath* dest_dir) {
|
||||||
|
return fm_archiver_extract_archives_to(dataPtr(), ctx, files, dest_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool extractArchives(GAppLaunchContext* ctx, FmPathList* files) {
|
||||||
|
return fm_archiver_extract_archives(dataPtr(), ctx, files);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool createArchive(GAppLaunchContext* ctx, FmPathList* files) {
|
||||||
|
return fm_archiver_create_archive(dataPtr(), ctx, files);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isMimeTypeSupported(const char* type) {
|
||||||
|
return fm_archiver_is_mime_type_supported(dataPtr(), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// the wrapped object cannot be copied.
|
||||||
|
private:
|
||||||
|
Archiver(const Archiver& other) = delete;
|
||||||
|
Archiver& operator=(const Archiver& other) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmArchiver* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_ARCHIVER_H__
|
@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_BOOKMARKS_H__
|
||||||
|
#define __LIBFM_QT_FM_BOOKMARKS_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Bookmarks {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Bookmarks() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bookmarks(FmBookmarks* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Bookmarks(const Bookmarks& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Bookmarks(Bookmarks&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~Bookmarks() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Bookmarks wrapPtr(FmBookmarks* dataPtr) {
|
||||||
|
Bookmarks obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmBookmarks* takeDataPtr() {
|
||||||
|
FmBookmarks* data = reinterpret_cast<FmBookmarks*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmBookmarks* dataPtr() {
|
||||||
|
return reinterpret_cast<FmBookmarks*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmBookmarks*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Bookmarks& operator=(const Bookmarks& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Bookmarks& operator=(Bookmarks&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
GList* getAll(void) {
|
||||||
|
return fm_bookmarks_get_all(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rename(FmBookmarkItem* item, const char* new_name) {
|
||||||
|
fm_bookmarks_rename(dataPtr(), item, new_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reorder(FmBookmarkItem* item, int pos) {
|
||||||
|
fm_bookmarks_reorder(dataPtr(), item, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void remove(FmBookmarkItem* item) {
|
||||||
|
fm_bookmarks_remove(dataPtr(), item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmBookmarkItem* insert(FmPath* path, const char* name, int pos) {
|
||||||
|
return fm_bookmarks_insert(dataPtr(), path, name, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Bookmarks dup(void ) {
|
||||||
|
return Bookmarks::wrapPtr(fm_bookmarks_dup());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_BOOKMARKS_H__
|
@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_CONFIG_H__
|
||||||
|
#define __LIBFM_QT_FM_CONFIG_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Config {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
Config(void ) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(fm_config_new());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Config(FmConfig* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Config(const Config& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Config(Config&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~Config() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Config wrapPtr(FmConfig* dataPtr) {
|
||||||
|
Config obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmConfig* takeDataPtr() {
|
||||||
|
FmConfig* data = reinterpret_cast<FmConfig*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmConfig* dataPtr() {
|
||||||
|
return reinterpret_cast<FmConfig*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmConfig*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Config& operator=(const Config& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Config& operator=(Config&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void emitChanged(const char* changed_key) {
|
||||||
|
fm_config_emit_changed(dataPtr(), changed_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void save(const char* name) {
|
||||||
|
fm_config_save(dataPtr(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loadFromKeyFile(GKeyFile* kf) {
|
||||||
|
fm_config_load_from_key_file(dataPtr(), kf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loadFromFile(const char* name) {
|
||||||
|
fm_config_load_from_file(dataPtr(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_CONFIG_H__
|
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_DEEP_COUNT_JOB_H__
|
||||||
|
#define __LIBFM_QT_FM_DEEP_COUNT_JOB_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
#include "job.h"
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API DeepCountJob: public Job {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
DeepCountJob(FmPathList* paths, FmDeepCountJobFlags flags) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(fm_deep_count_job_new(paths, flags));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
DeepCountJob() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepCountJob(FmDeepCountJob* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
DeepCountJob(const DeepCountJob& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
DeepCountJob(DeepCountJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static DeepCountJob wrapPtr(FmDeepCountJob* dataPtr) {
|
||||||
|
DeepCountJob obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmDeepCountJob* takeDataPtr() {
|
||||||
|
FmDeepCountJob* data = reinterpret_cast<FmDeepCountJob*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmDeepCountJob* dataPtr() {
|
||||||
|
return reinterpret_cast<FmDeepCountJob*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmDeepCountJob*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
DeepCountJob& operator=(const DeepCountJob& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
DeepCountJob& operator=(DeepCountJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void setDest(dev_t dev, const char* fs_id) {
|
||||||
|
fm_deep_count_job_set_dest(dataPtr(), dev, fs_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_DEEP_COUNT_JOB_H__
|
@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_DIR_LIST_JOB_H__
|
||||||
|
#define __LIBFM_QT_FM_DIR_LIST_JOB_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
#include "job.h"
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API DirListJob: public Job {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
DirListJob(FmPath* path, gboolean dir_only) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(fm_dir_list_job_new(path, dir_only));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
DirListJob() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DirListJob(FmDirListJob* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
DirListJob(const DirListJob& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
DirListJob(DirListJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static DirListJob wrapPtr(FmDirListJob* dataPtr) {
|
||||||
|
DirListJob obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmDirListJob* takeDataPtr() {
|
||||||
|
FmDirListJob* data = reinterpret_cast<FmDirListJob*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmDirListJob* dataPtr() {
|
||||||
|
return reinterpret_cast<FmDirListJob*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmDirListJob*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
DirListJob& operator=(const DirListJob& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
DirListJob& operator=(DirListJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void addFoundFile(FmFileInfo* file) {
|
||||||
|
fm_dir_list_job_add_found_file(dataPtr(), file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setIncremental(gboolean set) {
|
||||||
|
fm_dir_list_job_set_incremental(dataPtr(), set);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmFileInfoList* getFiles(void) {
|
||||||
|
return fm_dir_list_job_get_files(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static DirListJob newForGfile(GFile* gf) {
|
||||||
|
return DirListJob::wrapPtr(fm_dir_list_job_new_for_gfile(gf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static DirListJob new2(FmPath* path, FmDirListJobFlags flags) {
|
||||||
|
return DirListJob::wrapPtr(fm_dir_list_job_new2(path, flags));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_DIR_LIST_JOB_H__
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_DUMMY_MONITOR_H__
|
||||||
|
#define __LIBFM_QT_FM_DUMMY_MONITOR_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_DUMMY_MONITOR_H__
|
@ -0,0 +1,153 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_FILE_H__
|
||||||
|
#define __LIBFM_QT_FM_FILE_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API File {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
File() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
File(FmFile* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
File(const File& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
File(File&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~File() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static File wrapPtr(FmFile* dataPtr) {
|
||||||
|
File obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFile* takeDataPtr() {
|
||||||
|
FmFile* data = reinterpret_cast<FmFile*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFile* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFile*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFile*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
File& operator=(const File& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
File& operator=(File&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
static GFile* newForCommandlineArg(const char* arg) {
|
||||||
|
return fm_file_new_for_commandline_arg(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GFile* newForUri(const char* uri) {
|
||||||
|
return fm_file_new_for_uri(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool wantsIncremental(GFile* file) {
|
||||||
|
return fm_file_wants_incremental(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void addVfs(const char* name, FmFileInitTable* init) {
|
||||||
|
fm_file_add_vfs(name, init);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_FILE_H__
|
@ -0,0 +1,511 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_FILE_INFO_H__
|
||||||
|
#define __LIBFM_QT_FM_FILE_INFO_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API FileInfoList {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
FileInfoList( ) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFileInfoList*>(fm_file_info_list_new());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileInfoList(FmFileInfoList* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmFileInfoList*>(fm_list_ref(FM_LIST(dataPtr))) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
FileInfoList(const FileInfoList& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfoList*>(fm_list_ref(FM_LIST(other.dataPtr_))) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
FileInfoList(FileInfoList&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFileInfoList*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~FileInfoList() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_list_unref(FM_LIST(dataPtr_));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static FileInfoList wrapPtr(FmFileInfoList* dataPtr) {
|
||||||
|
FileInfoList obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmFileInfoList*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFileInfoList* takeDataPtr() {
|
||||||
|
FmFileInfoList* data = reinterpret_cast<FmFileInfoList*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFileInfoList* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFileInfoList*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFileInfoList*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
FileInfoList& operator=(const FileInfoList& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_list_unref(FM_LIST(dataPtr_));
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfoList*>(fm_list_ref(FM_LIST(other.dataPtr_))) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
FileInfoList& operator=(FileInfoList&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFileInfoList*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
bool isSameFs(void) {
|
||||||
|
return fm_file_info_list_is_same_fs(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isSameType(void) {
|
||||||
|
return fm_file_info_list_is_same_type(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isEmpty() {
|
||||||
|
return fm_file_info_list_is_empty(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int getLength() {
|
||||||
|
return fm_file_info_list_get_length(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
FmFileInfo* peekHead() {
|
||||||
|
return fm_file_info_list_peek_head(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
GList* peekHeadLink() {
|
||||||
|
return fm_file_info_list_peek_head_link(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushTail(FmFileInfo* d) {
|
||||||
|
fm_file_info_list_push_tail(dataPtr(), d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushTailLink(GList* d) {
|
||||||
|
fm_file_info_list_push_tail_link(dataPtr(), d);
|
||||||
|
}
|
||||||
|
|
||||||
|
FmFileInfo* popHead(){
|
||||||
|
return fm_file_info_list_pop_head(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteLink(GList* _l) {
|
||||||
|
fm_file_info_list_delete_link(dataPtr(), _l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
fm_file_info_list_clear(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmFileInfoList* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API FileInfo {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
FileInfo( ) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFileInfo*>(fm_file_info_new());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileInfo(FmFileInfo* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmFileInfo*>(fm_file_info_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
FileInfo(const FileInfo& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfo*>(fm_file_info_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
FileInfo(FileInfo&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFileInfo*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~FileInfo() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_file_info_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static FileInfo wrapPtr(FmFileInfo* dataPtr) {
|
||||||
|
FileInfo obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmFileInfo*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFileInfo* takeDataPtr() {
|
||||||
|
FmFileInfo* data = reinterpret_cast<FmFileInfo*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFileInfo* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFileInfo*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFileInfo*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
FileInfo& operator=(const FileInfo& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_file_info_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmFileInfo*>(fm_file_info_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
FileInfo& operator=(FileInfo&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFileInfo*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
bool canSetHidden(void) {
|
||||||
|
return fm_file_info_can_set_hidden(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool canSetIcon(void) {
|
||||||
|
return fm_file_info_can_set_icon(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool canSetName(void) {
|
||||||
|
return fm_file_info_can_set_name(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool canThumbnail(void) {
|
||||||
|
return fm_file_info_can_thumbnail(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dev_t getDev(void) {
|
||||||
|
return fm_file_info_get_dev(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gid_t getGid(void) {
|
||||||
|
return fm_file_info_get_gid(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uid_t getUid(void) {
|
||||||
|
return fm_file_info_get_uid(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getDispGroup() {
|
||||||
|
return fm_file_info_get_disp_group(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getFsId() {
|
||||||
|
return fm_file_info_get_fs_id(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
FmIcon* getIcon(void) {
|
||||||
|
return fm_file_info_get_icon(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t getCtime(void) {
|
||||||
|
return fm_file_info_get_ctime(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t getAtime(void) {
|
||||||
|
return fm_file_info_get_atime(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time_t getMtime(void) {
|
||||||
|
return fm_file_info_get_mtime(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char* getTarget() {
|
||||||
|
return fm_file_info_get_target(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getCollateKey() {
|
||||||
|
return fm_file_info_get_collate_key(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getCollateKeyNoCaseFold() {
|
||||||
|
return fm_file_info_get_collate_key_nocasefold(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getDesc() {
|
||||||
|
return fm_file_info_get_desc(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getDispMtime() {
|
||||||
|
return fm_file_info_get_disp_mtime(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isWritableDirectory(void) {
|
||||||
|
return fm_file_info_is_writable_directory(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isAccessible(void) {
|
||||||
|
return fm_file_info_is_accessible(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isExecutableType(void) {
|
||||||
|
return fm_file_info_is_executable_type(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isBackup(void) {
|
||||||
|
return fm_file_info_is_backup(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isHidden(void) {
|
||||||
|
return fm_file_info_is_hidden(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isUnknownType(void) {
|
||||||
|
return fm_file_info_is_unknown_type(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isDesktopEntry(void) {
|
||||||
|
return fm_file_info_is_desktop_entry(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isText(void) {
|
||||||
|
return fm_file_info_is_text(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isImage(void) {
|
||||||
|
return fm_file_info_is_image(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isMountable(void) {
|
||||||
|
return fm_file_info_is_mountable(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isShortcut(void) {
|
||||||
|
return fm_file_info_is_shortcut(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isSymlink(void) {
|
||||||
|
return fm_file_info_is_symlink(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isDir(void) {
|
||||||
|
return fm_file_info_is_dir(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmMimeType* getMimeType(void) {
|
||||||
|
return fm_file_info_get_mime_type(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isNative(void) {
|
||||||
|
return fm_file_info_is_native(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_t getMode(void) {
|
||||||
|
return fm_file_info_get_mode(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
goffset getBlocks(void) {
|
||||||
|
return fm_file_info_get_blocks(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
goffset getSize(void) {
|
||||||
|
return fm_file_info_get_size(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getDispSize() {
|
||||||
|
return fm_file_info_get_disp_size(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setIcon(GIcon* icon) {
|
||||||
|
fm_file_info_set_icon(dataPtr(), icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setDispName(const char* name) {
|
||||||
|
fm_file_info_set_disp_name(dataPtr(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setPath(FmPath* path) {
|
||||||
|
fm_file_info_set_path(dataPtr(), path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char* getName() {
|
||||||
|
return fm_file_info_get_name(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char* getDispName() {
|
||||||
|
return fm_file_info_get_disp_name(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmPath* getPath(void) {
|
||||||
|
return fm_file_info_get_path(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void update(FmFileInfo* src) {
|
||||||
|
fm_file_info_update(dataPtr(), src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static FileInfo newFromNativeFile(FmPath* path, const char* path_str, GError** err) {
|
||||||
|
return FileInfo::wrapPtr(fm_file_info_new_from_native_file(path, path_str, err));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool setFromNativeFile(const char* path, GError** err) {
|
||||||
|
return fm_file_info_set_from_native_file(dataPtr(), path, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setFromMenuCacheItem(struct _MenuCacheItem* item) {
|
||||||
|
fm_file_info_set_from_menu_cache_item(dataPtr(), item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static FileInfo newFromMenuCacheItem(FmPath* path, struct _MenuCacheItem* item) {
|
||||||
|
return FileInfo::wrapPtr(fm_file_info_new_from_menu_cache_item(path, item));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setFromGFileData(GFile* gf, GFileInfo* inf) {
|
||||||
|
fm_file_info_set_from_g_file_data(dataPtr(), gf, inf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static FileInfo newFromGFileData(GFile* gf, GFileInfo* inf, FmPath* path) {
|
||||||
|
return FileInfo::wrapPtr(fm_file_info_new_from_g_file_data(gf, inf, path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setFromGfileinfo(GFileInfo* inf) {
|
||||||
|
fm_file_info_set_from_gfileinfo(dataPtr(), inf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static FileInfo newFromGfileinfo(FmPath* path, GFileInfo* inf) {
|
||||||
|
return FileInfo::wrapPtr(fm_file_info_new_from_gfileinfo(path, inf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmFileInfo* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_FILE_INFO_H__
|
@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_FILE_INFO_JOB_H__
|
||||||
|
#define __LIBFM_QT_FM_FILE_INFO_JOB_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
#include "job.h"
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API FileInfoJob: public Job {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
FileInfoJob(FmPathList* files_to_query, FmFileInfoJobFlags flags) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(fm_file_info_job_new(files_to_query, flags));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
FileInfoJob() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileInfoJob(FmFileInfoJob* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
FileInfoJob(const FileInfoJob& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
FileInfoJob(FileInfoJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static FileInfoJob wrapPtr(FmFileInfoJob* dataPtr) {
|
||||||
|
FileInfoJob obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFileInfoJob* takeDataPtr() {
|
||||||
|
FmFileInfoJob* data = reinterpret_cast<FmFileInfoJob*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFileInfoJob* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFileInfoJob*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFileInfoJob*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
FileInfoJob& operator=(const FileInfoJob& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
FileInfoJob& operator=(FileInfoJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
FmPath* getCurrent(void) {
|
||||||
|
return fm_file_info_job_get_current(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void addGfile(GFile* gf) {
|
||||||
|
fm_file_info_job_add_gfile(dataPtr(), gf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void add(FmPath* path) {
|
||||||
|
fm_file_info_job_add(dataPtr(), path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_FILE_INFO_JOB_H__
|
@ -0,0 +1,193 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_FILE_OPS_JOB_H__
|
||||||
|
#define __LIBFM_QT_FM_FILE_OPS_JOB_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
#include "job.h"
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API FileOpsJob: public Job {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
FileOpsJob(FmFileOpType type, FmPathList* files) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(fm_file_ops_job_new(type, files));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
FileOpsJob() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileOpsJob(FmFileOpsJob* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
FileOpsJob(const FileOpsJob& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
FileOpsJob(FileOpsJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static FileOpsJob wrapPtr(FmFileOpsJob* dataPtr) {
|
||||||
|
FileOpsJob obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFileOpsJob* takeDataPtr() {
|
||||||
|
FmFileOpsJob* data = reinterpret_cast<FmFileOpsJob*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFileOpsJob* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFileOpsJob*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFileOpsJob*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
FileOpsJob& operator=(const FileOpsJob& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
FileOpsJob& operator=(FileOpsJob&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
FmFileOpOption getOptions(void) {
|
||||||
|
return fm_file_ops_job_get_options(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmFileOpOption askRename(GFile* src, GFileInfo* src_inf, GFile* dest, GFile** new_dest) {
|
||||||
|
return fm_file_ops_job_ask_rename(dataPtr(), src, src_inf, dest, new_dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void emitPercent(void) {
|
||||||
|
fm_file_ops_job_emit_percent(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void emitCurFile(const char* cur_file) {
|
||||||
|
fm_file_ops_job_emit_cur_file(dataPtr(), cur_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void emitPrepared(void) {
|
||||||
|
fm_file_ops_job_emit_prepared(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setTarget(const char* url) {
|
||||||
|
fm_file_ops_job_set_target(dataPtr(), url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setHidden(gboolean hidden) {
|
||||||
|
fm_file_ops_job_set_hidden(dataPtr(), hidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setIcon(GIcon* icon) {
|
||||||
|
fm_file_ops_job_set_icon(dataPtr(), icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setDisplayName(const char* name) {
|
||||||
|
fm_file_ops_job_set_display_name(dataPtr(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setChown(gint uid, gint gid) {
|
||||||
|
fm_file_ops_job_set_chown(dataPtr(), uid, gid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setChmod(mode_t new_mode, mode_t new_mode_mask) {
|
||||||
|
fm_file_ops_job_set_chmod(dataPtr(), new_mode, new_mode_mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setRecursive(gboolean recursive) {
|
||||||
|
fm_file_ops_job_set_recursive(dataPtr(), recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmPath* getDest(void) {
|
||||||
|
return fm_file_ops_job_get_dest(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setDest(FmPath* dest) {
|
||||||
|
fm_file_ops_job_set_dest(dataPtr(), dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_FILE_OPS_JOB_H__
|
@ -0,0 +1,228 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_FOLDER_H__
|
||||||
|
#define __LIBFM_QT_FM_FOLDER_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Folder {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Folder() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Folder(FmFolder* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Folder(const Folder& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Folder(Folder&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~Folder() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Folder wrapPtr(FmFolder* dataPtr) {
|
||||||
|
Folder obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFolder* takeDataPtr() {
|
||||||
|
FmFolder* data = reinterpret_cast<FmFolder*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFolder* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFolder*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFolder*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Folder& operator=(const Folder& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Folder& operator=(Folder&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
bool makeDirectory(const char* name, GError** error) {
|
||||||
|
return fm_folder_make_directory(dataPtr(), name, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void queryFilesystemInfo(void) {
|
||||||
|
fm_folder_query_filesystem_info(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool getFilesystemInfo(guint64* total_size, guint64* free_size) {
|
||||||
|
return fm_folder_get_filesystem_info(dataPtr(), total_size, free_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reload(void) {
|
||||||
|
fm_folder_reload(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isIncremental(void) {
|
||||||
|
return fm_folder_is_incremental(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isValid(void) {
|
||||||
|
return fm_folder_is_valid(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isLoaded(void) {
|
||||||
|
return fm_folder_is_loaded(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmFileInfo* getFileByName(const char* name) {
|
||||||
|
return fm_folder_get_file_by_name(dataPtr(), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isEmpty(void) {
|
||||||
|
return fm_folder_is_empty(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmFileInfoList* getFiles(void) {
|
||||||
|
return fm_folder_get_files(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmPath* getPath(void) {
|
||||||
|
return fm_folder_get_path(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmFileInfo* getInfo(void) {
|
||||||
|
return fm_folder_get_info(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void unblockUpdates(void) {
|
||||||
|
fm_folder_unblock_updates(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void blockUpdates(void) {
|
||||||
|
fm_folder_block_updates(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Folder findByPath(FmPath* path) {
|
||||||
|
return Folder::wrapPtr(fm_folder_find_by_path(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Folder fromUri(const char* uri) {
|
||||||
|
return Folder::wrapPtr(fm_folder_from_uri(uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Folder fromPathName(const char* path) {
|
||||||
|
return Folder::wrapPtr(fm_folder_from_path_name(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Folder fromGfile(GFile* gf) {
|
||||||
|
return Folder::wrapPtr(fm_folder_from_gfile(gf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Folder fromPath(FmPath* path) {
|
||||||
|
return Folder::wrapPtr(fm_folder_from_path(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_FOLDER_H__
|
@ -0,0 +1,198 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_FOLDER_CONFIG_H__
|
||||||
|
#define __LIBFM_QT_FM_FOLDER_CONFIG_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API FolderConfig {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
FolderConfig(FmPath* path) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFolderConfig*>(fm_folder_config_open(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
FolderConfig() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
FolderConfig(FolderConfig&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFolderConfig*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~FolderConfig() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_folder_config_close(dataPtr_, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static FolderConfig wrapPtr(FmFolderConfig* dataPtr) {
|
||||||
|
FolderConfig obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmFolderConfig*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmFolderConfig* takeDataPtr() {
|
||||||
|
FmFolderConfig* data = reinterpret_cast<FmFolderConfig*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmFolderConfig* dataPtr() {
|
||||||
|
return reinterpret_cast<FmFolderConfig*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmFolderConfig*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
FolderConfig& operator=(FolderConfig&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmFolderConfig*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
static void saveCache(void ) {
|
||||||
|
fm_folder_config_save_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void purge(void) {
|
||||||
|
fm_folder_config_purge(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void removeKey(const char* key) {
|
||||||
|
fm_folder_config_remove_key(dataPtr(), key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setStringList(const char* key, const gchar * const list[], gsize length) {
|
||||||
|
fm_folder_config_set_string_list(dataPtr(), key, list, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setString(const char* key, const char* string) {
|
||||||
|
fm_folder_config_set_string(dataPtr(), key, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setBoolean(const char* key, gboolean val) {
|
||||||
|
fm_folder_config_set_boolean(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setDouble(const char* key, gdouble val) {
|
||||||
|
fm_folder_config_set_double(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setUint64(const char* key, guint64 val) {
|
||||||
|
fm_folder_config_set_uint64(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setInteger(const char* key, gint val) {
|
||||||
|
fm_folder_config_set_integer(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char** getStringList(const char* key, gsize* length) {
|
||||||
|
return fm_folder_config_get_string_list(dataPtr(), key, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char* getString(const char* key) {
|
||||||
|
return fm_folder_config_get_string(dataPtr(), key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool getBoolean(const char* key, gboolean* val) {
|
||||||
|
return fm_folder_config_get_boolean(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool getDouble(const char* key, gdouble* val) {
|
||||||
|
return fm_folder_config_get_double(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool getUint64(const char* key, guint64* val) {
|
||||||
|
return fm_folder_config_get_uint64(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool getInteger(const char* key, gint* val) {
|
||||||
|
return fm_folder_config_get_integer(dataPtr(), key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isEmpty(void) {
|
||||||
|
return fm_folder_config_is_empty(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// the wrapped object cannot be copied.
|
||||||
|
private:
|
||||||
|
FolderConfig(const FolderConfig& other) = delete;
|
||||||
|
FolderConfig& operator=(const FolderConfig& other) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmFolderConfig* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_FOLDER_CONFIG_H__
|
@ -0,0 +1,168 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_ICON_H__
|
||||||
|
#define __LIBFM_QT_FM_ICON_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Icon {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Icon() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Icon(FmIcon* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmIcon*>(fm_icon_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Icon(const Icon& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmIcon*>(fm_icon_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Icon(Icon&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmIcon*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~Icon() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_icon_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Icon wrapPtr(FmIcon* dataPtr) {
|
||||||
|
Icon obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmIcon*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmIcon* takeDataPtr() {
|
||||||
|
FmIcon* data = reinterpret_cast<FmIcon*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmIcon* dataPtr() {
|
||||||
|
return reinterpret_cast<FmIcon*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmIcon*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Icon& operator=(const Icon& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_icon_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmIcon*>(fm_icon_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Icon& operator=(Icon&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmIcon*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
static void unloadCache( ) {
|
||||||
|
fm_icon_unload_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void resetUserDataCache(GQuark quark) {
|
||||||
|
fm_icon_reset_user_data_cache(quark);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void unloadUserDataCache( ) {
|
||||||
|
fm_icon_unload_user_data_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void setUserDataDestroy(GDestroyNotify func) {
|
||||||
|
fm_icon_set_user_data_destroy(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setUserData(gpointer user_data) {
|
||||||
|
fm_icon_set_user_data(dataPtr(), user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gpointer getUserData(void) {
|
||||||
|
return fm_icon_get_user_data(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Icon fromName(const char* name) {
|
||||||
|
return Icon::wrapPtr(fm_icon_from_name(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Icon fromGicon(GIcon* gicon) {
|
||||||
|
return Icon::wrapPtr(fm_icon_from_gicon(gicon));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmIcon* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_ICON_H__
|
@ -0,0 +1,225 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_JOB_H__
|
||||||
|
#define __LIBFM_QT_FM_JOB_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Job {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Job() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Job(FmJob* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Job(const Job& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Job(Job&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~Job() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Job wrapPtr(FmJob* dataPtr) {
|
||||||
|
Job obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmJob* takeDataPtr() {
|
||||||
|
FmJob* data = reinterpret_cast<FmJob*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmJob* dataPtr() {
|
||||||
|
return reinterpret_cast<FmJob*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmJob*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Job& operator=(const Job& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Job& operator=(Job&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void resume(void) {
|
||||||
|
fm_job_resume(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool pause(void) {
|
||||||
|
return fm_job_pause(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int askValist(const char* question, va_list options) {
|
||||||
|
return fm_job_ask_valist(dataPtr(), question, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int askv(const char* question, gchar* const* options) {
|
||||||
|
return fm_job_askv(dataPtr(), question, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ask(const char* question, ... ) {
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
va_list args;
|
||||||
|
va_start (args, question);
|
||||||
|
ret = fm_job_ask_valist(dataPtr(), question, args);
|
||||||
|
va_end (args);
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmJobErrorAction emitError(GError* err, FmJobErrorSeverity severity) {
|
||||||
|
return fm_job_emit_error(dataPtr(), err, severity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void finish(void) {
|
||||||
|
fm_job_finish(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setCancellable(GCancellable* cancellable) {
|
||||||
|
fm_job_set_cancellable(dataPtr(), cancellable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GCancellable* getCancellable(void) {
|
||||||
|
return fm_job_get_cancellable(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void initCancellable(void) {
|
||||||
|
fm_job_init_cancellable(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gpointer callMainThread(FmJobCallMainThreadFunc func, gpointer user_data) {
|
||||||
|
return fm_job_call_main_thread(dataPtr(), func, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cancel(void) {
|
||||||
|
fm_job_cancel(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool runSyncWithMainloop(void) {
|
||||||
|
return fm_job_run_sync_with_mainloop(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool runSync(void) {
|
||||||
|
return fm_job_run_sync(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool runAsync(void) {
|
||||||
|
return fm_job_run_async(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isRunning(void) {
|
||||||
|
return fm_job_is_running(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isCancelled(void) {
|
||||||
|
return fm_job_is_cancelled(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_JOB_H__
|
@ -0,0 +1,153 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_LIST_H__
|
||||||
|
#define __LIBFM_QT_FM_LIST_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API List {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
List(FmListFuncs* funcs) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmList*>(fm_list_new(funcs));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
List() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List(FmList* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmList*>(fm_list_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
List(const List& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmList*>(fm_list_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
List(List&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmList*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~List() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_list_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static List wrapPtr(FmList* dataPtr) {
|
||||||
|
List obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmList*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmList* takeDataPtr() {
|
||||||
|
FmList* data = reinterpret_cast<FmList*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmList* dataPtr() {
|
||||||
|
return reinterpret_cast<FmList*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmList*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
List& operator=(const List& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_list_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmList*>(fm_list_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
List& operator=(List&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmList*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void deleteLink(GList* l_) {
|
||||||
|
fm_list_delete_link(dataPtr(), l_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void removeAll(gpointer data) {
|
||||||
|
fm_list_remove_all(dataPtr(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void remove(gpointer data) {
|
||||||
|
fm_list_remove(dataPtr(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void clear(void) {
|
||||||
|
fm_list_clear(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmList* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_LIST_H__
|
@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_MIME_TYPE_H__
|
||||||
|
#define __LIBFM_QT_FM_MIME_TYPE_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API MimeType {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
MimeType() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MimeType(FmMimeType* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmMimeType*>(fm_mime_type_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
MimeType(const MimeType& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmMimeType*>(fm_mime_type_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
MimeType(MimeType&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmMimeType*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~MimeType() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_mime_type_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static MimeType wrapPtr(FmMimeType* dataPtr) {
|
||||||
|
MimeType obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmMimeType*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmMimeType* takeDataPtr() {
|
||||||
|
FmMimeType* data = reinterpret_cast<FmMimeType*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmMimeType* dataPtr() {
|
||||||
|
return reinterpret_cast<FmMimeType*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmMimeType*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
MimeType& operator=(const MimeType& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_mime_type_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmMimeType*>(fm_mime_type_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
MimeType& operator=(MimeType&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmMimeType*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void removeThumbnailer(gpointer thumbnailer) {
|
||||||
|
fm_mime_type_remove_thumbnailer(dataPtr(), thumbnailer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void addThumbnailer(gpointer thumbnailer) {
|
||||||
|
fm_mime_type_add_thumbnailer(dataPtr(), thumbnailer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GList* getThumbnailersList(void) {
|
||||||
|
return fm_mime_type_get_thumbnailers_list(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmIcon* getIcon(void) {
|
||||||
|
return fm_mime_type_get_icon(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MimeType fromName(const char* type) {
|
||||||
|
return MimeType::wrapPtr(fm_mime_type_from_name(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MimeType fromNativeFile(const char* file_path, const char* base_name, struct stat* pstat) {
|
||||||
|
return MimeType::wrapPtr(fm_mime_type_from_native_file(file_path, base_name, pstat));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static MimeType fromFileName(const char* ufile_name) {
|
||||||
|
return MimeType::wrapPtr(fm_mime_type_from_file_name(ufile_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmMimeType* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_MIME_TYPE_H__
|
@ -0,0 +1,192 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_NAV_HISTORY_H__
|
||||||
|
#define __LIBFM_QT_FM_NAV_HISTORY_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API NavHistory {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
NavHistory(void ) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(fm_nav_history_new());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NavHistory(FmNavHistory* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
NavHistory(const NavHistory& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
NavHistory(NavHistory&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~NavHistory() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static NavHistory wrapPtr(FmNavHistory* dataPtr) {
|
||||||
|
NavHistory obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmNavHistory* takeDataPtr() {
|
||||||
|
FmNavHistory* data = reinterpret_cast<FmNavHistory*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmNavHistory* dataPtr() {
|
||||||
|
return reinterpret_cast<FmNavHistory*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmNavHistory*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
NavHistory& operator=(const NavHistory& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
NavHistory& operator=(NavHistory&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
void setMax(guint num) {
|
||||||
|
fm_nav_history_set_max(dataPtr(), num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void clear(void) {
|
||||||
|
fm_nav_history_clear(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chdir(FmPath* path, gint old_scroll_pos) {
|
||||||
|
fm_nav_history_chdir(dataPtr(), path, old_scroll_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool canBack(void) {
|
||||||
|
return fm_nav_history_can_back(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int getScrollPos(void) {
|
||||||
|
return fm_nav_history_get_scroll_pos(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmPath* goTo(guint n, gint old_scroll_pos) {
|
||||||
|
return fm_nav_history_go_to(dataPtr(), n, old_scroll_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmPath* getNthPath(guint n) {
|
||||||
|
return fm_nav_history_get_nth_path(dataPtr(), n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int getCurIndex(void) {
|
||||||
|
return fm_nav_history_get_cur_index(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void jump(GList* l, int old_scroll_pos) {
|
||||||
|
fm_nav_history_jump(dataPtr(), l, old_scroll_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void forward(int old_scroll_pos) {
|
||||||
|
fm_nav_history_forward(dataPtr(), old_scroll_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool canForward(void) {
|
||||||
|
return fm_nav_history_can_forward(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void back(int old_scroll_pos) {
|
||||||
|
fm_nav_history_back(dataPtr(), old_scroll_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_NAV_HISTORY_H__
|
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_TEMPLATES_H__
|
||||||
|
#define __LIBFM_QT_FM_TEMPLATES_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Template {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Template() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Template(FmTemplate* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Template(const Template& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Template(Template&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~Template() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Template wrapPtr(FmTemplate* dataPtr) {
|
||||||
|
Template obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmTemplate* takeDataPtr() {
|
||||||
|
FmTemplate* data = reinterpret_cast<FmTemplate*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmTemplate* dataPtr() {
|
||||||
|
return reinterpret_cast<FmTemplate*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmTemplate*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Template& operator=(const Template& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Template& operator=(Template&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
bool createFile(GFile* path, GError** error, gboolean run_default) {
|
||||||
|
return fm_template_create_file(dataPtr(), path, error, run_default);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isDirectory(void) {
|
||||||
|
return fm_template_is_directory(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmIcon* getIcon(void) {
|
||||||
|
return fm_template_get_icon(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FmMimeType* getMimeType(void) {
|
||||||
|
return fm_template_get_mime_type(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GList* listAll(gboolean user_only) {
|
||||||
|
return fm_template_list_all(user_only);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_TEMPLATES_H__
|
@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_TERMINAL_H__
|
||||||
|
#define __LIBFM_QT_FM_TERMINAL_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Terminal {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Terminal() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Terminal(FmTerminal* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<GObject*>(g_object_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Terminal(const Terminal& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Terminal(Terminal&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
virtual ~Terminal() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Terminal wrapPtr(FmTerminal* dataPtr) {
|
||||||
|
Terminal obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<GObject*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmTerminal* takeDataPtr() {
|
||||||
|
FmTerminal* data = reinterpret_cast<FmTerminal*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmTerminal* dataPtr() {
|
||||||
|
return reinterpret_cast<FmTerminal*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmTerminal*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Terminal& operator=(const Terminal& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
g_object_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<GObject*>(g_object_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Terminal& operator=(Terminal&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<GObject*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
static bool launch(const gchar* dir, GError** error) {
|
||||||
|
return fm_terminal_launch(dir, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Terminal dupDefault(GError** error) {
|
||||||
|
return Terminal::wrapPtr(fm_terminal_dup_default(error));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// automatic type casting for GObject
|
||||||
|
operator GObject*() {
|
||||||
|
return reinterpret_cast<GObject*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GObject* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_TERMINAL_H__
|
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBFM_QT_FM_THUMBNAILER_H__
|
||||||
|
#define __LIBFM_QT_FM_THUMBNAILER_H__
|
||||||
|
|
||||||
|
#include <libfm/fm.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "libfmqtglobals.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Fm {
|
||||||
|
|
||||||
|
|
||||||
|
class LIBFM_QT_API Thumbnailer {
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// default constructor
|
||||||
|
Thumbnailer() {
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Thumbnailer(FmThumbnailer* dataPtr){
|
||||||
|
dataPtr_ = dataPtr != nullptr ? reinterpret_cast<FmThumbnailer*>(fm_thumbnailer_ref(dataPtr)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
Thumbnailer(const Thumbnailer& other) {
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmThumbnailer*>(fm_thumbnailer_ref(other.dataPtr_)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move constructor
|
||||||
|
Thumbnailer(Thumbnailer&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmThumbnailer*>(other.takeDataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
~Thumbnailer() {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_thumbnailer_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a wrapper for the data pointer without increasing the reference count
|
||||||
|
static Thumbnailer wrapPtr(FmThumbnailer* dataPtr) {
|
||||||
|
Thumbnailer obj;
|
||||||
|
obj.dataPtr_ = reinterpret_cast<FmThumbnailer*>(dataPtr);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disown the managed data pointer
|
||||||
|
FmThumbnailer* takeDataPtr() {
|
||||||
|
FmThumbnailer* data = reinterpret_cast<FmThumbnailer*>(dataPtr_);
|
||||||
|
dataPtr_ = nullptr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the raw pointer wrapped
|
||||||
|
FmThumbnailer* dataPtr() {
|
||||||
|
return reinterpret_cast<FmThumbnailer*>(dataPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator FmThumbnailer*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
// automatic type casting
|
||||||
|
operator void*() {
|
||||||
|
return dataPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy assignment
|
||||||
|
Thumbnailer& operator=(const Thumbnailer& other) {
|
||||||
|
if(dataPtr_ != nullptr) {
|
||||||
|
fm_thumbnailer_unref(dataPtr_);
|
||||||
|
}
|
||||||
|
dataPtr_ = other.dataPtr_ != nullptr ? reinterpret_cast<FmThumbnailer*>(fm_thumbnailer_ref(other.dataPtr_)) : nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// move assignment
|
||||||
|
Thumbnailer& operator=(Thumbnailer&& other) {
|
||||||
|
dataPtr_ = reinterpret_cast<FmThumbnailer*>(other.takeDataPtr());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNull() {
|
||||||
|
return (dataPtr_ == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
|
||||||
|
static void checkUpdate( ) {
|
||||||
|
fm_thumbnailer_check_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void free(void) {
|
||||||
|
fm_thumbnailer_free(dataPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool launchForUri(const char* uri, const char* output_file, guint size) {
|
||||||
|
return fm_thumbnailer_launch_for_uri(dataPtr(), uri, output_file, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GPid launchForUriAsync(const char* uri, const char* output_file, guint size, GError** error) {
|
||||||
|
return fm_thumbnailer_launch_for_uri_async(dataPtr(), uri, output_file, size, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char* commandForUri(const char* uri, const char* output_file, guint size) {
|
||||||
|
return fm_thumbnailer_command_for_uri(dataPtr(), uri, output_file, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Thumbnailer newFromKeyfile(const char* id, GKeyFile* kf) {
|
||||||
|
return Thumbnailer::wrapPtr(fm_thumbnailer_new_from_keyfile(id, kf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
FmThumbnailer* dataPtr_; // data pointer for the underlying C struct
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LIBFM_QT_FM_THUMBNAILER_H__
|
Loading…
Reference in new issue