Adding upstream version 0.12.0.
Signed-off-by: Alf Gaida <agaida@siduction.org>
This commit is contained in:
parent
470f3cea46
commit
ce1f1c5172
88
CHANGELOG
88
CHANGELOG
@ -1,7 +1,93 @@
|
|||||||
|
|
||||||
pcmanfm-qt-0.11.3 / 2017-01-14
|
pcmanfm-qt-0.12.0 / 2017-10-21
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* Set Version
|
||||||
|
* removed dangeling symlink to debian dir
|
||||||
|
* Text eliding, long texts and newline
|
||||||
|
* Update status message appropriately
|
||||||
|
* fixup...use static const
|
||||||
|
* Fix icon sizes
|
||||||
|
* Just fixed my typo in search settings (#574)
|
||||||
|
* Lithuanian translation
|
||||||
|
* Lithuanian translation
|
||||||
|
* Disable menubar actions that cannot be used
|
||||||
|
* Save and restore search settings
|
||||||
|
* Don't export github templates
|
||||||
|
* Wallpaper Slide Show
|
||||||
|
* Inline renaming with F2 for detailed list view (#554)
|
||||||
|
* Inline renaming with F2
|
||||||
|
* Fix showing/hiding hidden files (#535)
|
||||||
|
* Don't select or scroll to child folder on reloading (#536)
|
||||||
|
* Replace customized DesktopItemDelegate hacks with the standard Fm::FolderItemDelegate provided by libfm-qt. (#529)
|
||||||
|
* liblxqt version make no sense here
|
||||||
|
* Copied issue template
|
||||||
|
* Fix Ctrl+A on desktop (#526)
|
||||||
|
* Update statusbar size info when needed
|
||||||
|
* Drops Qt5Core_VERSION_STRING
|
||||||
|
* set Qt::AA_UseHighDpiPixmaps to true
|
||||||
|
* Fix jerky desktop items
|
||||||
|
* Place dropped item at drop position (#504)
|
||||||
|
* Make custom pos checkbox work for multiple items (#499)
|
||||||
|
* Fix crash on removing desktop items with custom position (#496)
|
||||||
|
* Fix cursor on hovering desktop items
|
||||||
|
* Fix pressing RETURN in location bar
|
||||||
|
* Remove the old tilde replacement
|
||||||
|
* Included LXQTConfigVars
|
||||||
|
* Fixed config/CMakeLists.txt - removed not needed things
|
||||||
|
* Added merged autostart and config to CMakeLists.txt
|
||||||
|
* Updated *_da.desktop files and removed *_da_DK.desktop files
|
||||||
|
* Update desktop entries and Replace fr_FR by fr
|
||||||
|
* lxqt-rc.xml: Change default config install path
|
||||||
|
* PCManFM-Qt: Update default wallpaper (#49)
|
||||||
|
* Merge pull request #48 from lxde/pcmanfm-qt-sort-order
|
||||||
|
* Settings Openbox updated.
|
||||||
|
* Default key shortcuts added to lxqt-globalkeysd.
|
||||||
|
* Use lxqt-sudo in pcmanfm-qt config file by default.
|
||||||
|
* Update Greek translation (el) Remove country variant from language code
|
||||||
|
* CMake: Adds Runtime and Devel install COMPONENTs
|
||||||
|
* Coding style changes
|
||||||
|
* Adds double quotes to everything that may break
|
||||||
|
* Updates the build system to use the Targets infrastructure
|
||||||
|
* adjust default wallpaper to default theme
|
||||||
|
* Drops hardcoded /etc/xdg paths
|
||||||
|
* Updated german translation, replaced Qt4 by Qt in all xsession/translations
|
||||||
|
* Updates translations infrastructure
|
||||||
|
* Update the required minimum cmake version
|
||||||
|
* remove dead template lines switch OnlyShowIn from Razor -> LXQt stringchanges LxQt -> LXQt
|
||||||
|
* Add session.conf and windowmanagers.conf.
|
||||||
|
* Support lxqt-session and add necessary xdg autostart desktop entry files.
|
||||||
|
* Rename dirs and replace razor with lxqt. Install lxqt.conf to /etc/xdg/lxqt and provide theme config.
|
||||||
|
* Properly set default wallpaper for pcmanfm-qt. Comment out openbox config handling in startlxde-qt since it's not needed.
|
||||||
|
* Remove custom openbox config file in desktop.conf temporarily until lxsession is fixed.
|
||||||
|
* Fix file paths, replacing razor with lxqt. * Remove Alt+F2 and Ctrl+Esc from openbox config file to avoid conflicts with lxqt-panel & lxqt-globalkeys.
|
||||||
|
* Add default configuration files for lxde-qt session.
|
||||||
|
* Use const iterators (Fix a FTBFS in debug mode) (#483)
|
||||||
|
* Fixed desktop items movement
|
||||||
|
* Fixes some pedantic bugs
|
||||||
|
* Correct alignment of small icons on desktop
|
||||||
|
* Rename namespace Fm2 to Fm.
|
||||||
|
* Remove unused header includes.
|
||||||
|
* Fix a bug in correct tab page dir path which causes problems of file searching.
|
||||||
|
* Fix incorrect URI of application menu.
|
||||||
|
* Fix the broken folder reload.
|
||||||
|
* Fix incorrect title update of tabs.
|
||||||
|
* Add basic error handling when folder loading is failed.
|
||||||
|
* Port status message handling to the new libfm C++ API.
|
||||||
|
* Use Fm2::Path::homePath() API.
|
||||||
|
* Use the new libfm C++ terminal emulator APIs.
|
||||||
|
* Adopt to changes of libfm C++ APIs.
|
||||||
|
* Deprecate the use of Fm::Thumbnailer.
|
||||||
|
* Replace all NULL with C++ 11 nullptr.
|
||||||
|
* Initial port to the new C++ libfm API.
|
||||||
|
* DesktopWindow: Render tilled wallpaper manually
|
||||||
|
* Use const iterators
|
||||||
|
* Checks bookmarks iterators validity (#444)
|
||||||
|
|
||||||
|
0.11.3 / 2017-01-14
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Release 0.11.3: Update changelog
|
||||||
* remove 0.11.3 changelog entries
|
* remove 0.11.3 changelog entries
|
||||||
* Bump patch version
|
* Bump patch version
|
||||||
* Release 0.11.3: Update changelog
|
* Release 0.11.3: Update changelog
|
||||||
|
@ -6,12 +6,14 @@ if (POLICY CMP0063)
|
|||||||
cmake_policy (SET CMP0063 NEW)
|
cmake_policy (SET CMP0063 NEW)
|
||||||
endif (POLICY CMP0063)
|
endif (POLICY CMP0063)
|
||||||
|
|
||||||
|
# PcmanFm-Qt Version
|
||||||
set(PCMANFM_QT_VERSION_MAJOR 0)
|
set(PCMANFM_QT_VERSION_MAJOR 0)
|
||||||
set(PCMANFM_QT_VERSION_MINOR 11)
|
set(PCMANFM_QT_VERSION_MINOR 12)
|
||||||
set(PCMANFM_QT_VERSION_PATCH 3)
|
set(PCMANFM_QT_VERSION_PATCH 0)
|
||||||
|
|
||||||
set(PCMANFM_QT_VERSION ${PCMANFM_QT_VERSION_MAJOR}.${PCMANFM_QT_VERSION_MINOR}.${PCMANFM_QT_VERSION_PATCH})
|
set(PCMANFM_QT_VERSION ${PCMANFM_QT_VERSION_MAJOR}.${PCMANFM_QT_VERSION_MINOR}.${PCMANFM_QT_VERSION_PATCH})
|
||||||
|
|
||||||
set(LXQTBT_MINIMUM_VERSION "0.1.0")
|
set(LXQTBT_MINIMUM_VERSION "0.4.0")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
@ -22,10 +24,11 @@ find_package(Qt5X11Extras 5.2 REQUIRED)
|
|||||||
find_package(fm-qt REQUIRED)
|
find_package(fm-qt REQUIRED)
|
||||||
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
|
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
|
||||||
|
|
||||||
message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION_STRING}")
|
message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION}")
|
||||||
|
|
||||||
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
|
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
include(LXQtConfigVars)
|
||||||
include(LXQtTranslateTs)
|
include(LXQtTranslateTs)
|
||||||
include(LXQtTranslateDesktop)
|
include(LXQtTranslateDesktop)
|
||||||
include(LXQtCompilerSettings NO_POLICY_SCOPE)
|
include(LXQtCompilerSettings NO_POLICY_SCOPE)
|
||||||
@ -61,3 +64,7 @@ if(BUILD_DOCUMENTATION)
|
|||||||
)
|
)
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# merged from lxqt-common
|
||||||
|
add_subdirectory(autostart)
|
||||||
|
add_subdirectory(config)
|
||||||
|
17
autostart/CMakeLists.txt
Normal file
17
autostart/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
||||||
|
|
||||||
|
file(GLOB DESKTOP_FILES_IN *.desktop.in)
|
||||||
|
|
||||||
|
# Translations **********************************
|
||||||
|
lxqt_translate_desktop(DESKTOP_FILES
|
||||||
|
SOURCES
|
||||||
|
${DESKTOP_FILES_IN}
|
||||||
|
)
|
||||||
|
add_custom_target(autostart_desktop_files ALL DEPENDS ${DESKTOP_FILES})
|
||||||
|
#************************************************
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
${DESKTOP_FILES}
|
||||||
|
DESTINATION "${LXQT_ETC_XDG_DIR}/autostart"
|
||||||
|
COMPONENT Runtime
|
||||||
|
)
|
9
autostart/lxqt-desktop.desktop.in
Normal file
9
autostart/lxqt-desktop.desktop.in
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Desktop
|
||||||
|
Exec=pcmanfm-qt --desktop --profile=lxqt
|
||||||
|
TryExec=pcmanfm-qt
|
||||||
|
OnlyShowIn=LXQt;
|
||||||
|
X-LXQt-Module=true
|
||||||
|
|
||||||
|
#TRANSLATIONS_DIR=translations
|
2
autostart/translations/lxqt-desktop_ar.desktop
Normal file
2
autostart/translations/lxqt-desktop_ar.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[ar]=سطح المكتب
|
2
autostart/translations/lxqt-desktop_cs.desktop
Normal file
2
autostart/translations/lxqt-desktop_cs.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[cs]=Plocha
|
2
autostart/translations/lxqt-desktop_cs_CZ.desktop
Normal file
2
autostart/translations/lxqt-desktop_cs_CZ.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[cs_CZ]=Plocha
|
2
autostart/translations/lxqt-desktop_da.desktop
Normal file
2
autostart/translations/lxqt-desktop_da.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[da]=Skrivebord
|
2
autostart/translations/lxqt-desktop_de.desktop
Normal file
2
autostart/translations/lxqt-desktop_de.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[de]=Arbeitsfläche
|
2
autostart/translations/lxqt-desktop_el.desktop
Normal file
2
autostart/translations/lxqt-desktop_el.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[el]=Επιφάνεια εργασίας
|
2
autostart/translations/lxqt-desktop_eo.desktop
Normal file
2
autostart/translations/lxqt-desktop_eo.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[eo]=Labortablo
|
2
autostart/translations/lxqt-desktop_es.desktop
Normal file
2
autostart/translations/lxqt-desktop_es.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[es]=Escritorio
|
2
autostart/translations/lxqt-desktop_es_VE.desktop
Normal file
2
autostart/translations/lxqt-desktop_es_VE.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[es_VE]=Escritorio
|
2
autostart/translations/lxqt-desktop_eu.desktop
Normal file
2
autostart/translations/lxqt-desktop_eu.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[eu]=Mahaigaina
|
2
autostart/translations/lxqt-desktop_fi.desktop
Normal file
2
autostart/translations/lxqt-desktop_fi.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[fi]=Työpöytä
|
2
autostart/translations/lxqt-desktop_fr.desktop
Normal file
2
autostart/translations/lxqt-desktop_fr.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[fr]=Bureau
|
2
autostart/translations/lxqt-desktop_hu.desktop
Normal file
2
autostart/translations/lxqt-desktop_hu.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[hu]=Asztal
|
2
autostart/translations/lxqt-desktop_ia.desktop
Normal file
2
autostart/translations/lxqt-desktop_ia.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[ia]=Scriptorio
|
2
autostart/translations/lxqt-desktop_it_IT.desktop
Normal file
2
autostart/translations/lxqt-desktop_it_IT.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[it_IT]=Desktop
|
2
autostart/translations/lxqt-desktop_ja.desktop
Normal file
2
autostart/translations/lxqt-desktop_ja.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[ja]=デスクトップ
|
2
autostart/translations/lxqt-desktop_lt.desktop
Normal file
2
autostart/translations/lxqt-desktop_lt.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[lt]=Darbalaukis
|
2
autostart/translations/lxqt-desktop_nl.desktop
Normal file
2
autostart/translations/lxqt-desktop_nl.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[nl]=Bureaublad
|
2
autostart/translations/lxqt-desktop_pl_PL.desktop
Normal file
2
autostart/translations/lxqt-desktop_pl_PL.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[pl_PL]=Pulpit
|
2
autostart/translations/lxqt-desktop_pt.desktop
Normal file
2
autostart/translations/lxqt-desktop_pt.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[pt]=Área de trabalho
|
2
autostart/translations/lxqt-desktop_pt_BR.desktop
Normal file
2
autostart/translations/lxqt-desktop_pt_BR.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[pt_BR]=Área de trabalho
|
2
autostart/translations/lxqt-desktop_ro_RO.desktop
Normal file
2
autostart/translations/lxqt-desktop_ro_RO.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[ro_RO]=Desktop
|
2
autostart/translations/lxqt-desktop_ru.desktop
Normal file
2
autostart/translations/lxqt-desktop_ru.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[ru]=Pабочий стол
|
2
autostart/translations/lxqt-desktop_ru_RU.desktop
Normal file
2
autostart/translations/lxqt-desktop_ru_RU.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[ru_RU]=Рабочий стол
|
2
autostart/translations/lxqt-desktop_sl.desktop
Normal file
2
autostart/translations/lxqt-desktop_sl.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[sl]=Namizje
|
2
autostart/translations/lxqt-desktop_th_TH.desktop
Normal file
2
autostart/translations/lxqt-desktop_th_TH.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[th_TH]=เดสก์ท็อป
|
2
autostart/translations/lxqt-desktop_tr.desktop
Normal file
2
autostart/translations/lxqt-desktop_tr.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[tr]=Masaüstü
|
2
autostart/translations/lxqt-desktop_uk.desktop
Normal file
2
autostart/translations/lxqt-desktop_uk.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[uk]=Стільниця
|
2
autostart/translations/lxqt-desktop_zh_CN.desktop
Normal file
2
autostart/translations/lxqt-desktop_zh_CN.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[zh_CN]=桌面
|
2
autostart/translations/lxqt-desktop_zh_TW.desktop
Normal file
2
autostart/translations/lxqt-desktop_zh_TW.desktop
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Translations
|
||||||
|
Name[zh_TW]=桌面
|
8
config/CMakeLists.txt
Normal file
8
config/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# install default config files to /etc/xdg
|
||||||
|
|
||||||
|
configure_file(pcmanfm-qt/lxqt/settings.conf.in pcmanfm-qt/lxqt/settings.conf @ONLY)
|
||||||
|
install(FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pcmanfm-qt/lxqt/settings.conf"
|
||||||
|
DESTINATION "${LXQT_ETC_XDG_DIR}/pcmanfm-qt/lxqt"
|
||||||
|
COMPONENT Runtime
|
||||||
|
)
|
53
config/pcmanfm-qt/lxqt/settings.conf.in
Normal file
53
config/pcmanfm-qt/lxqt/settings.conf.in
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
[System]
|
||||||
|
IconThemeName=elementary
|
||||||
|
SuCommand=lxqt-sudo %s
|
||||||
|
TerminalCommand=
|
||||||
|
Archiver=file-roller
|
||||||
|
SIUnit=false
|
||||||
|
TerminalDirCommand=xterm
|
||||||
|
TerminalExecCommand=xterm -e %s
|
||||||
|
|
||||||
|
[Behavior]
|
||||||
|
BookmarkOpenMethod=0
|
||||||
|
UseTrash=true
|
||||||
|
SingleClick=false
|
||||||
|
ConfirmDelete=true
|
||||||
|
|
||||||
|
[Desktop]
|
||||||
|
WallpaperMode=stretch
|
||||||
|
Wallpaper=@LXQT_SHARE_DIR@/themes/frost/lxqt-origami-light.png
|
||||||
|
BgColor=#000000
|
||||||
|
FgColor=#ffffff
|
||||||
|
ShadowColor=#000000
|
||||||
|
ShowHidden=false
|
||||||
|
SortOrder=ascending
|
||||||
|
SortColumn=name
|
||||||
|
Font="Sans Serif,10,-1,5,50,0,0,0,0,0"
|
||||||
|
|
||||||
|
[Volume]
|
||||||
|
MountOnStartup=true
|
||||||
|
MountRemovable=true
|
||||||
|
AutoRun=true
|
||||||
|
|
||||||
|
[FolderView]
|
||||||
|
Mode=icon
|
||||||
|
ShowHidden=false
|
||||||
|
SortOrder=ascending
|
||||||
|
SortColumn=name
|
||||||
|
BigIconSize=48
|
||||||
|
SmallIconSize=24
|
||||||
|
SidePaneIconSize=24
|
||||||
|
ThumbnailIconSize=128
|
||||||
|
|
||||||
|
[Window]
|
||||||
|
Width=640
|
||||||
|
Height=480
|
||||||
|
AlwaysShowTabs=false
|
||||||
|
ShowTabClose=true
|
||||||
|
SplitterPos=150
|
||||||
|
SidePaneMode=0
|
||||||
|
|
||||||
|
[Thumbnail]
|
||||||
|
ShowThumbnails=true
|
||||||
|
MaxThumbnailFileSize=4096
|
||||||
|
ThumbnailLocalFilesOnly=true
|
@ -4,13 +4,13 @@ set(pcmanfm_SRCS
|
|||||||
mainwindow.cpp
|
mainwindow.cpp
|
||||||
tabpage.cpp
|
tabpage.cpp
|
||||||
tabbar.cpp
|
tabbar.cpp
|
||||||
|
statusbar.cpp
|
||||||
view.cpp
|
view.cpp
|
||||||
launcher.cpp
|
launcher.cpp
|
||||||
preferencesdialog.cpp
|
preferencesdialog.cpp
|
||||||
xdgdir.cpp
|
xdgdir.cpp
|
||||||
desktoppreferencesdialog.cpp
|
desktoppreferencesdialog.cpp
|
||||||
desktopwindow.cpp
|
desktopwindow.cpp
|
||||||
desktopitemdelegate.cpp
|
|
||||||
autorundialog.cpp
|
autorundialog.cpp
|
||||||
connectserverdialog.cpp
|
connectserverdialog.cpp
|
||||||
settings.cpp
|
settings.cpp
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,9 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#include <libfm-qt/core/filepath.h>
|
||||||
|
#include <libfm-qt/core/fileinfo.h>
|
||||||
|
|
||||||
class QScreen;
|
class QScreen;
|
||||||
|
|
||||||
class QFileSystemWatcher;
|
class QFileSystemWatcher;
|
||||||
@ -43,110 +46,110 @@ class PreferencesDialog;
|
|||||||
class DesktopPreferencesDialog;
|
class DesktopPreferencesDialog;
|
||||||
|
|
||||||
class ProxyStyle: public QProxyStyle {
|
class ProxyStyle: public QProxyStyle {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProxyStyle() : QProxyStyle() {}
|
ProxyStyle() : QProxyStyle() {}
|
||||||
virtual ~ProxyStyle() {}
|
virtual ~ProxyStyle() {}
|
||||||
virtual int styleHint(StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0) const;
|
virtual int styleHint(StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Application : public QApplication {
|
class Application : public QApplication {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool desktopManagerEnabled READ desktopManagerEnabled)
|
Q_PROPERTY(bool desktopManagerEnabled READ desktopManagerEnabled)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Application(int& argc, char** argv);
|
Application(int& argc, char** argv);
|
||||||
virtual ~Application();
|
virtual ~Application();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
int exec();
|
int exec();
|
||||||
|
|
||||||
Settings& settings() {
|
Settings& settings() {
|
||||||
return settings_;
|
return settings_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fm::LibFmQt& libFm() {
|
Fm::LibFmQt& libFm() {
|
||||||
return libFm_;
|
return libFm_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public interface exported via dbus
|
// public interface exported via dbus
|
||||||
void launchFiles(QString cwd, QStringList paths, bool inNewWindow);
|
void launchFiles(QString cwd, QStringList paths, bool inNewWindow);
|
||||||
void setWallpaper(QString path, QString modeString);
|
void setWallpaper(QString path, QString modeString);
|
||||||
void preferences(QString page);
|
void preferences(QString page);
|
||||||
void desktopPrefrences(QString page);
|
void desktopPrefrences(QString page);
|
||||||
void editBookmarks();
|
void editBookmarks();
|
||||||
void desktopManager(bool enabled);
|
void desktopManager(bool enabled);
|
||||||
void findFiles(QStringList paths = QStringList());
|
void findFiles(QStringList paths = QStringList());
|
||||||
void connectToServer();
|
void connectToServer();
|
||||||
|
|
||||||
bool desktopManagerEnabled() {
|
bool desktopManagerEnabled() {
|
||||||
return enableDesktopManager_;
|
return enableDesktopManager_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFromSettings();
|
void updateFromSettings();
|
||||||
void updateDesktopsFromSettings();
|
void updateDesktopsFromSettings(bool changeSlide = true);
|
||||||
|
|
||||||
void openFolderInTerminal(Fm::Path path);
|
void openFolderInTerminal(Fm::FilePath path);
|
||||||
void openFolders(Fm::FileInfoList files);
|
void openFolders(Fm::FileInfoList files);
|
||||||
|
|
||||||
QString profileName() {
|
QString profileName() {
|
||||||
return profileName_;
|
return profileName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void onAboutToQuit();
|
void onAboutToQuit();
|
||||||
void onSigtermNotified();
|
void onSigtermNotified();
|
||||||
|
|
||||||
void onLastWindowClosed();
|
void onLastWindowClosed();
|
||||||
void onSaveStateRequest(QSessionManager & manager);
|
void onSaveStateRequest(QSessionManager& manager);
|
||||||
void onScreenResized(int num);
|
void onScreenResized(int num);
|
||||||
void onScreenCountChanged(int newCount);
|
void onScreenCountChanged(int newCount);
|
||||||
void initVolumeManager();
|
void initVolumeManager();
|
||||||
|
|
||||||
void onVirtualGeometryChanged(const QRect& rect);
|
void onVirtualGeometryChanged(const QRect& rect);
|
||||||
void onScreenDestroyed(QObject* screenObj);
|
void onScreenDestroyed(QObject* screenObj);
|
||||||
void onScreenAdded(QScreen* newScreen);
|
void onScreenAdded(QScreen* newScreen);
|
||||||
void reloadDesktopsAsNeeded();
|
void reloadDesktopsAsNeeded();
|
||||||
|
|
||||||
void onFindFileAccepted();
|
void onFindFileAccepted();
|
||||||
void onConnectToServerAccepted();
|
void onConnectToServerAccepted();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventFilter(QObject* watched, QEvent* event);
|
virtual bool eventFilter(QObject* watched, QEvent* event);
|
||||||
bool parseCommandLineArgs();
|
bool parseCommandLineArgs();
|
||||||
DesktopWindow* createDesktopWindow(int screenNum);
|
DesktopWindow* createDesktopWindow(int screenNum);
|
||||||
bool autoMountVolume(GVolume* volume, bool interactive = true);
|
bool autoMountVolume(GVolume* volume, bool interactive = true);
|
||||||
|
|
||||||
static void onVolumeAdded(GVolumeMonitor* monitor, GVolume* volume, Application* pThis);
|
static void onVolumeAdded(GVolumeMonitor* monitor, GVolume* volume, Application* pThis);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onUserDirsChanged();
|
void onUserDirsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initWatch();
|
void initWatch();
|
||||||
void installSigtermHandler();
|
void installSigtermHandler();
|
||||||
|
|
||||||
bool isPrimaryInstance;
|
bool isPrimaryInstance;
|
||||||
Fm::LibFmQt libFm_;
|
Fm::LibFmQt libFm_;
|
||||||
Settings settings_;
|
Settings settings_;
|
||||||
QString profileName_;
|
QString profileName_;
|
||||||
bool daemonMode_;
|
bool daemonMode_;
|
||||||
bool enableDesktopManager_;
|
bool enableDesktopManager_;
|
||||||
QVector<DesktopWindow*> desktopWindows_;
|
QVector<DesktopWindow*> desktopWindows_;
|
||||||
QPointer<PreferencesDialog> preferencesDialog_;
|
QPointer<PreferencesDialog> preferencesDialog_;
|
||||||
QPointer<DesktopPreferencesDialog> desktopPreferencesDialog_;
|
QPointer<DesktopPreferencesDialog> desktopPreferencesDialog_;
|
||||||
QPointer<Fm::EditBookmarksDialog> editBookmarksialog_;
|
QPointer<Fm::EditBookmarksDialog> editBookmarksialog_;
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
GVolumeMonitor* volumeMonitor_;
|
GVolumeMonitor* volumeMonitor_;
|
||||||
|
|
||||||
QFileSystemWatcher *userDirsWatcher_;
|
QFileSystemWatcher* userDirsWatcher_;
|
||||||
QString userDirsFile_;
|
QString userDirsFile_;
|
||||||
QString userDesktopFolder_;
|
QString userDesktopFolder_;
|
||||||
bool lxqtRunning_;
|
bool lxqtRunning_;
|
||||||
|
|
||||||
int argc_;
|
int argc_;
|
||||||
char** argv_;
|
char** argv_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,116 +23,121 @@
|
|||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include <libfm-qt/core/filepath.h>
|
||||||
|
#include <libfm-qt/core/iconinfo.h>
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
|
|
||||||
AutoRunDialog::AutoRunDialog(GVolume* volume, GMount* mount, QWidget* parent, Qt::WindowFlags f):
|
AutoRunDialog::AutoRunDialog(GVolume* volume, GMount* mount, QWidget* parent, Qt::WindowFlags f):
|
||||||
QDialog(parent, f),
|
QDialog(parent, f),
|
||||||
cancellable(g_cancellable_new()),
|
cancellable(g_cancellable_new()),
|
||||||
applications(NULL),
|
applications(nullptr),
|
||||||
mount_(G_MOUNT(g_object_ref(mount))) {
|
mount_(G_MOUNT(g_object_ref(mount))) {
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
GIcon* gicon = g_volume_get_icon(volume);
|
GIcon* gicon = g_volume_get_icon(volume);
|
||||||
QIcon icon = Fm::IconTheme::icon(gicon);
|
QIcon icon = Fm::IconInfo::fromGIcon(gicon)->qicon();
|
||||||
ui.icon->setPixmap(icon.pixmap(QSize(48, 48)));
|
ui.icon->setPixmap(icon.pixmap(QSize(48, 48)));
|
||||||
|
|
||||||
// add actions
|
// add actions
|
||||||
QListWidgetItem* item = new QListWidgetItem(QIcon::fromTheme("system-file-manager"), tr("Open in file manager"));
|
QListWidgetItem* item = new QListWidgetItem(QIcon::fromTheme("system-file-manager"), tr("Open in file manager"));
|
||||||
ui.listWidget->addItem(item);
|
ui.listWidget->addItem(item);
|
||||||
|
|
||||||
g_mount_guess_content_type(mount, TRUE, cancellable, (GAsyncReadyCallback)onContentTypeFinished, this);
|
g_mount_guess_content_type(mount, TRUE, cancellable, (GAsyncReadyCallback)onContentTypeFinished, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoRunDialog::~AutoRunDialog() {
|
AutoRunDialog::~AutoRunDialog() {
|
||||||
g_list_foreach(applications, (GFunc)g_object_unref, NULL);
|
g_list_foreach(applications, (GFunc)g_object_unref, nullptr);
|
||||||
g_list_free(applications);
|
g_list_free(applications);
|
||||||
|
|
||||||
if(mount_)
|
if(mount_) {
|
||||||
g_object_unref(mount_);
|
g_object_unref(mount_);
|
||||||
|
}
|
||||||
|
|
||||||
if(cancellable) {
|
if(cancellable) {
|
||||||
g_cancellable_cancel(cancellable);
|
g_cancellable_cancel(cancellable);
|
||||||
g_object_unref(cancellable);
|
g_object_unref(cancellable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoRunDialog::accept() {
|
void AutoRunDialog::accept() {
|
||||||
QListWidgetItem* item = ui.listWidget->selectedItems().first();
|
QListWidgetItem* item = ui.listWidget->selectedItems().first();
|
||||||
if(item) {
|
if(item) {
|
||||||
GFile* gf = g_mount_get_root(mount_);
|
GFile* gf = g_mount_get_root(mount_);
|
||||||
void* p = item->data(Qt::UserRole).value<void*>();
|
void* p = item->data(Qt::UserRole).value<void*>();
|
||||||
if(p) { // run the selected application
|
if(p) { // run the selected application
|
||||||
GAppInfo* app = G_APP_INFO(p);
|
GAppInfo* app = G_APP_INFO(p);
|
||||||
GList* filelist = g_list_prepend(NULL, gf);
|
GList* filelist = g_list_prepend(nullptr, gf);
|
||||||
g_app_info_launch(app, filelist, NULL, NULL);
|
g_app_info_launch(app, filelist, nullptr, nullptr);
|
||||||
g_list_free(filelist);
|
g_list_free(filelist);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// the default action, open the mounted folder in the file manager
|
||||||
|
Application* app = static_cast<Application*>(qApp);
|
||||||
|
Settings& settings = app->settings();
|
||||||
|
Fm::FilePath path{gf, true};
|
||||||
|
// open the path in a new window
|
||||||
|
// FIXME: or should we open it in a new tab? Make this optional later
|
||||||
|
MainWindow* win = new MainWindow(path);
|
||||||
|
win->resize(settings.windowWidth(), settings.windowHeight());
|
||||||
|
if(settings.windowMaximized()) {
|
||||||
|
win->setWindowState(win->windowState() | Qt::WindowMaximized);
|
||||||
|
}
|
||||||
|
win->show();
|
||||||
|
}
|
||||||
|
g_object_unref(gf);
|
||||||
}
|
}
|
||||||
else {
|
QDialog::accept();
|
||||||
// the default action, open the mounted folder in the file manager
|
|
||||||
Application* app = static_cast<Application*>(qApp);
|
|
||||||
Settings& settings = app->settings();
|
|
||||||
Fm::Path path = Fm::Path::newForGfile(gf);
|
|
||||||
// open the path in a new window
|
|
||||||
// FIXME: or should we open it in a new tab? Make this optional later
|
|
||||||
MainWindow* win = new MainWindow(path);
|
|
||||||
win->resize(settings.windowWidth(), settings.windowHeight());
|
|
||||||
if(settings.windowMaximized()) {
|
|
||||||
win->setWindowState(win->windowState() | Qt::WindowMaximized);
|
|
||||||
}
|
|
||||||
win->show();
|
|
||||||
}
|
|
||||||
g_object_unref(gf);
|
|
||||||
}
|
|
||||||
QDialog::accept();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void AutoRunDialog::onContentTypeFinished(GMount* mount, GAsyncResult* res, AutoRunDialog* pThis) {
|
void AutoRunDialog::onContentTypeFinished(GMount* mount, GAsyncResult* res, AutoRunDialog* pThis) {
|
||||||
if(pThis->cancellable) {
|
if(pThis->cancellable) {
|
||||||
g_object_unref(pThis->cancellable);
|
g_object_unref(pThis->cancellable);
|
||||||
pThis->cancellable = NULL;
|
pThis->cancellable = nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
char** types = g_mount_guess_content_type_finish(mount, res, NULL);
|
|
||||||
char* desc = NULL;
|
|
||||||
|
|
||||||
if(types) {
|
|
||||||
if(types[0]) {
|
|
||||||
for(char** type = types; *type; ++type) {
|
|
||||||
GList* l = g_app_info_get_all_for_type(*type);
|
|
||||||
if(l)
|
|
||||||
pThis->applications = g_list_concat(pThis->applications, l);
|
|
||||||
}
|
|
||||||
desc = g_content_type_get_description(types[0]);
|
|
||||||
}
|
}
|
||||||
g_strfreev(types);
|
|
||||||
|
|
||||||
if(pThis->applications) {
|
char** types = g_mount_guess_content_type_finish(mount, res, nullptr);
|
||||||
int pos = 0;
|
char* desc = nullptr;
|
||||||
for(GList* l = pThis->applications; l; l = l->next, ++pos) {
|
|
||||||
GAppInfo* app = G_APP_INFO(l->data);
|
if(types) {
|
||||||
GIcon* gicon = g_app_info_get_icon(app);
|
if(types[0]) {
|
||||||
QIcon icon = Fm::IconTheme::icon(gicon);
|
for(char** type = types; *type; ++type) {
|
||||||
QString text = QString::fromUtf8(g_app_info_get_name(app));
|
GList* l = g_app_info_get_all_for_type(*type);
|
||||||
QListWidgetItem* item = new QListWidgetItem(icon, text);
|
if(l) {
|
||||||
item->setData(Qt::UserRole, qVariantFromValue<void*>(app));
|
pThis->applications = g_list_concat(pThis->applications, l);
|
||||||
pThis->ui.listWidget->insertItem(pos, item);
|
}
|
||||||
}
|
}
|
||||||
|
desc = g_content_type_get_description(types[0]);
|
||||||
|
}
|
||||||
|
g_strfreev(types);
|
||||||
|
|
||||||
|
if(pThis->applications) {
|
||||||
|
int pos = 0;
|
||||||
|
for(GList* l = pThis->applications; l; l = l->next, ++pos) {
|
||||||
|
GAppInfo* app = G_APP_INFO(l->data);
|
||||||
|
GIcon* gicon = g_app_info_get_icon(app);
|
||||||
|
QIcon icon = Fm::IconInfo::fromGIcon(gicon)->qicon();
|
||||||
|
QString text = QString::fromUtf8(g_app_info_get_name(app));
|
||||||
|
QListWidgetItem* item = new QListWidgetItem(icon, text);
|
||||||
|
item->setData(Qt::UserRole, qVariantFromValue<void*>(app));
|
||||||
|
pThis->ui.listWidget->insertItem(pos, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(desc) {
|
if(desc) {
|
||||||
pThis->ui.mediumType->setText(QString::fromUtf8(desc));
|
pThis->ui.mediumType->setText(QString::fromUtf8(desc));
|
||||||
g_free(desc);
|
g_free(desc);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
pThis->ui.mediumType->setText(tr("Removable Disk"));
|
pThis->ui.mediumType->setText(tr("Removable Disk"));
|
||||||
|
}
|
||||||
|
|
||||||
// select the first item
|
// select the first item
|
||||||
pThis->ui.listWidget->item(0)->setSelected(true);
|
pThis->ui.listWidget->item(0)->setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace PCManFM
|
} // namespace PCManFM
|
||||||
|
@ -310,6 +310,144 @@ A space is also reserved for 3 lines of text.</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="bgPage">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Slide Show</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="slideShow">
|
||||||
|
<property name="title">
|
||||||
|
<string>Enable Slide Show</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="0" column="0" colspan="7">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>Wallpaper image folder:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QPushButton" name="folderBrowse">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QSpinBox" name="hours">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> hour(s)</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>and</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Intervals less than 5min will be ignored</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Interval:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<widget class="QSpinBox" name="minutes">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> minute(s)</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>55</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="5">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>5</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="6">
|
||||||
|
<widget class="QLineEdit" name="imageFolder">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Wallpaper folder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>5</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="6">
|
||||||
|
<widget class="QCheckBox" name="randomize">
|
||||||
|
<property name="text">
|
||||||
|
<string>Randomize the slide show</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QWidget" name="advancedPage">
|
<widget class="QWidget" name="advancedPage">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Advanced</string>
|
<string>Advanced</string>
|
||||||
|
@ -1,207 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "desktopitemdelegate.h"
|
|
||||||
#include <libfm-qt/foldermodel.h>
|
|
||||||
#include <libfm-qt/fileinfo.h>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QListView>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QTextLayout>
|
|
||||||
#include <QTextOption>
|
|
||||||
#include <QTextLine>
|
|
||||||
|
|
||||||
namespace PCManFM {
|
|
||||||
|
|
||||||
DesktopItemDelegate::DesktopItemDelegate(QListView* view, QObject* parent):
|
|
||||||
QStyledItemDelegate(parent ? parent : view),
|
|
||||||
view_(view),
|
|
||||||
symlinkIcon_(QIcon::fromTheme("emblem-symbolic-link")),
|
|
||||||
shadowColor_(0, 0, 0),
|
|
||||||
margins_(QSize(3, 3)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: we need to figure out a way to derive from Fm::FolderItemDelegate to avoid code duplication.
|
|
||||||
void DesktopItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
|
|
||||||
Q_ASSERT(index.isValid());
|
|
||||||
QStyleOptionViewItem opt = option;
|
|
||||||
initStyleOption(&opt, index);
|
|
||||||
|
|
||||||
painter->save();
|
|
||||||
painter->setClipRect(option.rect);
|
|
||||||
|
|
||||||
opt.decorationAlignment = Qt::AlignHCenter | Qt::AlignTop;
|
|
||||||
opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter;
|
|
||||||
|
|
||||||
// draw the icon
|
|
||||||
QIcon::Mode iconMode;
|
|
||||||
if(opt.state & QStyle::State_Enabled) {
|
|
||||||
if(opt.state & QStyle::State_Selected)
|
|
||||||
iconMode = QIcon::Selected;
|
|
||||||
else {
|
|
||||||
iconMode = QIcon::Normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
iconMode = QIcon::Disabled;
|
|
||||||
QPoint iconPos(opt.rect.x() + (opt.rect.width() - opt.decorationSize.width()) / 2, opt.rect.y());
|
|
||||||
QPixmap pixmap = opt.icon.pixmap(opt.decorationSize, iconMode);
|
|
||||||
painter->drawPixmap(iconPos, pixmap);
|
|
||||||
|
|
||||||
// draw some emblems for the item if needed
|
|
||||||
// we only support symlink emblem at the moment
|
|
||||||
Fm::FileInfo file = static_cast<FmFileInfo*>(index.data(Fm::FolderModel::FileInfoRole).value<void*>());
|
|
||||||
if(!file.isNull()) {
|
|
||||||
if(file.isSymlink()) {
|
|
||||||
painter->drawPixmap(iconPos, symlinkIcon_.pixmap(opt.decorationSize / 2, iconMode));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw text
|
|
||||||
QSize gridSize = view_->gridSize() - 2 * margins_;
|
|
||||||
QRectF textRect(opt.rect.x() - (gridSize.width() - opt.rect.width()) / 2,
|
|
||||||
opt.rect.y() + opt.decorationSize.height(),
|
|
||||||
gridSize.width(),
|
|
||||||
gridSize.height() - opt.decorationSize.height());
|
|
||||||
drawText(painter, opt, textRect);
|
|
||||||
|
|
||||||
if(opt.state & QStyle::State_HasFocus) {
|
|
||||||
// FIXME: draw focus rect
|
|
||||||
}
|
|
||||||
painter->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesktopItemDelegate::drawText(QPainter* painter, QStyleOptionViewItem& opt, QRectF& textRect) const {
|
|
||||||
QTextLayout layout(opt.text, opt.font);
|
|
||||||
|
|
||||||
QTextOption textOption;
|
|
||||||
textOption.setAlignment(opt.displayAlignment);
|
|
||||||
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
|
|
||||||
textOption.setTextDirection(opt.direction);
|
|
||||||
layout.setTextOption(textOption);
|
|
||||||
qreal height = 0;
|
|
||||||
qreal width = 0;
|
|
||||||
int visibleLines = 0;
|
|
||||||
layout.beginLayout();
|
|
||||||
QString elidedText;
|
|
||||||
textRect.adjust(2, 2, -2, -2); // a 2-px margin is considered at FolderView::updateGridSize()
|
|
||||||
for(;;) {
|
|
||||||
QTextLine line = layout.createLine();
|
|
||||||
if(!line.isValid())
|
|
||||||
break;
|
|
||||||
line.setLineWidth(textRect.width());
|
|
||||||
height += opt.fontMetrics.leading();
|
|
||||||
line.setPosition(QPointF(0, height));
|
|
||||||
if((height + line.height() + textRect.y()) > textRect.bottom()) {
|
|
||||||
// if part of this line falls outside the textRect, ignore it and quit.
|
|
||||||
QTextLine lastLine = layout.lineAt(visibleLines - 1);
|
|
||||||
elidedText = opt.text.mid(lastLine.textStart());
|
|
||||||
elidedText = opt.fontMetrics.elidedText(elidedText, opt.textElideMode, textRect.width());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
height += line.height();
|
|
||||||
width = qMax(width, line.naturalTextWidth());
|
|
||||||
++ visibleLines;
|
|
||||||
}
|
|
||||||
layout.endLayout();
|
|
||||||
width = qMax(width, (qreal)opt.fontMetrics.width(elidedText));
|
|
||||||
QRectF boundRect = layout.boundingRect();
|
|
||||||
boundRect.setWidth(width);
|
|
||||||
boundRect.setHeight(height);
|
|
||||||
boundRect.moveTo(textRect.x() + (textRect.width() - width)/2, textRect.y());
|
|
||||||
|
|
||||||
QRectF selRect = boundRect.adjusted(-2, -2, 2, 2);
|
|
||||||
|
|
||||||
if(!painter) { // no painter, calculate the bounding rect only
|
|
||||||
textRect = selRect;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt.state & QStyle::State_Selected || opt.state & QStyle::State_MouseOver) {
|
|
||||||
if (const QWidget* widget = opt.widget) { // let the style engine do it
|
|
||||||
QStyle* style = widget->style() ? widget->style() : qApp->style();
|
|
||||||
QStyleOptionViewItem o(opt);
|
|
||||||
o.text = QString();
|
|
||||||
o.rect = selRect.toAlignedRect().intersected(opt.rect); // due to clipping and rounding, we might lose 1px
|
|
||||||
o.showDecorationSelected = true;
|
|
||||||
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &o, painter, widget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((opt.state & QStyle::State_Selected)) {
|
|
||||||
// qDebug("w: %f, h:%f, m:%f", boundRect.width(), boundRect.height(), layout.minimumWidth());
|
|
||||||
if(!opt.widget)
|
|
||||||
painter->fillRect(selRect, opt.palette.highlight());
|
|
||||||
painter->setPen(opt.palette.color(QPalette::Normal, QPalette::HighlightedText));
|
|
||||||
}
|
|
||||||
else { // only draw shadow for non-selected items
|
|
||||||
// draw shadow, FIXME: is it possible to use QGraphicsDropShadowEffect here?
|
|
||||||
QPen prevPen = painter->pen();
|
|
||||||
painter->setPen(QPen(shadowColor_));
|
|
||||||
for(int i = 0; i < visibleLines; ++i) {
|
|
||||||
QTextLine line = layout.lineAt(i);
|
|
||||||
if(i == (visibleLines - 1) && !elidedText.isEmpty()) { // the last line, draw elided text
|
|
||||||
QPointF pos(boundRect.x() + line.position().x() + 1, boundRect.y() + line.y() + line.ascent() + 1);
|
|
||||||
painter->drawText(pos, elidedText);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
line.draw(painter, textRect.topLeft() + QPointF(1, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
painter->setPen(prevPen);
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw text
|
|
||||||
for(int i = 0; i < visibleLines; ++i) {
|
|
||||||
QTextLine line = layout.lineAt(i);
|
|
||||||
if(i == (visibleLines - 1) && !elidedText.isEmpty()) { // the last line, draw elided text
|
|
||||||
QPointF pos(boundRect.x() + line.position().x(), boundRect.y() + line.y() + line.ascent());
|
|
||||||
painter->drawText(pos, elidedText);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
line.draw(painter, textRect.topLeft());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize DesktopItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
|
|
||||||
QVariant value = index.data(Qt::SizeHintRole);
|
|
||||||
if(value.isValid())
|
|
||||||
return qvariant_cast<QSize>(value);
|
|
||||||
QStyleOptionViewItem opt = option;
|
|
||||||
initStyleOption(&opt, index);
|
|
||||||
opt.decorationAlignment = Qt::AlignHCenter|Qt::AlignTop;
|
|
||||||
opt.displayAlignment = Qt::AlignTop|Qt::AlignHCenter;
|
|
||||||
|
|
||||||
QSize gridSize = view_->gridSize() - 2 * margins_;
|
|
||||||
Q_ASSERT(gridSize != QSize());
|
|
||||||
QRectF textRect(0, 0, gridSize.width(), gridSize.height() - opt.decorationSize.height());
|
|
||||||
drawText(NULL, opt, textRect); // passing NULL for painter will calculate the bounding rect only.
|
|
||||||
int width = qMax((int)textRect.width(), opt.decorationSize.width());
|
|
||||||
int height = opt.decorationSize.height() + textRect.height();
|
|
||||||
return QSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
DesktopItemDelegate::~DesktopItemDelegate() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace PCManFM
|
|
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PCMANFM_DESKTOPITEMDELEGATE_H
|
|
||||||
#define PCMANFM_DESKTOPITEMDELEGATE_H
|
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
|
||||||
#include <QColor>
|
|
||||||
|
|
||||||
class QListView;
|
|
||||||
class QTextOption;
|
|
||||||
class QTextLayout;
|
|
||||||
|
|
||||||
namespace PCManFM {
|
|
||||||
|
|
||||||
class DesktopItemDelegate : public QStyledItemDelegate
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit DesktopItemDelegate(QListView* view, QObject* parent = 0);
|
|
||||||
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
||||||
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
|
||||||
virtual ~DesktopItemDelegate();
|
|
||||||
|
|
||||||
void setShadowColor(const QColor& shadowColor) {
|
|
||||||
shadowColor_ = shadowColor;
|
|
||||||
}
|
|
||||||
const QColor& shadowColor() const {
|
|
||||||
return shadowColor_;
|
|
||||||
}
|
|
||||||
void setMargins(QSize margins) {
|
|
||||||
margins_ = margins.expandedTo(QSize(0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void drawText(QPainter* painter, QStyleOptionViewItem& opt, QRectF& textRect) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QListView* view_;
|
|
||||||
QIcon symlinkIcon_;
|
|
||||||
QColor shadowColor_;
|
|
||||||
QSize margins_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // PCMANFM_DESKTOPITEMDELEGATE_H
|
|
@ -84,6 +84,14 @@ DesktopPreferencesDialog::DesktopPreferencesDialog(QWidget* parent, Qt::WindowFl
|
|||||||
qDebug("wallpaper: %s", settings.wallpaper().toUtf8().data());
|
qDebug("wallpaper: %s", settings.wallpaper().toUtf8().data());
|
||||||
ui.imageFile->setText(settings.wallpaper());
|
ui.imageFile->setText(settings.wallpaper());
|
||||||
|
|
||||||
|
ui.slideShow->setChecked(settings.slideShowInterval() > 0);
|
||||||
|
ui.imageFolder->setText(settings.wallpaperDir());
|
||||||
|
int minutes = qMax(settings.slideShowInterval() / 60000, 5); // 5 min at least
|
||||||
|
ui.hours->setValue(minutes / 60);
|
||||||
|
ui.minutes->setValue(minutes % 60);
|
||||||
|
ui.randomize->setChecked(settings.wallpaperRandomize());
|
||||||
|
connect(ui.folderBrowse, &QPushButton::clicked, this, &DesktopPreferencesDialog::onFolderBrowseClicked);
|
||||||
|
|
||||||
for(std::size_t i = 0; i < G_N_ELEMENTS(iconSizes); ++i) {
|
for(std::size_t i = 0; i < G_N_ELEMENTS(iconSizes); ++i) {
|
||||||
int size = iconSizes[i];
|
int size = iconSizes[i];
|
||||||
ui.iconSize->addItem(QString("%1 x %1").arg(size), size);
|
ui.iconSize->addItem(QString("%1 x %1").arg(size), size);
|
||||||
@ -145,12 +153,22 @@ void DesktopPreferencesDialog::applySettings()
|
|||||||
settings.setWallpaper(ui.imageFile->text());
|
settings.setWallpaper(ui.imageFile->text());
|
||||||
int mode = ui.wallpaperMode->itemData(ui.wallpaperMode->currentIndex()).toInt();
|
int mode = ui.wallpaperMode->itemData(ui.wallpaperMode->currentIndex()).toInt();
|
||||||
settings.setWallpaperMode(mode);
|
settings.setWallpaperMode(mode);
|
||||||
|
|
||||||
|
settings.setWallpaperDir(ui.imageFolder->text());
|
||||||
|
int interval = 0;
|
||||||
|
if(ui.slideShow->isChecked())
|
||||||
|
interval = (ui.minutes->value() + 60 * ui.hours->value()) * 60000;
|
||||||
|
settings.setSlideShowInterval(interval);
|
||||||
|
settings.setWallpaperRandomize(ui.randomize->isChecked());
|
||||||
|
|
||||||
settings.setDesktopIconSize(ui.iconSize->itemData(ui.iconSize->currentIndex()).toInt());
|
settings.setDesktopIconSize(ui.iconSize->itemData(ui.iconSize->currentIndex()).toInt());
|
||||||
|
|
||||||
settings.setDesktopFont(ui.font->font());
|
settings.setDesktopFont(ui.font->font());
|
||||||
settings.setDesktopBgColor(ui.backgroundColor->color());
|
settings.setDesktopBgColor(ui.backgroundColor->color());
|
||||||
settings.setDesktopFgColor(ui.textColor->color());
|
settings.setDesktopFgColor(ui.textColor->color());
|
||||||
settings.setDesktopShadowColor(ui.shadowColor->color());
|
settings.setDesktopShadowColor(ui.shadowColor->color());
|
||||||
settings.setShowWmMenu(ui.showWmMenu->isChecked());
|
settings.setShowWmMenu(ui.showWmMenu->isChecked());
|
||||||
|
|
||||||
settings.setDesktopCellMargins(QSize(ui.hMargin->value(), ui.vMargin->value()));
|
settings.setDesktopCellMargins(QSize(ui.hMargin->value(), ui.vMargin->value()));
|
||||||
|
|
||||||
settings.save();
|
settings.save();
|
||||||
@ -164,7 +182,7 @@ void DesktopPreferencesDialog::onApplyClicked()
|
|||||||
|
|
||||||
void DesktopPreferencesDialog::accept() {
|
void DesktopPreferencesDialog::accept() {
|
||||||
applySettings();
|
applySettings();
|
||||||
static_cast<Application*>(qApp)->updateDesktopsFromSettings();
|
static_cast<Application*>(qApp)->updateDesktopsFromSettings(false); // don't change slide wallpaper on clicking OK
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +219,19 @@ void DesktopPreferencesDialog::onBrowseClicked() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesktopPreferencesDialog::onFolderBrowseClicked() {
|
||||||
|
QFileDialog dlg;
|
||||||
|
dlg.setAcceptMode(QFileDialog::AcceptOpen);
|
||||||
|
dlg.setFileMode(QFileDialog::Directory);
|
||||||
|
dlg.setOption(QFileDialog::ShowDirsOnly);
|
||||||
|
dlg.setDirectory(QDir::home().path());
|
||||||
|
if(dlg.exec() == QDialog::Accepted) {
|
||||||
|
QString foldername;
|
||||||
|
foldername = dlg.selectedFiles().first();
|
||||||
|
ui.imageFolder->setText(foldername);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DesktopPreferencesDialog::onBrowseDesktopFolderClicked()
|
void DesktopPreferencesDialog::onBrowseDesktopFolderClicked()
|
||||||
{
|
{
|
||||||
QFileDialog dlg;
|
QFileDialog dlg;
|
||||||
|
@ -46,6 +46,7 @@ protected Q_SLOTS:
|
|||||||
void onApplyClicked();
|
void onApplyClicked();
|
||||||
void onWallpaperModeChanged(int index);
|
void onWallpaperModeChanged(int index);
|
||||||
void onBrowseClicked();
|
void onBrowseClicked();
|
||||||
|
void onFolderBrowseClicked();
|
||||||
void onBrowseDesktopFolderClicked();
|
void onBrowseDesktopFolderClicked();
|
||||||
void lockMargins(bool lock);
|
void lockMargins(bool lock);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -23,124 +23,138 @@
|
|||||||
|
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "launcher.h"
|
#include "launcher.h"
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <libfm-qt/folder.h>
|
#include <libfm-qt/core/folder.h>
|
||||||
|
|
||||||
namespace Fm {
|
namespace Fm {
|
||||||
class CachedFolderModel;
|
class CachedFolderModel;
|
||||||
class ProxyFolderModel;
|
class ProxyFolderModel;
|
||||||
class FolderViewListView;
|
class FolderViewListView;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
|
|
||||||
class DesktopItemDelegate;
|
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
class DesktopWindow : public View {
|
class DesktopWindow : public View {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
friend class Application;
|
friend class Application;
|
||||||
|
|
||||||
enum WallpaperMode {
|
enum WallpaperMode {
|
||||||
WallpaperNone,
|
WallpaperNone,
|
||||||
WallpaperStretch,
|
WallpaperStretch,
|
||||||
WallpaperFit,
|
WallpaperFit,
|
||||||
WallpaperCenter,
|
WallpaperCenter,
|
||||||
WallpaperTile,
|
WallpaperTile,
|
||||||
WallpaperZoom
|
WallpaperZoom
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit DesktopWindow(int screenNum);
|
explicit DesktopWindow(int screenNum);
|
||||||
virtual ~DesktopWindow();
|
virtual ~DesktopWindow();
|
||||||
|
|
||||||
void setForeground(const QColor& color);
|
void setForeground(const QColor& color);
|
||||||
void setShadow(const QColor& color);
|
void setShadow(const QColor& color);
|
||||||
void setBackground(const QColor& color);
|
void setBackground(const QColor& color);
|
||||||
void setDesktopFolder();
|
void setDesktopFolder();
|
||||||
void setWallpaperFile(QString filename);
|
void setWallpaperFile(QString filename);
|
||||||
void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
|
void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
|
||||||
|
void setLastSlide(QString filename);
|
||||||
|
void setWallpaperDir(QString dirname);
|
||||||
|
void setSlideShowInterval(int interval);
|
||||||
|
void setWallpaperRandomize(bool randomize);
|
||||||
|
|
||||||
// void setWallpaperAlpha(qreal alpha);
|
// void setWallpaperAlpha(qreal alpha);
|
||||||
void updateWallpaper();
|
void updateWallpaper();
|
||||||
void updateFromSettings(Settings& settings);
|
bool pickWallpaper();
|
||||||
|
void nextWallpaper();
|
||||||
|
void updateFromSettings(Settings& settings, bool changeSlide = true);
|
||||||
|
|
||||||
void queueRelayout(int delay = 0);
|
void queueRelayout(int delay = 0);
|
||||||
|
|
||||||
int screenNum() const {
|
int screenNum() const {
|
||||||
return screenNum_;
|
return screenNum_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setScreenNum(int num);
|
void setScreenNum(int num);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void prepareFolderMenu(Fm::FolderMenu* menu);
|
virtual void prepareFolderMenu(Fm::FolderMenu* menu) override;
|
||||||
virtual void prepareFileMenu(Fm::FileMenu* menu);
|
virtual void prepareFileMenu(Fm::FileMenu* menu) override;
|
||||||
virtual void resizeEvent(QResizeEvent* event);
|
virtual void resizeEvent(QResizeEvent* event) override;
|
||||||
virtual void onFileClicked(int type, FmFileInfo* fileInfo);
|
virtual void onFileClicked(int type, const std::shared_ptr<const Fm::FileInfo>& fileInfo) override;
|
||||||
|
|
||||||
void loadItemPositions();
|
void loadItemPositions();
|
||||||
void saveItemPositions();
|
void saveItemPositions();
|
||||||
|
|
||||||
QImage loadWallpaperFile(QSize requiredSize);
|
QImage loadWallpaperFile(QSize requiredSize);
|
||||||
|
|
||||||
virtual bool event(QEvent* event);
|
virtual bool event(QEvent* event) override;
|
||||||
virtual bool eventFilter(QObject * watched, QEvent * event);
|
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||||
|
|
||||||
virtual void childDropEvent(QDropEvent* e);
|
virtual void childDropEvent(QDropEvent* e) override;
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
virtual void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void onOpenDirRequested(FmPath* path, int target);
|
void onOpenDirRequested(const Fm::FilePath& path, int target);
|
||||||
void onDesktopPreferences();
|
void onDesktopPreferences();
|
||||||
|
|
||||||
void onRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
|
void onRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
|
||||||
void onRowsInserted(const QModelIndex& parent, int start, int end);
|
void onRowsInserted(const QModelIndex& parent, int start, int end);
|
||||||
void onLayoutChanged();
|
void onLayoutChanged();
|
||||||
void onModelSortFilterChanged();
|
void onModelSortFilterChanged();
|
||||||
void onIndexesMoved(const QModelIndexList& indexes);
|
void onIndexesMoved(const QModelIndexList& indexes);
|
||||||
void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||||
|
|
||||||
void relayoutItems();
|
void relayoutItems();
|
||||||
void onStickToCurrentPos(bool toggled);
|
void onStickToCurrentPos(bool toggled);
|
||||||
|
|
||||||
// void updateWorkArea();
|
// void updateWorkArea();
|
||||||
|
|
||||||
// file operations
|
// file operations
|
||||||
void onCutActivated();
|
void onCutActivated();
|
||||||
void onCopyActivated();
|
void onCopyActivated();
|
||||||
void onPasteActivated();
|
void onPasteActivated();
|
||||||
void onRenameActivated();
|
void onRenameActivated();
|
||||||
void onDeleteActivated();
|
void onDeleteActivated();
|
||||||
void onFilePropertiesActivated();
|
void onFilePropertiesActivated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void removeBottomGap();
|
void removeBottomGap();
|
||||||
void paintBackground(QPaintEvent* event);
|
void paintBackground(QPaintEvent* event);
|
||||||
|
static void alignToGrid(QPoint& pos, const QPoint& topLeft, const QSize& grid, const int spacing);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Fm::ProxyFolderModel* proxyModel_;
|
Fm::ProxyFolderModel* proxyModel_;
|
||||||
Fm::CachedFolderModel* model_;
|
Fm::CachedFolderModel* model_;
|
||||||
Fm::Folder folder_;
|
std::shared_ptr<Fm::Folder> folder_;
|
||||||
Fm::FolderViewListView* listView_;
|
Fm::FolderViewListView* listView_;
|
||||||
|
|
||||||
QColor fgColor_;
|
QColor fgColor_;
|
||||||
QColor bgColor_;
|
QColor bgColor_;
|
||||||
QColor shadowColor_;
|
QColor shadowColor_;
|
||||||
QString wallpaperFile_;
|
QString wallpaperFile_;
|
||||||
WallpaperMode wallpaperMode_;
|
WallpaperMode wallpaperMode_;
|
||||||
QPixmap wallpaperPixmap_;
|
QString lastSlide_;
|
||||||
DesktopItemDelegate* delegate_;
|
QString wallpaperDir_;
|
||||||
Launcher fileLauncher_;
|
int slideShowInterval_;
|
||||||
bool showWmMenu_;
|
QTimer* wallpaperTimer_;
|
||||||
|
bool wallpaperRandomize_;
|
||||||
|
QPixmap wallpaperPixmap_;
|
||||||
|
Launcher fileLauncher_;
|
||||||
|
bool showWmMenu_;
|
||||||
|
|
||||||
int screenNum_;
|
int screenNum_;
|
||||||
QHash<QByteArray, QPoint> customItemPos_;
|
std::unordered_map<std::string, QPoint> customItemPos_;
|
||||||
QHash<QModelIndex, QString> displayNames_; // only for desktop entries and shortcuts
|
QHash<QModelIndex, QString> displayNames_; // only for desktop entries and shortcuts
|
||||||
QTimer* relayoutTimer_;
|
QTimer* relayoutTimer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,517 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>FindFilesDialog</class>
|
|
||||||
<widget class="QDialog" name="FindFilesDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>431</width>
|
|
||||||
<height>416</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Find Files</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Name/Location</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>File name patterns</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Pattern:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Case insensitive</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBox_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use regular expression</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Places to search</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-add">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-remove">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Search in sub directories</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Search hidden files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>File Type</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
|
||||||
<property name="title">
|
|
||||||
<string>File Type</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Only search for files of following types:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Text files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Image files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Audio files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_8">
|
|
||||||
<property name="text">
|
|
||||||
<string>Video files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>Documents</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_4">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Content</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
|
||||||
<property name="title">
|
|
||||||
<string>File contains</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_10">
|
|
||||||
<property name="text">
|
|
||||||
<string>Case insensitive</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_11">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use regular expression</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_3">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Properties</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_5">
|
|
||||||
<property name="title">
|
|
||||||
<string>File Size</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkBox_12">
|
|
||||||
<property name="text">
|
|
||||||
<string>Bigger than:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkBox_13">
|
|
||||||
<property name="text">
|
|
||||||
<string>Smaller than:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_6">
|
|
||||||
<property name="title">
|
|
||||||
<string>Last Modified Time</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkBox_14">
|
|
||||||
<property name="text">
|
|
||||||
<string>Earlier than:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QDateTimeEdit" name="dateTimeEdit">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="calendarPopup">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkBox_15">
|
|
||||||
<property name="text">
|
|
||||||
<string>Later than:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QDateTimeEdit" name="dateTimeEdit_2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="calendarPopup">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>FindFilesDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>222</x>
|
|
||||||
<y>344</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>FindFilesDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>290</x>
|
|
||||||
<y>350</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_14</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>dateTimeEdit</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>129</x>
|
|
||||||
<y>166</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>294</x>
|
|
||||||
<y>170</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_15</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>dateTimeEdit_2</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>91</x>
|
|
||||||
<y>188</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>302</x>
|
|
||||||
<y>195</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_12</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>spinBox</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>102</x>
|
|
||||||
<y>73</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>184</x>
|
|
||||||
<y>77</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_12</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>comboBox</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>49</x>
|
|
||||||
<y>72</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>357</x>
|
|
||||||
<y>76</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_13</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>spinBox_2</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>123</x>
|
|
||||||
<y>101</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>186</x>
|
|
||||||
<y>104</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_13</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>comboBox_2</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>53</x>
|
|
||||||
<y>98</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>339</x>
|
|
||||||
<y>108</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@ -21,15 +21,16 @@
|
|||||||
#include "launcher.h"
|
#include "launcher.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
#include <libfm-qt/core/filepath.h>
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
|
|
||||||
Launcher::Launcher(PCManFM::MainWindow* mainWindow):
|
Launcher::Launcher(PCManFM::MainWindow* mainWindow):
|
||||||
Fm::FileLauncher(),
|
Fm::FileLauncher(),
|
||||||
mainWindow_(mainWindow) {
|
mainWindow_(mainWindow) {
|
||||||
|
|
||||||
Application* app = static_cast<Application*>(qApp);
|
Application* app = static_cast<Application*>(qApp);
|
||||||
setQuickExec(app->settings().quickExec());
|
setQuickExec(app->settings().quickExec());
|
||||||
}
|
}
|
||||||
|
|
||||||
Launcher::~Launcher() {
|
Launcher::~Launcher() {
|
||||||
@ -37,28 +38,31 @@ Launcher::~Launcher() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Launcher::openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError** err) {
|
bool Launcher::openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError** err) {
|
||||||
GList* l = folder_infos;
|
GList* l = folder_infos;
|
||||||
Fm::FileInfo fi = FM_FILE_INFO(l->data);
|
FmFileInfo* fi = FM_FILE_INFO(l->data);
|
||||||
Application* app = static_cast<Application*>(qApp);
|
Application* app = static_cast<Application*>(qApp);
|
||||||
MainWindow* mainWindow = mainWindow_;
|
MainWindow* mainWindow = mainWindow_;
|
||||||
if(!mainWindow) {
|
Fm::FilePath path{fm_path_to_gfile(fm_file_info_get_path(fi)), false};
|
||||||
mainWindow = new MainWindow(fi.getPath());
|
if(!mainWindow) {
|
||||||
mainWindow->resize(app->settings().windowWidth(), app->settings().windowHeight());
|
mainWindow = new MainWindow(std::move(path));
|
||||||
|
mainWindow->resize(app->settings().windowWidth(), app->settings().windowHeight());
|
||||||
|
|
||||||
if(app->settings().windowMaximized()) {
|
if(app->settings().windowMaximized()) {
|
||||||
mainWindow->setWindowState(mainWindow->windowState() | Qt::WindowMaximized);
|
mainWindow->setWindowState(mainWindow->windowState() | Qt::WindowMaximized);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else
|
mainWindow->chdir(std::move(path));
|
||||||
mainWindow->chdir(fi.getPath());
|
}
|
||||||
l = l->next;
|
l = l->next;
|
||||||
for(; l; l = l->next) {
|
for(; l; l = l->next) {
|
||||||
fi = FM_FILE_INFO(l->data);
|
fi = FM_FILE_INFO(l->data);
|
||||||
mainWindow->addTab(fi.getPath());
|
path = Fm::FilePath{fm_path_to_gfile(fm_file_info_get_path(fi)), false};
|
||||||
}
|
mainWindow->addTab(std::move(path));
|
||||||
mainWindow->show();
|
}
|
||||||
mainWindow->raise();
|
mainWindow->show();
|
||||||
return true;
|
mainWindow->raise();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace PCManFM
|
} //namespace PCManFM
|
||||||
|
@ -29,14 +29,14 @@ class MainWindow;
|
|||||||
|
|
||||||
class Launcher : public Fm::FileLauncher {
|
class Launcher : public Fm::FileLauncher {
|
||||||
public:
|
public:
|
||||||
Launcher(MainWindow* mainWindow = NULL);
|
Launcher(MainWindow* mainWindow = nullptr);
|
||||||
~Launcher();
|
~Launcher();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError** err);
|
virtual bool openFolder(GAppLaunchContext* ctx, GList* folder_infos, GError** err);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow* mainWindow_;
|
MainWindow* mainWindow_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@
|
|||||||
<addaction name="menuToolbars"/>
|
<addaction name="menuToolbars"/>
|
||||||
<addaction name="menuPathBarStyle"/>
|
<addaction name="menuPathBarStyle"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Editw">
|
<widget class="QMenu" name="menu_Edit">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Edit</string>
|
<string>&Edit</string>
|
||||||
</property>
|
</property>
|
||||||
@ -245,14 +245,14 @@
|
|||||||
<addaction name="actionFindFiles"/>
|
<addaction name="actionFindFiles"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menu_File"/>
|
<addaction name="menu_File"/>
|
||||||
<addaction name="menu_Editw"/>
|
<addaction name="menu_Edit"/>
|
||||||
<addaction name="menu_View"/>
|
<addaction name="menu_View"/>
|
||||||
<addaction name="menu_Go"/>
|
<addaction name="menu_Go"/>
|
||||||
<addaction name="menu_Bookmarks"/>
|
<addaction name="menu_Bookmarks"/>
|
||||||
<addaction name="menu_Tool"/>
|
<addaction name="menu_Tool"/>
|
||||||
<addaction name="menu_Help"/>
|
<addaction name="menu_Help"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="PCManFM::StatusBar" name="statusbar"/>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::PreventContextMenu</enum>
|
<enum>Qt::PreventContextMenu</enum>
|
||||||
@ -836,6 +836,12 @@
|
|||||||
<header>tabbar.h</header>
|
<header>tabbar.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>PCManFM::StatusBar</class>
|
||||||
|
<extends>QStatusBar</extends>
|
||||||
|
<header>statusbar.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Fm::SidePane</class>
|
<class>Fm::SidePane</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -32,12 +32,13 @@
|
|||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include "launcher.h"
|
#include "launcher.h"
|
||||||
#include <libfm-qt/bookmarks.h>
|
|
||||||
#include <libfm-qt/path.h>
|
#include <libfm-qt/path.h>
|
||||||
|
#include <libfm-qt/core/filepath.h>
|
||||||
|
#include <libfm-qt/core/bookmarks.h>
|
||||||
|
|
||||||
namespace Fm {
|
namespace Fm {
|
||||||
class PathEdit;
|
class PathEdit;
|
||||||
class PathBar;
|
class PathBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
@ -46,162 +47,163 @@ class TabPage;
|
|||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow(Fm::Path path = Fm::Path());
|
MainWindow(Fm::FilePath path = Fm::FilePath());
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
void chdir(Fm::Path path);
|
void chdir(Fm::FilePath path);
|
||||||
int addTab(Fm::Path path);
|
int addTab(Fm::FilePath path);
|
||||||
|
|
||||||
TabPage* currentPage() {
|
TabPage* currentPage() {
|
||||||
return reinterpret_cast<TabPage*>(ui.stackedWidget->currentWidget());
|
return reinterpret_cast<TabPage*>(ui.stackedWidget->currentWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateFromSettings(Settings& settings);
|
void updateFromSettings(Settings& settings);
|
||||||
|
|
||||||
static MainWindow* lastActive() {
|
static MainWindow* lastActive() {
|
||||||
return lastActive_;
|
return lastActive_;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
|
|
||||||
void onPathEntryReturnPressed();
|
void onPathEntryReturnPressed();
|
||||||
void onPathEntryEdited(const QString& text);
|
void onPathBarChdir(const Fm::FilePath& dirPath);
|
||||||
void onPathBarChdir(FmPath* dirPath);
|
void onPathBarMiddleClickChdir(const Fm::FilePath &dirPath);
|
||||||
void onPathBarMiddleClickChdir(FmPath* dirPath);
|
|
||||||
|
|
||||||
void on_actionNewTab_triggered();
|
void on_actionNewTab_triggered();
|
||||||
void on_actionNewWin_triggered();
|
void on_actionNewWin_triggered();
|
||||||
void on_actionNewFolder_triggered();
|
void on_actionNewFolder_triggered();
|
||||||
void on_actionNewBlankFile_triggered();
|
void on_actionNewBlankFile_triggered();
|
||||||
void on_actionCloseTab_triggered();
|
void on_actionCloseTab_triggered();
|
||||||
void on_actionCloseWindow_triggered();
|
void on_actionCloseWindow_triggered();
|
||||||
void on_actionFileProperties_triggered();
|
void on_actionFileProperties_triggered();
|
||||||
void on_actionFolderProperties_triggered();
|
void on_actionFolderProperties_triggered();
|
||||||
|
|
||||||
void on_actionCut_triggered();
|
void on_actionCut_triggered();
|
||||||
void on_actionCopy_triggered();
|
void on_actionCopy_triggered();
|
||||||
void on_actionPaste_triggered();
|
void on_actionPaste_triggered();
|
||||||
void on_actionDelete_triggered();
|
void on_actionDelete_triggered();
|
||||||
void on_actionRename_triggered();
|
void on_actionRename_triggered();
|
||||||
void on_actionSelectAll_triggered();
|
void on_actionSelectAll_triggered();
|
||||||
void on_actionInvertSelection_triggered();
|
void on_actionInvertSelection_triggered();
|
||||||
void on_actionPreferences_triggered();
|
void on_actionPreferences_triggered();
|
||||||
|
|
||||||
void on_actionGoBack_triggered();
|
void on_actionGoBack_triggered();
|
||||||
void on_actionGoForward_triggered();
|
void on_actionGoForward_triggered();
|
||||||
void on_actionGoUp_triggered();
|
void on_actionGoUp_triggered();
|
||||||
void on_actionHome_triggered();
|
void on_actionHome_triggered();
|
||||||
void on_actionReload_triggered();
|
void on_actionReload_triggered();
|
||||||
void on_actionConnectToServer_triggered();
|
void on_actionConnectToServer_triggered();
|
||||||
|
|
||||||
void on_actionIconView_triggered();
|
void on_actionIconView_triggered();
|
||||||
void on_actionCompactView_triggered();
|
void on_actionCompactView_triggered();
|
||||||
void on_actionDetailedList_triggered();
|
void on_actionDetailedList_triggered();
|
||||||
void on_actionThumbnailView_triggered();
|
void on_actionThumbnailView_triggered();
|
||||||
|
|
||||||
void on_actionGo_triggered();
|
void on_actionGo_triggered();
|
||||||
void on_actionShowHidden_triggered(bool check);
|
void on_actionShowHidden_triggered(bool check);
|
||||||
void on_actionPreserveView_triggered(bool checked);
|
void on_actionPreserveView_triggered(bool checked);
|
||||||
|
|
||||||
void on_actionByFileName_triggered(bool checked);
|
void on_actionByFileName_triggered(bool checked);
|
||||||
void on_actionByMTime_triggered(bool checked);
|
void on_actionByMTime_triggered(bool checked);
|
||||||
void on_actionByOwner_triggered(bool checked);
|
void on_actionByOwner_triggered(bool checked);
|
||||||
void on_actionByFileType_triggered(bool checked);
|
void on_actionByFileType_triggered(bool checked);
|
||||||
void on_actionByFileSize_triggered(bool checked);
|
void on_actionByFileSize_triggered(bool checked);
|
||||||
void on_actionAscending_triggered(bool checked);
|
void on_actionAscending_triggered(bool checked);
|
||||||
void on_actionDescending_triggered(bool checked);
|
void on_actionDescending_triggered(bool checked);
|
||||||
void on_actionFolderFirst_triggered(bool checked);
|
void on_actionFolderFirst_triggered(bool checked);
|
||||||
void on_actionCaseSensitive_triggered(bool checked);
|
void on_actionCaseSensitive_triggered(bool checked);
|
||||||
void on_actionFilter_triggered(bool checked);
|
void on_actionFilter_triggered(bool checked);
|
||||||
|
|
||||||
void on_actionLocationBar_triggered(bool checked);
|
void on_actionLocationBar_triggered(bool checked);
|
||||||
void on_actionPathButtons_triggered(bool checked);
|
void on_actionPathButtons_triggered(bool checked);
|
||||||
|
|
||||||
void on_actionApplications_triggered();
|
void on_actionApplications_triggered();
|
||||||
void on_actionComputer_triggered();
|
void on_actionComputer_triggered();
|
||||||
void on_actionTrash_triggered();
|
void on_actionTrash_triggered();
|
||||||
void on_actionNetwork_triggered();
|
void on_actionNetwork_triggered();
|
||||||
void on_actionDesktop_triggered();
|
void on_actionDesktop_triggered();
|
||||||
void on_actionAddToBookmarks_triggered();
|
void on_actionAddToBookmarks_triggered();
|
||||||
void on_actionEditBookmarks_triggered();
|
void on_actionEditBookmarks_triggered();
|
||||||
|
|
||||||
void on_actionOpenTerminal_triggered();
|
void on_actionOpenTerminal_triggered();
|
||||||
void on_actionOpenAsRoot_triggered();
|
void on_actionOpenAsRoot_triggered();
|
||||||
void on_actionFindFiles_triggered();
|
void on_actionFindFiles_triggered();
|
||||||
|
|
||||||
void on_actionAbout_triggered();
|
void on_actionAbout_triggered();
|
||||||
|
|
||||||
void onBookmarkActionTriggered();
|
void onBookmarkActionTriggered();
|
||||||
|
|
||||||
void onTabBarCloseRequested(int index);
|
void onTabBarCloseRequested(int index);
|
||||||
void onTabBarCurrentChanged(int index);
|
void onTabBarCurrentChanged(int index);
|
||||||
void onTabBarTabMoved(int from, int to);
|
void onTabBarTabMoved(int from, int to);
|
||||||
|
|
||||||
void focusFilterBar();
|
void focusFilterBar();
|
||||||
void onFilterStringChanged(QString str);
|
void onFilterStringChanged(QString str);
|
||||||
|
|
||||||
void onShortcutPrevTab();
|
void onShortcutPrevTab();
|
||||||
void onShortcutNextTab();
|
void onShortcutNextTab();
|
||||||
void onShortcutJumpToTab();
|
void onShortcutJumpToTab();
|
||||||
|
|
||||||
void onStackedWidgetWidgetRemoved(int index);
|
void onStackedWidgetWidgetRemoved(int index);
|
||||||
|
|
||||||
void onTabPageTitleChanged(QString title);
|
void onTabPageTitleChanged(QString title);
|
||||||
void onTabPageStatusChanged(int type, QString statusText);
|
void onTabPageStatusChanged(int type, QString statusText);
|
||||||
void onTabPageOpenDirRequested(FmPath* path, int target);
|
void onTabPageOpenDirRequested(const Fm::FilePath &path, int target);
|
||||||
void onTabPageSortFilterChanged();
|
void onTabPageSortFilterChanged();
|
||||||
|
|
||||||
void onSidePaneChdirRequested(int type, FmPath* path);
|
void onSidePaneChdirRequested(int type, const Fm::FilePath &path);
|
||||||
void onSidePaneOpenFolderInNewWindowRequested(FmPath* path);
|
void onSidePaneOpenFolderInNewWindowRequested(const Fm::FilePath &path);
|
||||||
void onSidePaneOpenFolderInNewTabRequested(FmPath* path);
|
void onSidePaneOpenFolderInNewTabRequested(const Fm::FilePath &path);
|
||||||
void onSidePaneOpenFolderInTerminalRequested(FmPath* path);
|
void onSidePaneOpenFolderInTerminalRequested(const Fm::FilePath &path);
|
||||||
void onSidePaneCreateNewFolderRequested(FmPath* path);
|
void onSidePaneCreateNewFolderRequested(const Fm::FilePath &path);
|
||||||
void onSidePaneModeChanged(Fm::SidePane::Mode mode);
|
void onSidePaneModeChanged(Fm::SidePane::Mode mode);
|
||||||
void onSplitterMoved(int pos, int index);
|
void onSplitterMoved(int pos, int index);
|
||||||
void onResetFocus();
|
void onResetFocus();
|
||||||
|
|
||||||
void onBackForwardContextMenu(QPoint pos);
|
void onBackForwardContextMenu(QPoint pos);
|
||||||
|
|
||||||
void tabContextMenu(const QPoint& pos);
|
void tabContextMenu(const QPoint& pos);
|
||||||
void closeLeftTabs();
|
void closeLeftTabs();
|
||||||
void closeRightTabs();
|
void closeRightTabs();
|
||||||
void closeOtherTabs() {
|
void closeOtherTabs() {
|
||||||
closeLeftTabs();
|
closeLeftTabs();
|
||||||
closeRightTabs();
|
closeRightTabs();
|
||||||
}
|
}
|
||||||
void focusPathEntry();
|
void focusPathEntry();
|
||||||
void toggleMenuBar(bool checked);
|
void toggleMenuBar(bool checked);
|
||||||
|
|
||||||
|
void onBookmarksChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent* event) override;
|
bool event(QEvent* event) override;
|
||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent* event) override;
|
||||||
void closeTab(int index);
|
void closeTab(int index);
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent* event) override;
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void onBookmarksChanged(FmBookmarks* bookmarks_, MainWindow* pThis);
|
void loadBookmarksMenu();
|
||||||
void loadBookmarksMenu();
|
void updateUIForCurrentPage();
|
||||||
void updateUIForCurrentPage();
|
void updateViewMenuForCurrentPage();
|
||||||
void updateViewMenuForCurrentPage();
|
void updateEditSelectedActions();
|
||||||
void updateStatusBarForCurrentPage();
|
void updateStatusBarForCurrentPage();
|
||||||
void setRTLIcons(bool isRTL);
|
void setRTLIcons(bool isRTL);
|
||||||
void createPathBar(bool usePathButtons);
|
void createPathBar(bool usePathButtons);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
Fm::PathEdit* pathEntry_;
|
Fm::PathEdit* pathEntry_;
|
||||||
Fm::PathBar* pathBar_;
|
Fm::PathBar* pathBar_;
|
||||||
QLabel* fsInfoLabel_;
|
QLabel* fsInfoLabel_;
|
||||||
Fm::Bookmarks bookmarks_;
|
std::shared_ptr<Fm::Bookmarks> bookmarks_;
|
||||||
Launcher fileLauncher_;
|
Launcher fileLauncher_;
|
||||||
int rightClickIndex_;
|
int rightClickIndex_;
|
||||||
bool updatingViewMenu_;
|
bool updatingViewMenu_;
|
||||||
QAction* menuSep_;
|
QAction* menuSep_;
|
||||||
|
|
||||||
static MainWindow* lastActive_;
|
static MainWindow* lastActive_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@
|
|||||||
#include <libfm-qt/libfmqt.h>
|
#include <libfm-qt/libfmqt.h>
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
// ensure that glib integration of Qt is not turned off
|
// ensure that glib integration of Qt is not turned off
|
||||||
// This fixes #168: https://github.com/lxde/pcmanfm-qt/issues/168
|
// This fixes #168: https://github.com/lxde/pcmanfm-qt/issues/168
|
||||||
qunsetenv("QT_NO_GLIB");
|
qunsetenv("QT_NO_GLIB");
|
||||||
|
|
||||||
PCManFM::Application app(argc, argv);
|
PCManFM::Application app(argc, argv);
|
||||||
app.init();
|
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||||
return app.exec();
|
|
||||||
|
app.init();
|
||||||
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -27,26 +27,23 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include <libfm-qt/folderview.h>
|
#include <libfm-qt/folderview.h>
|
||||||
|
#include <libfm-qt/core/terminal.h>
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
|
|
||||||
static int bigIconSizes[] = {96, 72, 64, 48, 36, 32, 24, 20};
|
PreferencesDialog::PreferencesDialog(QString activePage, QWidget* parent):
|
||||||
static int smallIconSizes[] = {48, 36, 32, 24, 20, 16, 12};
|
QDialog(parent) {
|
||||||
static int thumbnailIconSizes[] = {256, 224, 192, 160, 128, 96, 64};
|
ui.setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
PreferencesDialog::PreferencesDialog (QString activePage, QWidget* parent):
|
// resize the list widget according to the width of its content.
|
||||||
QDialog (parent) {
|
ui.listWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
ui.setupUi(this);
|
ui.listWidget->setMaximumWidth(ui.listWidget->sizeHintForColumn(0) + ui.listWidget->frameWidth() * 2 + 4);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
// resize the list widget according to the width of its content.
|
initFromSettings();
|
||||||
ui.listWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
|
||||||
ui.listWidget->setMaximumWidth(ui.listWidget->sizeHintForColumn(0) + ui.listWidget->frameWidth() * 2 + 4);
|
|
||||||
|
|
||||||
initFromSettings();
|
selectPage(activePage);
|
||||||
|
adjustSize();
|
||||||
selectPage(activePage);
|
|
||||||
adjustSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferencesDialog::~PreferencesDialog() {
|
PreferencesDialog::~PreferencesDialog() {
|
||||||
@ -54,106 +51,115 @@ PreferencesDialog::~PreferencesDialog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void findIconThemesInDir(QHash<QString, QString>& iconThemes, QString dirName) {
|
static void findIconThemesInDir(QHash<QString, QString>& iconThemes, QString dirName) {
|
||||||
QDir dir(dirName);
|
QDir dir(dirName);
|
||||||
QStringList subDirs = dir.entryList(QDir::AllDirs);
|
QStringList subDirs = dir.entryList(QDir::AllDirs);
|
||||||
GKeyFile* kf = g_key_file_new();
|
GKeyFile* kf = g_key_file_new();
|
||||||
Q_FOREACH(QString subDir, subDirs) {
|
Q_FOREACH(QString subDir, subDirs) {
|
||||||
QString indexFile = dirName % '/' % subDir % "/index.theme";
|
QString indexFile = dirName % '/' % subDir % "/index.theme";
|
||||||
if(g_key_file_load_from_file(kf, indexFile.toLocal8Bit().constData(), GKeyFileFlags(0), NULL)) {
|
if(g_key_file_load_from_file(kf, indexFile.toLocal8Bit().constData(), GKeyFileFlags(0), nullptr)) {
|
||||||
// FIXME: skip hidden ones
|
// FIXME: skip hidden ones
|
||||||
// icon theme must have this key, so it has icons if it has this key
|
// icon theme must have this key, so it has icons if it has this key
|
||||||
// otherwise, it might be a cursor theme or any other kind of theme.
|
// otherwise, it might be a cursor theme or any other kind of theme.
|
||||||
if(g_key_file_has_key(kf, "Icon Theme", "Directories", NULL)) {
|
if(g_key_file_has_key(kf, "Icon Theme", "Directories", nullptr)) {
|
||||||
char* dispName = g_key_file_get_locale_string(kf, "Icon Theme", "Name", NULL, NULL);
|
char* dispName = g_key_file_get_locale_string(kf, "Icon Theme", "Name", nullptr, nullptr);
|
||||||
// char* comment = g_key_file_get_locale_string(kf, "Icon Theme", "Comment", NULL, NULL);
|
// char* comment = g_key_file_get_locale_string(kf, "Icon Theme", "Comment", nullptr, nullptr);
|
||||||
iconThemes[subDir] = dispName;
|
iconThemes[subDir] = dispName;
|
||||||
g_free(dispName);
|
g_free(dispName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
g_key_file_free(kf);
|
||||||
g_key_file_free(kf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initIconThemes(Settings& settings) {
|
void PreferencesDialog::initIconThemes(Settings& settings) {
|
||||||
// check if auto-detection is done (for example, from xsettings)
|
// check if auto-detection is done (for example, from xsettings)
|
||||||
if(settings.useFallbackIconTheme()) { // auto-detection failed
|
if(settings.useFallbackIconTheme()) { // auto-detection failed
|
||||||
// load xdg icon themes and select the current one
|
// load xdg icon themes and select the current one
|
||||||
QHash<QString, QString> iconThemes;
|
QHash<QString, QString> iconThemes;
|
||||||
// user customed icon themes
|
// user customed icon themes
|
||||||
findIconThemesInDir(iconThemes, QString(g_get_home_dir()) % "/.icons");
|
findIconThemesInDir(iconThemes, QString(g_get_home_dir()) % "/.icons");
|
||||||
|
|
||||||
// search for icons in system data dir
|
// search for icons in system data dir
|
||||||
const char* const* dataDirs = g_get_system_data_dirs();
|
const char* const* dataDirs = g_get_system_data_dirs();
|
||||||
for(const char* const* dataDir = dataDirs; *dataDir; ++dataDir) {
|
for(const char* const* dataDir = dataDirs; *dataDir; ++dataDir) {
|
||||||
findIconThemesInDir(iconThemes, QString(*dataDir) % "/icons");
|
findIconThemesInDir(iconThemes, QString(*dataDir) % "/icons");
|
||||||
|
}
|
||||||
|
|
||||||
|
iconThemes.remove("hicolor"); // remove hicolor, which is only a fallback
|
||||||
|
QHash<QString, QString>::const_iterator it;
|
||||||
|
for(it = iconThemes.constBegin(); it != iconThemes.constEnd(); ++it) {
|
||||||
|
ui.iconTheme->addItem(it.value(), it.key());
|
||||||
|
}
|
||||||
|
ui.iconTheme->model()->sort(0); // sort the list of icon theme names
|
||||||
|
|
||||||
|
// select current theme name
|
||||||
|
int n = ui.iconTheme->count();
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < n; ++i) {
|
||||||
|
QVariant itemData = ui.iconTheme->itemData(i);
|
||||||
|
if(itemData == settings.fallbackIconThemeName()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i >= n) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
ui.iconTheme->setCurrentIndex(i);
|
||||||
|
}
|
||||||
|
else { // auto-detection of icon theme works, hide the fallback icon theme combo box.
|
||||||
|
ui.iconThemeLabel->hide();
|
||||||
|
ui.iconTheme->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
iconThemes.remove("hicolor"); // remove hicolor, which is only a fallback
|
ui.hMargin->setValue(settings.folderViewCellMargins().width());
|
||||||
QHash<QString, QString>::const_iterator it;
|
ui.vMargin->setValue(settings.folderViewCellMargins().height());
|
||||||
for(it = iconThemes.begin(); it != iconThemes.end(); ++it) {
|
connect(ui.lockMargins, &QAbstractButton::clicked, this, &PreferencesDialog::lockMargins);
|
||||||
ui.iconTheme->addItem(it.value(), it.key());
|
|
||||||
}
|
|
||||||
ui.iconTheme->model()->sort(0); // sort the list of icon theme names
|
|
||||||
|
|
||||||
// select current theme name
|
|
||||||
int n = ui.iconTheme->count();
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < n; ++i) {
|
|
||||||
QVariant itemData = ui.iconTheme->itemData(i);
|
|
||||||
if(itemData == settings.fallbackIconThemeName()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(i >= n)
|
|
||||||
i = 0;
|
|
||||||
ui.iconTheme->setCurrentIndex(i);
|
|
||||||
}
|
|
||||||
else { // auto-detection of icon theme works, hide the fallback icon theme combo box.
|
|
||||||
ui.iconThemeLabel->hide();
|
|
||||||
ui.iconTheme->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.hMargin->setValue(settings.folderViewCellMargins().width());
|
|
||||||
ui.vMargin->setValue(settings.folderViewCellMargins().height());
|
|
||||||
connect(ui.lockMargins, &QAbstractButton::clicked, this, &PreferencesDialog::lockMargins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initArchivers(Settings& settings) {
|
void PreferencesDialog::initArchivers(Settings& settings) {
|
||||||
const GList* allArchivers = fm_archiver_get_all();
|
const GList* allArchivers = fm_archiver_get_all();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(const GList* l = allArchivers; l; l = l->next, ++i) {
|
for(const GList* l = allArchivers; l; l = l->next, ++i) {
|
||||||
FmArchiver* archiver = reinterpret_cast<FmArchiver*>(l->data);
|
FmArchiver* archiver = reinterpret_cast<FmArchiver*>(l->data);
|
||||||
ui.archiver->addItem(archiver->program, QString(archiver->program));
|
ui.archiver->addItem(archiver->program, QString(archiver->program));
|
||||||
if(archiver->program == settings.archiver())
|
if(archiver->program == settings.archiver()) {
|
||||||
ui.archiver->setCurrentIndex(i);
|
ui.archiver->setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initDisplayPage(Settings& settings) {
|
void PreferencesDialog::initDisplayPage(Settings& settings) {
|
||||||
initIconThemes(settings);
|
initIconThemes(settings);
|
||||||
// icon sizes
|
// icon sizes
|
||||||
for(std::size_t i = 0; i < G_N_ELEMENTS(bigIconSizes); ++i) {
|
int i = 0;
|
||||||
int size = bigIconSizes[i];
|
for (const auto & size : Settings::iconSizes(Settings::Big)) {
|
||||||
ui.bigIconSize->addItem(QString("%1 x %1").arg(size), size);
|
ui.bigIconSize->addItem(QString("%1 x %1").arg(size), size);
|
||||||
if(settings.bigIconSize() == size)
|
if(settings.bigIconSize() == size) {
|
||||||
ui.bigIconSize->setCurrentIndex(i);
|
ui.bigIconSize->setCurrentIndex(i);
|
||||||
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
for(std::size_t i = 0; i < G_N_ELEMENTS(smallIconSizes); ++i) {
|
i = 0;
|
||||||
int size = smallIconSizes[i];
|
for (const auto & size : Settings::iconSizes(Settings::Small)) {
|
||||||
QString text = QString("%1 x %1").arg(size);
|
QString text = QString("%1 x %1").arg(size);
|
||||||
ui.smallIconSize->addItem(text, size);
|
ui.smallIconSize->addItem(text, size);
|
||||||
if(settings.smallIconSize() == size)
|
if(settings.smallIconSize() == size) {
|
||||||
ui.smallIconSize->setCurrentIndex(i);
|
ui.smallIconSize->setCurrentIndex(i);
|
||||||
|
}
|
||||||
|
|
||||||
ui.sidePaneIconSize->addItem(text, size);
|
ui.sidePaneIconSize->addItem(text, size);
|
||||||
if(settings.sidePaneIconSize() == size)
|
if(settings.sidePaneIconSize() == size) {
|
||||||
ui.sidePaneIconSize->setCurrentIndex(i);
|
ui.sidePaneIconSize->setCurrentIndex(i);
|
||||||
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
for(std::size_t i = 0; i < G_N_ELEMENTS(thumbnailIconSizes); ++i) {
|
i = 0;
|
||||||
int size = thumbnailIconSizes[i];
|
for (const auto & size : Settings::iconSizes(Settings::Thumbnail)) {
|
||||||
ui.thumbnailIconSize->addItem(QString("%1 x %1").arg(size), size);
|
ui.thumbnailIconSize->addItem(QString("%1 x %1").arg(size), size);
|
||||||
if(settings.thumbnailIconSize() == size)
|
if(settings.thumbnailIconSize() == size) {
|
||||||
ui.thumbnailIconSize->setCurrentIndex(i);
|
ui.thumbnailIconSize->setCurrentIndex(i);
|
||||||
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.siUnit->setChecked(settings.siUnit());
|
ui.siUnit->setChecked(settings.siUnit());
|
||||||
@ -168,218 +174,224 @@ void PreferencesDialog::initDisplayPage(Settings& settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initUiPage(Settings& settings) {
|
void PreferencesDialog::initUiPage(Settings& settings) {
|
||||||
ui.alwaysShowTabs->setChecked(settings.alwaysShowTabs());
|
ui.alwaysShowTabs->setChecked(settings.alwaysShowTabs());
|
||||||
ui.fullWidthTabbar->setChecked(settings.fullWidthTabBar());
|
ui.fullWidthTabbar->setChecked(settings.fullWidthTabBar());
|
||||||
ui.showTabClose->setChecked(settings.showTabClose());
|
ui.showTabClose->setChecked(settings.showTabClose());
|
||||||
ui.rememberWindowSize->setChecked(settings.rememberWindowSize());
|
ui.rememberWindowSize->setChecked(settings.rememberWindowSize());
|
||||||
ui.fixedWindowWidth->setValue(settings.fixedWindowWidth());
|
ui.fixedWindowWidth->setValue(settings.fixedWindowWidth());
|
||||||
ui.fixedWindowHeight->setValue(settings.fixedWindowHeight());
|
ui.fixedWindowHeight->setValue(settings.fixedWindowHeight());
|
||||||
|
|
||||||
// FIXME: Hide options that we don't support yet.
|
// FIXME: Hide options that we don't support yet.
|
||||||
ui.showInPlaces->parentWidget()->hide();
|
ui.showInPlaces->parentWidget()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initBehaviorPage(Settings& settings) {
|
void PreferencesDialog::initBehaviorPage(Settings& settings) {
|
||||||
ui.singleClick->setChecked(settings.singleClick());
|
ui.singleClick->setChecked(settings.singleClick());
|
||||||
ui.autoSelectionDelay->setValue(double(settings.autoSelectionDelay()) / 1000);
|
ui.autoSelectionDelay->setValue(double(settings.autoSelectionDelay()) / 1000);
|
||||||
|
|
||||||
ui.bookmarkOpenMethod->setCurrentIndex(settings.bookmarkOpenMethod());
|
ui.bookmarkOpenMethod->setCurrentIndex(settings.bookmarkOpenMethod());
|
||||||
|
|
||||||
ui.viewMode->addItem(tr("Icon View"), (int)Fm::FolderView::IconMode);
|
ui.viewMode->addItem(tr("Icon View"), (int)Fm::FolderView::IconMode);
|
||||||
ui.viewMode->addItem(tr("Compact View"), (int)Fm::FolderView::CompactMode);
|
ui.viewMode->addItem(tr("Compact View"), (int)Fm::FolderView::CompactMode);
|
||||||
ui.viewMode->addItem(tr("Thumbnail View"), (int)Fm::FolderView::ThumbnailMode);
|
ui.viewMode->addItem(tr("Thumbnail View"), (int)Fm::FolderView::ThumbnailMode);
|
||||||
ui.viewMode->addItem(tr("Detailed List View"), (int)Fm::FolderView::DetailedListMode);
|
ui.viewMode->addItem(tr("Detailed List View"), (int)Fm::FolderView::DetailedListMode);
|
||||||
const Fm::FolderView::ViewMode modes[] = {
|
const Fm::FolderView::ViewMode modes[] = {
|
||||||
Fm::FolderView::IconMode,
|
Fm::FolderView::IconMode,
|
||||||
Fm::FolderView::CompactMode,
|
Fm::FolderView::CompactMode,
|
||||||
Fm::FolderView::ThumbnailMode,
|
Fm::FolderView::ThumbnailMode,
|
||||||
Fm::FolderView::DetailedListMode
|
Fm::FolderView::DetailedListMode
|
||||||
};
|
};
|
||||||
for(std::size_t i = 0; i < G_N_ELEMENTS(modes); ++i) {
|
for(std::size_t i = 0; i < G_N_ELEMENTS(modes); ++i) {
|
||||||
if(modes[i] == settings.viewMode()) {
|
if(modes[i] == settings.viewMode()) {
|
||||||
ui.viewMode->setCurrentIndex(i);
|
ui.viewMode->setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ui.configmDelete->setChecked(settings.confirmDelete());
|
ui.configmDelete->setChecked(settings.confirmDelete());
|
||||||
|
|
||||||
if(settings.supportTrash())
|
if(settings.supportTrash()) {
|
||||||
ui.useTrash->setChecked(settings.useTrash());
|
ui.useTrash->setChecked(settings.useTrash());
|
||||||
else {
|
}
|
||||||
ui.useTrash->hide();
|
else {
|
||||||
}
|
ui.useTrash->hide();
|
||||||
|
}
|
||||||
|
|
||||||
ui.noUsbTrash->setChecked(settings.noUsbTrash());
|
ui.noUsbTrash->setChecked(settings.noUsbTrash());
|
||||||
ui.confirmTrash->setChecked(settings.confirmTrash());
|
ui.confirmTrash->setChecked(settings.confirmTrash());
|
||||||
ui.quickExec->setChecked(settings.quickExec());
|
ui.quickExec->setChecked(settings.quickExec());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initThumbnailPage(Settings& settings) {
|
void PreferencesDialog::initThumbnailPage(Settings& settings) {
|
||||||
ui.showThumbnails->setChecked(settings.showThumbnails());
|
ui.showThumbnails->setChecked(settings.showThumbnails());
|
||||||
ui.thumbnailLocal->setChecked(settings.thumbnailLocalFilesOnly());
|
ui.thumbnailLocal->setChecked(settings.thumbnailLocalFilesOnly());
|
||||||
ui.maxThumbnailFileSize->setValue(settings.maxThumbnailFileSize());
|
ui.maxThumbnailFileSize->setValue(settings.maxThumbnailFileSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initVolumePage(Settings& settings) {
|
void PreferencesDialog::initVolumePage(Settings& settings) {
|
||||||
ui.mountOnStartup->setChecked(settings.mountOnStartup());
|
ui.mountOnStartup->setChecked(settings.mountOnStartup());
|
||||||
ui.mountRemovable->setChecked(settings.mountRemovable());
|
ui.mountRemovable->setChecked(settings.mountRemovable());
|
||||||
ui.autoRun->setChecked(settings.autoRun());
|
ui.autoRun->setChecked(settings.autoRun());
|
||||||
if(settings.closeOnUnmount())
|
if(settings.closeOnUnmount()) {
|
||||||
ui.closeOnUnmount->setChecked(true);
|
ui.closeOnUnmount->setChecked(true);
|
||||||
else
|
}
|
||||||
ui.goHomeOnUnmount->setChecked(true);
|
else {
|
||||||
|
ui.goHomeOnUnmount->setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initTerminals(Settings& settings) {
|
void PreferencesDialog::initTerminals(Settings& settings) {
|
||||||
// load the known terminal list from the terminal.list file of libfm
|
// load the known terminal list from the terminal.list file of libfm
|
||||||
QSettings termlist(LIBFM_DATA_DIR "/terminals.list", QSettings::IniFormat);
|
for(auto& terminal: Fm::allKnownTerminals()) {
|
||||||
ui.terminal->addItems(termlist.childGroups());
|
ui.terminal->addItem(terminal.get());
|
||||||
ui.terminal->setEditText(settings.terminal());
|
}
|
||||||
|
ui.terminal->setEditText(settings.terminal());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initAdvancedPage(Settings& settings) {
|
void PreferencesDialog::initAdvancedPage(Settings& settings) {
|
||||||
initArchivers(settings);
|
initArchivers(settings);
|
||||||
initTerminals(settings);
|
initTerminals(settings);
|
||||||
ui.suCommand->setText(settings.suCommand());
|
ui.suCommand->setText(settings.suCommand());
|
||||||
|
|
||||||
ui.onlyUserTemplates->setChecked(settings.onlyUserTemplates());
|
ui.onlyUserTemplates->setChecked(settings.onlyUserTemplates());
|
||||||
ui.templateTypeOnce->setChecked(settings.templateTypeOnce());
|
ui.templateTypeOnce->setChecked(settings.templateTypeOnce());
|
||||||
|
|
||||||
ui.templateRunApp->setChecked(settings.templateRunApp());
|
ui.templateRunApp->setChecked(settings.templateRunApp());
|
||||||
|
|
||||||
// FIXME: Hide options that we don't support yet.
|
// FIXME: Hide options that we don't support yet.
|
||||||
ui.templateRunApp->hide();
|
ui.templateRunApp->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::initFromSettings() {
|
void PreferencesDialog::initFromSettings() {
|
||||||
Settings& settings = static_cast<Application*>(qApp)->settings();
|
Settings& settings = static_cast<Application*>(qApp)->settings();
|
||||||
initDisplayPage(settings);
|
initDisplayPage(settings);
|
||||||
initUiPage(settings);
|
initUiPage(settings);
|
||||||
initBehaviorPage(settings);
|
initBehaviorPage(settings);
|
||||||
initThumbnailPage(settings);
|
initThumbnailPage(settings);
|
||||||
initVolumePage(settings);
|
initVolumePage(settings);
|
||||||
initAdvancedPage(settings);
|
initAdvancedPage(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::applyDisplayPage(Settings& settings) {
|
void PreferencesDialog::applyDisplayPage(Settings& settings) {
|
||||||
if(settings.useFallbackIconTheme()) {
|
if(settings.useFallbackIconTheme()) {
|
||||||
// only apply the value if icon theme combo box is in use
|
// only apply the value if icon theme combo box is in use
|
||||||
// the combo box is hidden when auto-detection of icon theme from xsettings works.
|
// the combo box is hidden when auto-detection of icon theme from xsettings works.
|
||||||
QString newIconTheme = ui.iconTheme->itemData(ui.iconTheme->currentIndex()).toString();
|
QString newIconTheme = ui.iconTheme->itemData(ui.iconTheme->currentIndex()).toString();
|
||||||
if(newIconTheme != settings.fallbackIconThemeName()) {
|
if(newIconTheme != settings.fallbackIconThemeName()) {
|
||||||
settings.setFallbackIconThemeName(newIconTheme);
|
settings.setFallbackIconThemeName(newIconTheme);
|
||||||
QIcon::setThemeName(settings.fallbackIconThemeName());
|
QIcon::setThemeName(settings.fallbackIconThemeName());
|
||||||
// update the UI by emitting a style change event
|
// update the UI by emitting a style change event
|
||||||
Q_FOREACH(QWidget *widget, QApplication::allWidgets()) {
|
Q_FOREACH(QWidget* widget, QApplication::allWidgets()) {
|
||||||
QEvent event(QEvent::StyleChange);
|
QEvent event(QEvent::StyleChange);
|
||||||
QApplication::sendEvent(widget, &event);
|
QApplication::sendEvent(widget, &event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
settings.setBigIconSize(ui.bigIconSize->itemData(ui.bigIconSize->currentIndex()).toInt());
|
settings.setBigIconSize(ui.bigIconSize->itemData(ui.bigIconSize->currentIndex()).toInt());
|
||||||
settings.setSmallIconSize(ui.smallIconSize->itemData(ui.smallIconSize->currentIndex()).toInt());
|
settings.setSmallIconSize(ui.smallIconSize->itemData(ui.smallIconSize->currentIndex()).toInt());
|
||||||
settings.setThumbnailIconSize(ui.thumbnailIconSize->itemData(ui.thumbnailIconSize->currentIndex()).toInt());
|
settings.setThumbnailIconSize(ui.thumbnailIconSize->itemData(ui.thumbnailIconSize->currentIndex()).toInt());
|
||||||
settings.setSidePaneIconSize(ui.sidePaneIconSize->itemData(ui.sidePaneIconSize->currentIndex()).toInt());
|
settings.setSidePaneIconSize(ui.sidePaneIconSize->itemData(ui.sidePaneIconSize->currentIndex()).toInt());
|
||||||
|
|
||||||
settings.setSiUnit(ui.siUnit->isChecked());
|
settings.setSiUnit(ui.siUnit->isChecked());
|
||||||
settings.setBackupAsHidden(ui.backupAsHidden->isChecked());
|
settings.setBackupAsHidden(ui.backupAsHidden->isChecked());
|
||||||
settings.setShowFullNames(ui.showFullNames->isChecked());
|
settings.setShowFullNames(ui.showFullNames->isChecked());
|
||||||
settings.setShadowHidden(ui.shadowHidden->isChecked());
|
settings.setShadowHidden(ui.shadowHidden->isChecked());
|
||||||
settings.setFolderViewCellMargins(QSize(ui.hMargin->value(), ui.vMargin->value()));
|
settings.setFolderViewCellMargins(QSize(ui.hMargin->value(), ui.vMargin->value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::applyUiPage(Settings& settings) {
|
void PreferencesDialog::applyUiPage(Settings& settings) {
|
||||||
settings.setAlwaysShowTabs(ui.alwaysShowTabs->isChecked());
|
settings.setAlwaysShowTabs(ui.alwaysShowTabs->isChecked());
|
||||||
settings.setFullWidthTabBar(ui.fullWidthTabbar->isChecked());
|
settings.setFullWidthTabBar(ui.fullWidthTabbar->isChecked());
|
||||||
settings.setShowTabClose(ui.showTabClose->isChecked());
|
settings.setShowTabClose(ui.showTabClose->isChecked());
|
||||||
settings.setRememberWindowSize(ui.rememberWindowSize->isChecked());
|
settings.setRememberWindowSize(ui.rememberWindowSize->isChecked());
|
||||||
settings.setFixedWindowWidth(ui.fixedWindowWidth->value());
|
settings.setFixedWindowWidth(ui.fixedWindowWidth->value());
|
||||||
settings.setFixedWindowHeight(ui.fixedWindowHeight->value());
|
settings.setFixedWindowHeight(ui.fixedWindowHeight->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::applyBehaviorPage(Settings& settings) {
|
void PreferencesDialog::applyBehaviorPage(Settings& settings) {
|
||||||
settings.setSingleClick(ui.singleClick->isChecked());
|
settings.setSingleClick(ui.singleClick->isChecked());
|
||||||
settings.setAutoSelectionDelay(int(ui.autoSelectionDelay->value() * 1000));
|
settings.setAutoSelectionDelay(int(ui.autoSelectionDelay->value() * 1000));
|
||||||
|
|
||||||
settings.setBookmarkOpenMethod(OpenDirTargetType(ui.bookmarkOpenMethod->currentIndex()));
|
settings.setBookmarkOpenMethod(OpenDirTargetType(ui.bookmarkOpenMethod->currentIndex()));
|
||||||
|
|
||||||
// FIXME: bug here?
|
// FIXME: bug here?
|
||||||
Fm::FolderView::ViewMode mode = Fm::FolderView::ViewMode(ui.viewMode->itemData(ui.viewMode->currentIndex()).toInt());
|
Fm::FolderView::ViewMode mode = Fm::FolderView::ViewMode(ui.viewMode->itemData(ui.viewMode->currentIndex()).toInt());
|
||||||
settings.setViewMode(mode);
|
settings.setViewMode(mode);
|
||||||
settings.setConfirmDelete(ui.configmDelete->isChecked());
|
settings.setConfirmDelete(ui.configmDelete->isChecked());
|
||||||
|
|
||||||
if(settings.supportTrash())
|
if(settings.supportTrash()) {
|
||||||
settings.setUseTrash(ui.useTrash->isChecked());
|
settings.setUseTrash(ui.useTrash->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
settings.setNoUsbTrash(ui.noUsbTrash->isChecked());
|
settings.setNoUsbTrash(ui.noUsbTrash->isChecked());
|
||||||
settings.setConfirmTrash(ui.confirmTrash->isChecked());
|
settings.setConfirmTrash(ui.confirmTrash->isChecked());
|
||||||
settings.setQuickExec(ui.quickExec->isChecked());
|
settings.setQuickExec(ui.quickExec->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::applyThumbnailPage(Settings& settings) {
|
void PreferencesDialog::applyThumbnailPage(Settings& settings) {
|
||||||
settings.setShowThumbnails(ui.showThumbnails->isChecked());
|
settings.setShowThumbnails(ui.showThumbnails->isChecked());
|
||||||
settings.setThumbnailLocalFilesOnly(ui.thumbnailLocal->isChecked());
|
settings.setThumbnailLocalFilesOnly(ui.thumbnailLocal->isChecked());
|
||||||
settings.setMaxThumbnailFileSize(ui.maxThumbnailFileSize->value());
|
settings.setMaxThumbnailFileSize(ui.maxThumbnailFileSize->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::applyVolumePage(Settings& settings) {
|
void PreferencesDialog::applyVolumePage(Settings& settings) {
|
||||||
settings.setAutoRun(ui.autoRun->isChecked());
|
settings.setAutoRun(ui.autoRun->isChecked());
|
||||||
settings.setMountOnStartup(ui.mountOnStartup->isChecked());
|
settings.setMountOnStartup(ui.mountOnStartup->isChecked());
|
||||||
settings.setMountRemovable(ui.mountRemovable->isChecked());
|
settings.setMountRemovable(ui.mountRemovable->isChecked());
|
||||||
settings.setCloseOnUnmount(ui.closeOnUnmount->isChecked());
|
settings.setCloseOnUnmount(ui.closeOnUnmount->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::applyAdvancedPage(Settings& settings) {
|
void PreferencesDialog::applyAdvancedPage(Settings& settings) {
|
||||||
settings.setTerminal(ui.terminal->currentText());
|
settings.setTerminal(ui.terminal->currentText());
|
||||||
settings.setSuCommand(ui.suCommand->text());
|
settings.setSuCommand(ui.suCommand->text());
|
||||||
settings.setArchiver(ui.archiver->itemData(ui.archiver->currentIndex()).toString());
|
settings.setArchiver(ui.archiver->itemData(ui.archiver->currentIndex()).toString());
|
||||||
|
|
||||||
settings.setOnlyUserTemplates(ui.onlyUserTemplates->isChecked());
|
settings.setOnlyUserTemplates(ui.onlyUserTemplates->isChecked());
|
||||||
settings.setTemplateTypeOnce(ui.templateTypeOnce->isChecked());
|
settings.setTemplateTypeOnce(ui.templateTypeOnce->isChecked());
|
||||||
settings.setTemplateRunApp(ui.templateRunApp->isChecked());
|
settings.setTemplateRunApp(ui.templateRunApp->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreferencesDialog::applySettings() {
|
void PreferencesDialog::applySettings() {
|
||||||
Settings& settings = static_cast<Application*>(qApp)->settings();
|
Settings& settings = static_cast<Application*>(qApp)->settings();
|
||||||
applyDisplayPage(settings);
|
applyDisplayPage(settings);
|
||||||
applyUiPage(settings);
|
applyUiPage(settings);
|
||||||
applyBehaviorPage(settings);
|
applyBehaviorPage(settings);
|
||||||
applyThumbnailPage(settings);
|
applyThumbnailPage(settings);
|
||||||
applyVolumePage(settings);
|
applyVolumePage(settings);
|
||||||
applyAdvancedPage(settings);
|
applyAdvancedPage(settings);
|
||||||
|
|
||||||
settings.save();
|
settings.save();
|
||||||
|
|
||||||
Application* app = static_cast<Application*>(qApp);
|
Application* app = static_cast<Application*>(qApp);
|
||||||
app->updateFromSettings();
|
app->updateFromSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::accept() {
|
void PreferencesDialog::accept() {
|
||||||
applySettings();
|
applySettings();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::selectPage(QString name) {
|
void PreferencesDialog::selectPage(QString name) {
|
||||||
if(!name.isEmpty()) {
|
if(!name.isEmpty()) {
|
||||||
QWidget* page = findChild<QWidget*>(name + "Page");
|
QWidget* page = findChild<QWidget*>(name + "Page");
|
||||||
if(page) {
|
if(page) {
|
||||||
int index = ui.stackedWidget->indexOf(page);
|
int index = ui.stackedWidget->indexOf(page);
|
||||||
ui.listWidget->setCurrentRow(index);
|
ui.listWidget->setCurrentRow(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::lockMargins(bool lock) {
|
void PreferencesDialog::lockMargins(bool lock) {
|
||||||
ui.vMargin->setDisabled(lock);
|
ui.vMargin->setDisabled(lock);
|
||||||
if(lock) {
|
if(lock) {
|
||||||
ui.vMargin->setValue(ui.hMargin->value());
|
ui.vMargin->setValue(ui.hMargin->value());
|
||||||
connect(ui.hMargin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), ui.vMargin, &QSpinBox::setValue);
|
connect(ui.hMargin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), ui.vMargin, &QSpinBox::setValue);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
disconnect(ui.hMargin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), ui.vMargin, &QSpinBox::setValue);
|
disconnect(ui.hMargin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), ui.vMargin, &QSpinBox::setValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace PCManFM
|
} // namespace PCManFM
|
||||||
|
@ -25,49 +25,48 @@
|
|||||||
#include "ui_preferences.h"
|
#include "ui_preferences.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace PCManFM
|
namespace PCManFM {
|
||||||
{
|
|
||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
class PreferencesDialog : public QDialog {
|
class PreferencesDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// activePage is the name of page to select (general, display, advanced...)
|
// activePage is the name of page to select (general, display, advanced...)
|
||||||
explicit PreferencesDialog(QString activePage = QString(), QWidget* parent = 0);
|
explicit PreferencesDialog(QString activePage = QString(), QWidget* parent = 0);
|
||||||
virtual ~PreferencesDialog();
|
virtual ~PreferencesDialog();
|
||||||
|
|
||||||
virtual void accept();
|
virtual void accept();
|
||||||
|
|
||||||
void selectPage(QString name);
|
void selectPage(QString name);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void lockMargins(bool lock);
|
void lockMargins(bool lock);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initIconThemes(Settings& settings);
|
void initIconThemes(Settings& settings);
|
||||||
void initArchivers(Settings& settings);
|
void initArchivers(Settings& settings);
|
||||||
void initDisplayPage(Settings& settings);
|
void initDisplayPage(Settings& settings);
|
||||||
void initUiPage(Settings& settings);
|
void initUiPage(Settings& settings);
|
||||||
void initBehaviorPage(Settings& settings);
|
void initBehaviorPage(Settings& settings);
|
||||||
void initThumbnailPage(Settings& settings);
|
void initThumbnailPage(Settings& settings);
|
||||||
void initVolumePage(Settings& settings);
|
void initVolumePage(Settings& settings);
|
||||||
void initAdvancedPage(Settings& settings);
|
void initAdvancedPage(Settings& settings);
|
||||||
void initTerminals(Settings& settings);
|
void initTerminals(Settings& settings);
|
||||||
|
|
||||||
void applyUiPage(Settings& settings);
|
void applyUiPage(Settings& settings);
|
||||||
void applyDisplayPage(Settings& settings);
|
void applyDisplayPage(Settings& settings);
|
||||||
void applyBehaviorPage(Settings& settings);
|
void applyBehaviorPage(Settings& settings);
|
||||||
void applyThumbnailPage(Settings& settings);
|
void applyThumbnailPage(Settings& settings);
|
||||||
void applyVolumePage(Settings& settings);
|
void applyVolumePage(Settings& settings);
|
||||||
void applyAdvancedPage(Settings& settings);
|
void applyAdvancedPage(Settings& settings);
|
||||||
|
|
||||||
void initFromSettings();
|
void initFromSettings();
|
||||||
void applySettings();
|
void applySettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PreferencesDialog ui;
|
Ui::PreferencesDialog ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
1045
pcmanfm/settings.cpp
1045
pcmanfm/settings.cpp
File diff suppressed because it is too large
Load Diff
1432
pcmanfm/settings.h
1432
pcmanfm/settings.h
File diff suppressed because it is too large
Load Diff
96
pcmanfm/statusbar.cpp
Normal file
96
pcmanfm/statusbar.cpp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "statusbar.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QStyleOption>
|
||||||
|
|
||||||
|
#define MESSAGE_DELAY 250
|
||||||
|
|
||||||
|
namespace PCManFM {
|
||||||
|
|
||||||
|
Label::Label(QWidget* parent, Qt::WindowFlags f):
|
||||||
|
QLabel(parent, f),
|
||||||
|
lastWidth_(0) {
|
||||||
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
|
// set a min width to prevent the window from widening with long texts
|
||||||
|
setMinimumWidth(fontMetrics().averageCharWidth() * 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// A simplified version of QLabel::paintEvent()
|
||||||
|
// without pixmap or shortcut but with eliding.
|
||||||
|
void Label::paintEvent(QPaintEvent* /*event*/) {
|
||||||
|
QRect cr = contentsRect().adjusted(margin(), margin(), -margin(), -margin());
|
||||||
|
QString txt = text();
|
||||||
|
// if the text is changed or its rect is resized (due to window resizing),
|
||||||
|
// find whether it needs to be elided...
|
||||||
|
if (txt != lastText_ || cr.width() != lastWidth_) {
|
||||||
|
lastText_ = txt;
|
||||||
|
lastWidth_ = cr.width();
|
||||||
|
elidedText_ = fontMetrics().elidedText(txt, Qt::ElideMiddle, cr.width());
|
||||||
|
}
|
||||||
|
// ... then, draw the (elided) text
|
||||||
|
if(!elidedText_.isEmpty()) {
|
||||||
|
QPainter painter(this);
|
||||||
|
QStyleOption opt;
|
||||||
|
opt.initFrom(this);
|
||||||
|
style()->drawItemText(&painter, cr, alignment(), opt.palette, isEnabled(), elidedText_, foregroundRole());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusBar::StatusBar(QWidget *parent):
|
||||||
|
QStatusBar(parent),
|
||||||
|
lastTimeOut_(0) {
|
||||||
|
statusLabel_ = new Label();
|
||||||
|
statusLabel_->setFrameShape(QFrame::NoFrame);
|
||||||
|
// 4px space on both sides (not to be mixed with the permanent widget)
|
||||||
|
statusLabel_->setContentsMargins(4, 0, 4, 0);
|
||||||
|
addWidget(statusLabel_);
|
||||||
|
|
||||||
|
messageTimer_ = new QTimer (this);
|
||||||
|
messageTimer_->setSingleShot(true);
|
||||||
|
messageTimer_->setInterval(MESSAGE_DELAY);
|
||||||
|
connect(messageTimer_, &QTimer::timeout, this, &StatusBar::reallyShowMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusBar::~StatusBar() {
|
||||||
|
if(messageTimer_) {
|
||||||
|
messageTimer_->stop();
|
||||||
|
delete messageTimer_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::showMessage(const QString &message, int timeout) {
|
||||||
|
// don't show the message immediately
|
||||||
|
lastMessage_ = message;
|
||||||
|
lastTimeOut_ = timeout;
|
||||||
|
if(!messageTimer_->isActive()) {
|
||||||
|
messageTimer_->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::reallyShowMessage() {
|
||||||
|
if(lastTimeOut_ == 0) {
|
||||||
|
// set the text on the label to prevent its disappearance on focusing menubar items
|
||||||
|
// and also ensure that it contsains no newline (because file names may contain it)
|
||||||
|
statusLabel_->setText(lastMessage_.replace(QLatin1Char('\n'), QLatin1Char(' ')));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QStatusBar::showMessage(lastMessage_, lastTimeOut_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
63
pcmanfm/statusbar.h
Normal file
63
pcmanfm/statusbar.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FM_STATUSBAR_H
|
||||||
|
#define FM_STATUSBAR_H
|
||||||
|
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
namespace PCManFM {
|
||||||
|
|
||||||
|
class Label : public QLabel {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Label(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString elidedText_;
|
||||||
|
QString lastText_;
|
||||||
|
int lastWidth_;
|
||||||
|
};
|
||||||
|
|
||||||
|
class StatusBar : public QStatusBar {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit StatusBar(QWidget *parent = 0);
|
||||||
|
~StatusBar();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void showMessage(const QString &message, int timeout = 0);
|
||||||
|
|
||||||
|
protected Q_SLOTS:
|
||||||
|
void reallyShowMessage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Label* statusLabel_; // for a stable (elided) text
|
||||||
|
QTimer* messageTimer_;
|
||||||
|
QString lastMessage_;
|
||||||
|
int lastTimeOut_;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FM_STATUSBAR_H
|
File diff suppressed because it is too large
Load Diff
@ -27,16 +27,18 @@
|
|||||||
#include <libfm-qt/browsehistory.h>
|
#include <libfm-qt/browsehistory.h>
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include <libfm-qt/path.h>
|
#include <libfm-qt/path.h>
|
||||||
#include <libfm-qt/folder.h>
|
|
||||||
#include <libfm-qt/fileinfo.h>
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include <libfm-qt/core/fileinfo.h>
|
||||||
|
#include <libfm-qt/core/filepath.h>
|
||||||
|
#include <libfm-qt/core/folder.h>
|
||||||
|
|
||||||
namespace Fm {
|
namespace Fm {
|
||||||
class FileLauncher;
|
class FileLauncher;
|
||||||
class FolderModel;
|
class FolderModel;
|
||||||
class ProxyFolderModel;
|
class ProxyFolderModel;
|
||||||
class CachedFolderModel;
|
class CachedFolderModel;
|
||||||
};
|
}
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
|
|
||||||
@ -44,205 +46,200 @@ class Launcher;
|
|||||||
|
|
||||||
class ProxyFilter : public Fm::ProxyFolderModelFilter {
|
class ProxyFilter : public Fm::ProxyFolderModelFilter {
|
||||||
public:
|
public:
|
||||||
bool filterAcceptsRow(const Fm::ProxyFolderModel* model, FmFileInfo* info) const;
|
bool filterAcceptsRow(const Fm::ProxyFolderModel* model, const std::shared_ptr<const Fm::FileInfo>& info) const;
|
||||||
virtual ~ProxyFilter() {}
|
virtual ~ProxyFilter() {}
|
||||||
void setVirtHidden(Fm::Folder folder);
|
void setVirtHidden(const std::shared_ptr<Fm::Folder>& folder);
|
||||||
QString getFilterStr() {
|
QString getFilterStr() {
|
||||||
return filterStr_;
|
return filterStr_;
|
||||||
}
|
}
|
||||||
void setFilterStr(QString str) {
|
void setFilterStr(QString str) {
|
||||||
filterStr_ = str;
|
filterStr_ = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString filterStr_;
|
QString filterStr_;
|
||||||
QStringList virtHiddenList_;
|
QStringList virtHiddenList_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabPage : public QWidget {
|
class TabPage : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum StatusTextType {
|
enum StatusTextType {
|
||||||
StatusTextNormal,
|
StatusTextNormal,
|
||||||
StatusTextSelectedFiles,
|
StatusTextSelectedFiles,
|
||||||
StatusTextFSInfo,
|
StatusTextFSInfo,
|
||||||
StatusTextNum
|
StatusTextNum
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TabPage(Fm::Path path, QWidget* parent = nullptr);
|
explicit TabPage(QWidget* parent = nullptr);
|
||||||
virtual ~TabPage();
|
virtual ~TabPage();
|
||||||
|
|
||||||
void chdir(Fm::Path newPath, bool addHistory = true);
|
void chdir(Fm::FilePath newPath, bool addHistory = true);
|
||||||
|
|
||||||
Fm::FolderView::ViewMode viewMode() {
|
Fm::FolderView::ViewMode viewMode() {
|
||||||
return folderSettings_.viewMode();
|
return folderSettings_.viewMode();
|
||||||
}
|
|
||||||
|
|
||||||
void setViewMode(Fm::FolderView::ViewMode mode);
|
|
||||||
|
|
||||||
void sort(int col, Qt::SortOrder order = Qt::AscendingOrder);
|
|
||||||
|
|
||||||
int sortColumn() {
|
|
||||||
return folderSettings_.sortColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::SortOrder sortOrder() {
|
|
||||||
return folderSettings_.sortOrder();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool sortFolderFirst() {
|
|
||||||
return folderSettings_.sortFolderFirst();
|
|
||||||
}
|
|
||||||
void setSortFolderFirst(bool value);
|
|
||||||
|
|
||||||
bool sortCaseSensitive() {
|
|
||||||
return folderSettings_.sortCaseSensitive();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSortCaseSensitive(bool value);
|
|
||||||
|
|
||||||
bool showHidden() {
|
|
||||||
return folderSettings_.showHidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setShowHidden(bool showHidden);
|
|
||||||
|
|
||||||
Fm::Path path() {
|
|
||||||
return Fm::Path(!folder_.isNull() ? folder_.getPath() : nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString pathName();
|
|
||||||
|
|
||||||
Fm::Folder& folder() {
|
|
||||||
return folder_;
|
|
||||||
}
|
|
||||||
|
|
||||||
Fm::FolderModel* folderModel() {
|
|
||||||
return reinterpret_cast<Fm::FolderModel*>(folderModel_);
|
|
||||||
}
|
|
||||||
|
|
||||||
View* folderView() {
|
|
||||||
return folderView_;
|
|
||||||
}
|
|
||||||
|
|
||||||
Fm::BrowseHistory& browseHistory() {
|
|
||||||
return history_;
|
|
||||||
}
|
|
||||||
|
|
||||||
Fm::FileInfoList selectedFiles() {
|
|
||||||
return folderView_->selectedFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
Fm::PathList selectedFilePaths() {
|
|
||||||
return folderView_->selectedFilePaths();
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectAll();
|
|
||||||
|
|
||||||
void invertSelection();
|
|
||||||
|
|
||||||
void reload() {
|
|
||||||
if(!folder_.isNull()) {
|
|
||||||
proxyFilter_->setVirtHidden(folder_); // reread ".hidden"
|
|
||||||
folder_.reload();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QString title() const {
|
void setViewMode(Fm::FolderView::ViewMode mode);
|
||||||
return title_;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString statusText(StatusTextType type = StatusTextNormal) const {
|
void sort(int col, Qt::SortOrder order = Qt::AscendingOrder);
|
||||||
return statusText_[type];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool canBackward() {
|
int sortColumn() {
|
||||||
return history_.canBackward();
|
return folderSettings_.sortColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void backward();
|
Qt::SortOrder sortOrder() {
|
||||||
|
return folderSettings_.sortOrder();
|
||||||
|
}
|
||||||
|
|
||||||
bool canForward() {
|
bool sortFolderFirst() {
|
||||||
return history_.canForward();
|
return folderSettings_.sortFolderFirst();
|
||||||
}
|
}
|
||||||
|
void setSortFolderFirst(bool value);
|
||||||
|
|
||||||
void forward();
|
bool sortCaseSensitive() {
|
||||||
|
return folderSettings_.sortCaseSensitive();
|
||||||
|
}
|
||||||
|
|
||||||
void jumpToHistory(int index);
|
void setSortCaseSensitive(bool value);
|
||||||
|
|
||||||
bool canUp();
|
bool showHidden() {
|
||||||
|
return proxyModel_->showHidden();
|
||||||
|
}
|
||||||
|
|
||||||
void up();
|
void setShowHidden(bool showHidden);
|
||||||
|
|
||||||
void updateFromSettings(Settings& settings);
|
Fm::FilePath path() {
|
||||||
|
return folder_ ? folder_->path() : Fm::FilePath();
|
||||||
|
}
|
||||||
|
|
||||||
void setFileLauncher(Fm::FileLauncher* launcher) {
|
QString pathName();
|
||||||
folderView_->setFileLauncher(launcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
Fm::FileLauncher* fileLauncher() {
|
const std::shared_ptr<Fm::Folder>& folder() {
|
||||||
return folderView_->fileLauncher();
|
return folder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getFilterStr() {
|
Fm::FolderModel* folderModel() {
|
||||||
if(proxyFilter_)
|
return reinterpret_cast<Fm::FolderModel*>(folderModel_);
|
||||||
return proxyFilter_->getFilterStr();
|
}
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFilterStr(QString str) {
|
View* folderView() {
|
||||||
if(proxyFilter_)
|
return folderView_;
|
||||||
proxyFilter_->setFilterStr(str);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void applyFilter();
|
Fm::BrowseHistory& browseHistory() {
|
||||||
|
return history_;
|
||||||
|
}
|
||||||
|
|
||||||
bool hasCustomizedView() {
|
Fm::FileInfoList selectedFiles() {
|
||||||
return folderSettings_.isCustomized();
|
return folderView_->selectedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCustomizedView(bool value);
|
Fm::FilePathList selectedFilePaths() {
|
||||||
|
return folderView_->selectedFilePaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectAll();
|
||||||
|
|
||||||
|
void invertSelection();
|
||||||
|
|
||||||
|
void reload();
|
||||||
|
|
||||||
|
QString statusText(StatusTextType type = StatusTextNormal) const {
|
||||||
|
return statusText_[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool canBackward() {
|
||||||
|
return history_.canBackward();
|
||||||
|
}
|
||||||
|
|
||||||
|
void backward();
|
||||||
|
|
||||||
|
bool canForward() {
|
||||||
|
return history_.canForward();
|
||||||
|
}
|
||||||
|
|
||||||
|
void forward();
|
||||||
|
|
||||||
|
void jumpToHistory(int index);
|
||||||
|
|
||||||
|
bool canUp();
|
||||||
|
|
||||||
|
void up();
|
||||||
|
|
||||||
|
void updateFromSettings(Settings& settings);
|
||||||
|
|
||||||
|
void setFileLauncher(Fm::FileLauncher* launcher) {
|
||||||
|
folderView_->setFileLauncher(launcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
Fm::FileLauncher* fileLauncher() {
|
||||||
|
return folderView_->fileLauncher();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getFilterStr() {
|
||||||
|
if(proxyFilter_) {
|
||||||
|
return proxyFilter_->getFilterStr();
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFilterStr(QString str) {
|
||||||
|
if(proxyFilter_) {
|
||||||
|
proxyFilter_->setFilterStr(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void applyFilter();
|
||||||
|
|
||||||
|
bool hasCustomizedView() {
|
||||||
|
return folderSettings_.isCustomized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCustomizedView(bool value);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void statusChanged(int type, QString statusText);
|
void statusChanged(int type, QString statusText);
|
||||||
void titleChanged(QString title);
|
void titleChanged(QString title);
|
||||||
void openDirRequested(FmPath* path, int target);
|
void openDirRequested(const Fm::FilePath& path, int target);
|
||||||
void sortFilterChanged();
|
void sortFilterChanged();
|
||||||
void forwardRequested();
|
void forwardRequested();
|
||||||
void backwardRequested();
|
void backwardRequested();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void onOpenDirRequested(FmPath* path, int target);
|
void onSelChanged();
|
||||||
void onSelChanged(int numSel);
|
void onUiUpdated();
|
||||||
void restoreScrollPos();
|
void onFileSizeChanged(const QModelIndex& index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void freeFolder();
|
void freeFolder();
|
||||||
QString formatStatusText();
|
QString formatStatusText();
|
||||||
|
|
||||||
static void onFolderStartLoading(FmFolder* _folder, TabPage* pThis);
|
void onFolderStartLoading();
|
||||||
static void onFolderFinishLoading(FmFolder* _folder, TabPage* pThis);
|
void onFolderFinishLoading();
|
||||||
static FmJobErrorAction onFolderError(FmFolder* _folder, GError* err, FmJobErrorSeverity severity, TabPage* pThis);
|
|
||||||
static void onFolderFsInfo(FmFolder* _folder, TabPage* pThis);
|
// FIXME: this API design is bad and might be removed later
|
||||||
static void onFolderRemoved(FmFolder* _folder, TabPage* pThis);
|
void onFolderError(const Fm::GErrorPtr& err, Fm::Job::ErrorSeverity severity, Fm::Job::ErrorAction& response);
|
||||||
static void onFolderUnmount(FmFolder* _folder, TabPage* pThis);
|
|
||||||
static void onFolderContentChanged(FmFolder* _folder, TabPage* pThis);
|
void onFolderFsInfo();
|
||||||
|
void onFolderRemoved();
|
||||||
|
void onFolderUnmount();
|
||||||
|
void onFolderContentChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
View* folderView_;
|
View* folderView_;
|
||||||
Fm::CachedFolderModel* folderModel_;
|
Fm::CachedFolderModel* folderModel_;
|
||||||
Fm::ProxyFolderModel* proxyModel_;
|
Fm::ProxyFolderModel* proxyModel_;
|
||||||
ProxyFilter* proxyFilter_;
|
ProxyFilter* proxyFilter_;
|
||||||
QVBoxLayout* verticalLayout;
|
QVBoxLayout* verticalLayout;
|
||||||
Fm::Folder folder_;
|
std::shared_ptr<Fm::Folder> folder_;
|
||||||
QString title_;
|
QString statusText_[StatusTextNum];
|
||||||
QString statusText_[StatusTextNum];
|
Fm::BrowseHistory history_; // browsing history
|
||||||
Fm::BrowseHistory history_; // browsing history
|
Fm::FilePath lastFolderPath_; // last browsed folder
|
||||||
Fm::Path lastFolderPath_; // last browsed folder
|
bool overrideCursor_;
|
||||||
bool overrideCursor_;
|
FolderSettings folderSettings_;
|
||||||
FolderSettings folderSettings_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
4
pcmanfm/translations/pcmanfm-qt-desktop-pref_lt.desktop
Normal file
4
pcmanfm/translations/pcmanfm-qt-desktop-pref_lt.desktop
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#Translations
|
||||||
|
Name[lt]=Darbalaukis
|
||||||
|
GenericName[lt]=Darbalaukio nustatymai
|
||||||
|
Comment[lt]=Keisti darbalaukio tvarkytuvės darbalaukio foną ir elgseną
|
4
pcmanfm/translations/pcmanfm-qt_lt.desktop
Normal file
4
pcmanfm/translations/pcmanfm-qt_lt.desktop
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#Translations
|
||||||
|
Name[lt]=PCManFM failų tvarkytuvė
|
||||||
|
GenericName[lt]=Failų tvarkytuvė
|
||||||
|
Comment[lt]=Naršyti failų sistemą ir tvarkyti failus
|
155
pcmanfm/view.cpp
155
pcmanfm/view.cpp
@ -31,48 +31,48 @@
|
|||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
|
|
||||||
View::View(Fm::FolderView::ViewMode _mode, QWidget* parent):
|
View::View(Fm::FolderView::ViewMode _mode, QWidget* parent):
|
||||||
Fm::FolderView(_mode, parent) {
|
Fm::FolderView(_mode, parent) {
|
||||||
|
|
||||||
Settings& settings = static_cast<Application*>(qApp)->settings();
|
Settings& settings = static_cast<Application*>(qApp)->settings();
|
||||||
updateFromSettings(settings);
|
updateFromSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
View::~View() {
|
View::~View() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::onFileClicked(int type, FmFileInfo* fileInfo) {
|
void View::onFileClicked(int type, const std::shared_ptr<const Fm::FileInfo>& fileInfo) {
|
||||||
if(type == MiddleClick) {
|
if(type == MiddleClick) {
|
||||||
if(fm_file_info_is_dir(fileInfo)) {
|
if(fileInfo->isDir()) {
|
||||||
Q_EMIT openDirRequested(fm_file_info_get_path(fileInfo), OpenInNewTab);
|
Q_EMIT openDirRequested(fileInfo->path(), OpenInNewTab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Fm::FolderView::onFileClicked(type, fileInfo);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
Fm::FolderView::onFileClicked(type, fileInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::onNewWindow() {
|
void View::onNewWindow() {
|
||||||
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
|
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
|
||||||
// FIXME: open the files in a new window
|
// FIXME: open the files in a new window
|
||||||
Application* app = static_cast<Application*>(qApp);
|
Application* app = static_cast<Application*>(qApp);
|
||||||
app->openFolders(menu->files());
|
app->openFolders(menu->files());
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::onNewTab() {
|
void View::onNewTab() {
|
||||||
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
|
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
|
||||||
for(GList* l = fm_file_info_list_peek_head_link(menu->files()); l; l = l->next) {
|
auto files = menu->files();
|
||||||
FmFileInfo* file = FM_FILE_INFO(l->data);
|
for(auto& file: files) {
|
||||||
Q_EMIT openDirRequested(fm_file_info_get_path(file), OpenInNewTab);
|
Q_EMIT openDirRequested(file->path(), OpenInNewTab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::onOpenInTerminal() {
|
void View::onOpenInTerminal() {
|
||||||
Application* app = static_cast<Application*>(qApp);
|
Application* app = static_cast<Application*>(qApp);
|
||||||
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
|
Fm::FileMenu* menu = static_cast<Fm::FileMenu*>(sender()->parent());
|
||||||
for(GList* l = fm_file_info_list_peek_head_link(menu->files()); l; l = l->next) {
|
auto files = menu->files();
|
||||||
Fm::FileInfo file = FM_FILE_INFO(l->data);
|
for(auto& file: files) {
|
||||||
app->openFolderInTerminal(file.getPath());
|
app->openFolderInTerminal(file->path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::onSearch() {
|
void View::onSearch() {
|
||||||
@ -80,49 +80,50 @@ void View::onSearch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void View::prepareFileMenu(Fm::FileMenu* menu) {
|
void View::prepareFileMenu(Fm::FileMenu* menu) {
|
||||||
Application* app = static_cast<Application*>(qApp);
|
Application* app = static_cast<Application*>(qApp);
|
||||||
menu->setConfirmDelete(app->settings().confirmDelete());
|
menu->setConfirmDelete(app->settings().confirmDelete());
|
||||||
menu->setConfirmTrash(app->settings().confirmTrash());
|
menu->setConfirmTrash(app->settings().confirmTrash());
|
||||||
menu->setUseTrash(app->settings().useTrash());
|
menu->setUseTrash(app->settings().useTrash());
|
||||||
|
|
||||||
// add some more menu items for dirs
|
// add some more menu items for dirs
|
||||||
bool all_native = true;
|
bool all_native = true;
|
||||||
bool all_directory = true;
|
bool all_directory = true;
|
||||||
Fm::FileInfoList files = menu->files();
|
auto files = menu->files();
|
||||||
for(GList* l = files.peekHeadLink(); l; l = l->next) {
|
for(auto& fi: files) {
|
||||||
Fm::FileInfo fi = FM_FILE_INFO(l->data);
|
if(!fi->isDir()) {
|
||||||
if(!fi.isDir())
|
all_directory = false;
|
||||||
all_directory = false;
|
}
|
||||||
else if(fi.isDir() && !fi.isNative())
|
else if(fi->isDir() && !fi->isNative()) {
|
||||||
all_native = false;
|
all_native = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (all_directory)
|
|
||||||
{
|
if(all_directory) {
|
||||||
QAction* action = new QAction(QIcon::fromTheme("window-new"), tr("Open in New T&ab"), menu);
|
QAction* action = new QAction(QIcon::fromTheme("window-new"), tr("Open in New T&ab"), menu);
|
||||||
connect(action, &QAction::triggered, this, &View::onNewTab);
|
connect(action, &QAction::triggered, this, &View::onNewTab);
|
||||||
menu->insertAction(menu->separator1(), action);
|
menu->insertAction(menu->separator1(), action);
|
||||||
|
|
||||||
action = new QAction(QIcon::fromTheme("window-new"), tr("Open in New Win&dow"), menu);
|
action = new QAction(QIcon::fromTheme("window-new"), tr("Open in New Win&dow"), menu);
|
||||||
connect(action, &QAction::triggered, this, &View::onNewWindow);
|
connect(action, &QAction::triggered, this, &View::onNewWindow);
|
||||||
menu->insertAction(menu->separator1(), action);
|
menu->insertAction(menu->separator1(), action);
|
||||||
|
|
||||||
// TODO: add search
|
// TODO: add search
|
||||||
// action = menu->addAction(_("Search"));
|
// action = menu->addAction(_("Search"));
|
||||||
|
|
||||||
if(all_native)
|
if(all_native) {
|
||||||
{
|
action = new QAction(QIcon::fromTheme("utilities-terminal"), tr("Open in Termina&l"), menu);
|
||||||
action = new QAction(QIcon::fromTheme("utilities-terminal"), tr("Open in Termina&l"), menu);
|
connect(action, &QAction::triggered, this, &View::onOpenInTerminal);
|
||||||
connect(action, &QAction::triggered, this, &View::onOpenInTerminal);
|
menu->insertAction(menu->separator1(), action);
|
||||||
menu->insertAction(menu->separator1(), action);
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(menu->pasteAction()) { // nullptr for trash
|
||||||
|
menu->pasteAction()->setVisible(false);
|
||||||
|
}
|
||||||
|
if(menu->createAction()) {
|
||||||
|
menu->createAction()->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(menu->pasteAction()) // NULL for trash
|
|
||||||
menu->pasteAction()->setVisible(false);
|
|
||||||
if(menu->createAction())
|
|
||||||
menu->createAction()->setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::prepareFolderMenu(Fm::FolderMenu* menu) {
|
void View::prepareFolderMenu(Fm::FolderMenu* menu) {
|
||||||
@ -130,19 +131,19 @@ void View::prepareFolderMenu(Fm::FolderMenu* menu) {
|
|||||||
|
|
||||||
void View::updateFromSettings(Settings& settings) {
|
void View::updateFromSettings(Settings& settings) {
|
||||||
|
|
||||||
setIconSize(Fm::FolderView::IconMode, QSize(settings.bigIconSize(), settings.bigIconSize()));
|
setIconSize(Fm::FolderView::IconMode, QSize(settings.bigIconSize(), settings.bigIconSize()));
|
||||||
setIconSize(Fm::FolderView::CompactMode, QSize(settings.smallIconSize(), settings.smallIconSize()));
|
setIconSize(Fm::FolderView::CompactMode, QSize(settings.smallIconSize(), settings.smallIconSize()));
|
||||||
setIconSize(Fm::FolderView::ThumbnailMode, QSize(settings.thumbnailIconSize(), settings.thumbnailIconSize()));
|
setIconSize(Fm::FolderView::ThumbnailMode, QSize(settings.thumbnailIconSize(), settings.thumbnailIconSize()));
|
||||||
setIconSize(Fm::FolderView::DetailedListMode, QSize(settings.smallIconSize(), settings.smallIconSize()));
|
setIconSize(Fm::FolderView::DetailedListMode, QSize(settings.smallIconSize(), settings.smallIconSize()));
|
||||||
|
|
||||||
setMargins(settings.folderViewCellMargins());
|
setMargins(settings.folderViewCellMargins());
|
||||||
|
|
||||||
setAutoSelectionDelay(settings.autoSelectionDelay());
|
setAutoSelectionDelay(settings.autoSelectionDelay());
|
||||||
|
|
||||||
Fm::ProxyFolderModel* proxyModel = model();
|
Fm::ProxyFolderModel* proxyModel = model();
|
||||||
if(proxyModel) {
|
if(proxyModel) {
|
||||||
proxyModel->setShowThumbnails(settings.showThumbnails());
|
proxyModel->setShowThumbnails(settings.showThumbnails());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace PCManFM
|
} // namespace PCManFM
|
||||||
|
@ -22,10 +22,12 @@
|
|||||||
#define PCMANFM_FOLDERVIEW_H
|
#define PCMANFM_FOLDERVIEW_H
|
||||||
|
|
||||||
#include <libfm-qt/folderview.h>
|
#include <libfm-qt/folderview.h>
|
||||||
|
#include <libfm-qt/core/filepath.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Fm {
|
namespace Fm {
|
||||||
class FileMenu;
|
class FileMenu;
|
||||||
class FolderMenu;
|
class FolderMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PCManFM {
|
namespace PCManFM {
|
||||||
@ -33,38 +35,38 @@ namespace PCManFM {
|
|||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
class View : public Fm::FolderView {
|
class View : public Fm::FolderView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit View(Fm::FolderView::ViewMode _mode = IconMode, QWidget* parent = 0);
|
explicit View(Fm::FolderView::ViewMode _mode = IconMode, QWidget* parent = 0);
|
||||||
virtual ~View();
|
virtual ~View();
|
||||||
|
|
||||||
void updateFromSettings(Settings& settings);
|
void updateFromSettings(Settings& settings);
|
||||||
|
|
||||||
QSize getMargins() const {
|
QSize getMargins() const {
|
||||||
return Fm::FolderView::getMargins();
|
return Fm::FolderView::getMargins();
|
||||||
}
|
}
|
||||||
void setMargins(QSize size) {
|
void setMargins(QSize size) {
|
||||||
Fm::FolderView::setMargins(size);
|
Fm::FolderView::setMargins(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void openDirRequested(FmPath* path, int target);
|
void openDirRequested(const Fm::FilePath& path, int target);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void onNewWindow();
|
void onNewWindow();
|
||||||
void onNewTab();
|
void onNewTab();
|
||||||
void onOpenInTerminal();
|
void onOpenInTerminal();
|
||||||
void onSearch();
|
void onSearch();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onFileClicked(int type, FmFileInfo* fileInfo);
|
virtual void onFileClicked(int type, const std::shared_ptr<const Fm::FileInfo>& fileInfo);
|
||||||
virtual void prepareFileMenu(Fm::FileMenu* menu);
|
virtual void prepareFileMenu(Fm::FileMenu* menu);
|
||||||
virtual void prepareFolderMenu(Fm::FolderMenu* menu);
|
virtual void prepareFolderMenu(Fm::FolderMenu* menu);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
#endif // PCMANFM_FOLDERVIEW_H
|
#endif // PCMANFM_FOLDERVIEW_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user