parent
fcc7687eb5
commit
88a3fff46b
@ -1,10 +0,0 @@
|
|||||||
Upstream Authors:
|
|
||||||
LXQt team: http://lxqt.org
|
|
||||||
Razor team: http://razor-qt.org
|
|
||||||
|
|
||||||
Copyright:
|
|
||||||
Copyright (c) 2010-2012 Razor team
|
|
||||||
Copyright (c) 2012-2017 LXQt team
|
|
||||||
|
|
||||||
License: LGPL-2.1+
|
|
||||||
The full text of the licenses can be found in the 'COPYING' file.
|
|
@ -1,277 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
|
||||||
project(lxqt-panel)
|
|
||||||
|
|
||||||
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
|
|
||||||
option(PULL_TRANSLATIONS "Pull translations" ON)
|
|
||||||
option(WITH_SCREENSAVER_FALLBACK "Include support for converting the deprecated 'screensaver' plugin to 'quicklaunch'. This requires the lxqt-leave (lxqt-session) to be installed in runtime." ON)
|
|
||||||
|
|
||||||
# additional cmake files
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
|
||||||
if(COMPILER_SUPPORTS_CXX11)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
||||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
||||||
else()
|
|
||||||
message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. C++11 support is required")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
macro(setByDefault VAR_NAME VAR_VALUE)
|
|
||||||
if(NOT DEFINED ${VAR_NAME})
|
|
||||||
set (${VAR_NAME} ${VAR_VALUE})
|
|
||||||
endif(NOT DEFINED ${VAR_NAME})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# use gcc visibility feature to decrease unnecessary exported symbols
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
# set visibility to hidden to hide symbols, unlesss they're exporeted manually in the code
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions")
|
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-no-undefined")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
add_definitions (-Wall)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
|
||||||
find_package(Qt5DBus REQUIRED)
|
|
||||||
find_package(Qt5LinguistTools REQUIRED)
|
|
||||||
find_package(Qt5Xml REQUIRED)
|
|
||||||
find_package(Qt5X11Extras REQUIRED)
|
|
||||||
find_package(KF5WindowSystem REQUIRED)
|
|
||||||
|
|
||||||
find_package(lxqt REQUIRED)
|
|
||||||
find_package(lxqt-globalkeys REQUIRED)
|
|
||||||
find_package(lxqt-globalkeys-ui REQUIRED)
|
|
||||||
|
|
||||||
# Patch Version
|
|
||||||
set(LXQT_PANEL_PATCH_VERSION 0)
|
|
||||||
|
|
||||||
set(LXQT_PANEL_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PANEL_PATCH_VERSION})
|
|
||||||
add_definitions("-DLXQT_PANEL_VERSION=\"${LXQT_PANEL_VERSION}\"")
|
|
||||||
|
|
||||||
include(LXQtTranslate)
|
|
||||||
|
|
||||||
# Warning: This must be before add_subdirectory(panel). Move with caution.
|
|
||||||
set(PLUGIN_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/lxqt-panel")
|
|
||||||
add_definitions(
|
|
||||||
-DPLUGIN_DIR=\"${PLUGIN_DIR}\"
|
|
||||||
-DQT_USE_QSTRINGBUILDER
|
|
||||||
)
|
|
||||||
message(STATUS "Panel plugins location: ${PLUGIN_DIR}")
|
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
# Plugin system
|
|
||||||
# You can enable/disable building of the plugin using cmake options.
|
|
||||||
# cmake -DCLOCK_PLUGIN=Yes .. # Enable clock plugin
|
|
||||||
# cmake -DCLOCK_PLUGIN=No .. # Disable clock plugin
|
|
||||||
|
|
||||||
include("cmake/BuildPlugin.cmake")
|
|
||||||
|
|
||||||
set(ENABLED_PLUGINS) # list of enabled plugins
|
|
||||||
set(STATIC_PLUGINS) # list of statically linked plugins
|
|
||||||
|
|
||||||
setByDefault(CLOCK_PLUGIN Yes)
|
|
||||||
if(CLOCK_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "clock")
|
|
||||||
add_definitions(-DWITH_CLOCK_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Clock")
|
|
||||||
add_subdirectory(plugin-clock)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(COLORPICKER_PLUGIN Yes)
|
|
||||||
if(COLORPICKER_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Color Picker")
|
|
||||||
add_subdirectory(plugin-colorpicker)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(CPULOAD_PLUGIN Yes)
|
|
||||||
if(CPULOAD_PLUGIN)
|
|
||||||
find_library(STATGRAB_LIB statgrab)
|
|
||||||
|
|
||||||
if(NOT STATGRAB_LIB)
|
|
||||||
message(FATAL_ERROR "CPU Load plugin requires libstatgrab")
|
|
||||||
endif()
|
|
||||||
list(APPEND ENABLED_PLUGINS "Cpu Load")
|
|
||||||
add_subdirectory(plugin-cpuload)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(DIRECTORYMENU_PLUGIN Yes)
|
|
||||||
if(DIRECTORYMENU_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Directory menu")
|
|
||||||
add_subdirectory(plugin-directorymenu)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(DOM_PLUGIN No)
|
|
||||||
if(DOM_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "DOM")
|
|
||||||
add_subdirectory(plugin-dom)
|
|
||||||
endif(DOM_PLUGIN)
|
|
||||||
|
|
||||||
setByDefault(DESKTOPSWITCH_PLUGIN Yes)
|
|
||||||
if(DESKTOPSWITCH_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "desktopswitch")
|
|
||||||
add_definitions(-DWITH_DESKTOPSWITCH_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Desktop Switcher")
|
|
||||||
add_subdirectory(plugin-desktopswitch)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(KBINDICATOR_PLUGIN Yes)
|
|
||||||
if(KBINDICATOR_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Keyboard Indicator")
|
|
||||||
add_subdirectory(plugin-kbindicator)
|
|
||||||
endif(KBINDICATOR_PLUGIN)
|
|
||||||
|
|
||||||
setByDefault(MAINMENU_PLUGIN Yes)
|
|
||||||
if(MAINMENU_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "mainmenu")
|
|
||||||
add_definitions(-DWITH_MAINMENU_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Application menu")
|
|
||||||
add_subdirectory(plugin-mainmenu)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(MOUNT_PLUGIN Yes)
|
|
||||||
if(MOUNT_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Mount")
|
|
||||||
add_subdirectory(plugin-mount)
|
|
||||||
endif(MOUNT_PLUGIN)
|
|
||||||
|
|
||||||
setByDefault(QUICKLAUNCH_PLUGIN Yes)
|
|
||||||
if(QUICKLAUNCH_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "quicklaunch")
|
|
||||||
add_definitions(-DWITH_QUICKLAUNCH_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Quicklaunch")
|
|
||||||
add_subdirectory(plugin-quicklaunch)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(SENSORS_PLUGIN Yes)
|
|
||||||
if(SENSORS_PLUGIN)
|
|
||||||
find_library(SENSORS_LIB sensors)
|
|
||||||
|
|
||||||
if(NOT SENSORS_LIB)
|
|
||||||
message(FATAL_ERROR "Sensors plugin requires lm_sensors")
|
|
||||||
endif()
|
|
||||||
list(APPEND ENABLED_PLUGINS "Sensors")
|
|
||||||
add_subdirectory(plugin-sensors)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(SHOWDESKTOP_PLUGIN Yes)
|
|
||||||
if(SHOWDESKTOP_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "showdesktop")
|
|
||||||
add_definitions(-DWITH_SHOWDESKTOP_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Show Desktop")
|
|
||||||
add_subdirectory(plugin-showdesktop)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(NETWORKMONITOR_PLUGIN Yes)
|
|
||||||
if(NETWORKMONITOR_PLUGIN)
|
|
||||||
find_library(STATGRAB_LIB statgrab)
|
|
||||||
|
|
||||||
if(NOT STATGRAB_LIB)
|
|
||||||
message(FATAL_ERROR "Network Monitor plugin requires libstatgrab")
|
|
||||||
endif()
|
|
||||||
list(APPEND ENABLED_PLUGINS "Network Monitor")
|
|
||||||
add_subdirectory(plugin-networkmonitor)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(SYSSTAT_PLUGIN Yes)
|
|
||||||
if(SYSSTAT_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "System Stats")
|
|
||||||
add_subdirectory(plugin-sysstat)
|
|
||||||
endif(SYSSTAT_PLUGIN)
|
|
||||||
|
|
||||||
setByDefault(TASKBAR_PLUGIN Yes)
|
|
||||||
if(TASKBAR_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "taskbar")
|
|
||||||
add_definitions(-DWITH_TASKBAR_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Taskbar")
|
|
||||||
add_subdirectory(plugin-taskbar)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(STATUSNOTIFIER_PLUGIN Yes)
|
|
||||||
if(STATUSNOTIFIER_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "statusnotifier")
|
|
||||||
add_definitions(-DWITH_STATUSNOTIFIER_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Status Notifier")
|
|
||||||
add_subdirectory(plugin-statusnotifier)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(TRAY_PLUGIN Yes)
|
|
||||||
if(TRAY_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "tray")
|
|
||||||
add_definitions(-DWITH_TRAY_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "System Tray")
|
|
||||||
add_subdirectory(plugin-tray)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(VOLUME_PLUGIN Yes)
|
|
||||||
setByDefault(VOLUME_USE_PULSEAUDIO Yes)
|
|
||||||
setByDefault(VOLUME_USE_ALSA Yes)
|
|
||||||
if(VOLUME_PLUGIN)
|
|
||||||
if (VOLUME_USE_PULSEAUDIO)
|
|
||||||
find_package(PulseAudio)
|
|
||||||
if (NOT PULSEAUDIO_FOUND)
|
|
||||||
message(FATAL_ERROR "PulseAudio not found, but required (VOLUME_USE_PULSEAUDIO) for Volume plugin!")
|
|
||||||
endif ()
|
|
||||||
endif(VOLUME_USE_PULSEAUDIO)
|
|
||||||
|
|
||||||
if(VOLUME_USE_ALSA)
|
|
||||||
find_package(ALSA)
|
|
||||||
if (NOT ALSA_FOUND)
|
|
||||||
message(FATAL_ERROR "ALSA not found, but required (VOLUME_USE_ALSA) for Volume plugin!")
|
|
||||||
endif ()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND ENABLED_PLUGINS "Volume")
|
|
||||||
message(STATUS "")
|
|
||||||
message(STATUS "Volume plugin will be built")
|
|
||||||
message(STATUS " ALSA: ${ALSA_FOUND}")
|
|
||||||
message(STATUS " PulseAudio: ${PULSEAUDIO_FOUND}")
|
|
||||||
message(STATUS "")
|
|
||||||
add_subdirectory(plugin-volume)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
setByDefault(WORLDCLOCK_PLUGIN Yes)
|
|
||||||
if(WORLDCLOCK_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "worldclock")
|
|
||||||
add_definitions(-DWITH_WORLDCLOCK_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "World Clock")
|
|
||||||
add_subdirectory(plugin-worldclock)
|
|
||||||
endif(WORLDCLOCK_PLUGIN)
|
|
||||||
|
|
||||||
setByDefault(SPACER_PLUGIN Yes)
|
|
||||||
if(SPACER_PLUGIN)
|
|
||||||
list(APPEND STATIC_PLUGINS "spacer")
|
|
||||||
add_definitions(-DWITH_SPACER_PLUGIN)
|
|
||||||
list(APPEND ENABLED_PLUGINS "Spacer")
|
|
||||||
add_subdirectory(plugin-spacer)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
message(STATUS "**************** The following plugins will be built ****************")
|
|
||||||
foreach (PLUGIN_STR ${ENABLED_PLUGINS})
|
|
||||||
message(STATUS " ${PLUGIN_STR}")
|
|
||||||
endforeach()
|
|
||||||
message(STATUS "*********************************************************************")
|
|
||||||
|
|
||||||
add_subdirectory(panel)
|
|
||||||
|
|
||||||
# merged from lxqt-common
|
|
||||||
add_subdirectory(autostart)
|
|
||||||
add_subdirectory(menu)
|
|
@ -1,458 +0,0 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 2.1, February 1999
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
|
||||||
can use it too, but we suggest you first think carefully about whether
|
|
||||||
this license or the ordinary General Public License is the better
|
|
||||||
strategy to use in any particular case, based on the explanations below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish); that you receive source code or can get
|
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
|
||||||
you if you distribute copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
|
||||||
permission to copy, distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
|
||||||
there is no warranty for the free library. Also, if the library is
|
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
|
||||||
author's reputation will not be affected by problems that might be
|
|
||||||
introduced by others.
|
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
|
||||||
General Public License, applies to certain designated libraries, and
|
|
||||||
is quite different from the ordinary General Public License. We use
|
|
||||||
this license for certain libraries in order to permit linking those
|
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
|
||||||
allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow. Pay close attention to the difference between a
|
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
|
||||||
program which contains a notice placed by the copyright holder or
|
|
||||||
other authorized party saying it may be distributed under the terms of
|
|
||||||
this Lesser General Public License (also called "this License").
|
|
||||||
Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control compilation
|
|
||||||
and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
|
||||||
writing it). Whether that is true depends on what the Library does
|
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty; and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
|
||||||
and you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
|
||||||
of it, thus forming a work based on the Library, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
|
||||||
particular circumstance, the balance of the section is intended to apply,
|
|
||||||
and the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License may add
|
|
||||||
an explicit geographical distribution limitation excluding those countries,
|
|
||||||
so that distribution is permitted only in or among countries not thus
|
|
||||||
excluded. In such case, this License incorporates the limitation as if
|
|
||||||
written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
@ -1,61 +0,0 @@
|
|||||||
# lxqt-panel
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
`lxqt-panel` represents the taskbar of LXQt.
|
|
||||||
|
|
||||||
The elements available in lxqt-panel are called "plugin" technically. This applies e. g. to the source code where they reside in directories `./plugin-<plugin>` like `plugin-mainmenu`. In contrast to this they are called "widgets" by the configuration GUI so far. Also, a more descriptive term is used to refer to distinct plugins within the GUI. E. g. the aforementioned `plugin-mainmenu` is called "Application menu" that way.
|
|
||||||
Configuration dialogue "Add Plugins", see [below](https://github.com/lxde/lxqt-panel#customizing), is listing all available plugins plus a short description and hence provides an overview of the available ones.
|
|
||||||
Notes on some of the plugins, sorted by terms used within the GUI in alphabetical order, technical term in parenthesis:
|
|
||||||
|
|
||||||
#### Date & time (plugin-clock) / World clock (plugin-worldclock)
|
|
||||||
|
|
||||||
Both provide clock and calendar functionality. plugin-worldclock can display various time zones in addition but lacks a tooltip displaying current date und time upon hovering.
|
|
||||||
These plugins will probably be merged into one, see https://github.com/lxde/lxqt/issues/312.
|
|
||||||
|
|
||||||
#### Quick launch (plugin-quicklaunch)
|
|
||||||
|
|
||||||
A plugin to launch applications from the panel. By default it is empty and displays a message "Drop application icons here". Applications need to be available in panel's main menu and can be included into plugin-quicklaunch by drag & drop.
|
|
||||||
|
|
||||||
#### Status Notifier Plugin (plugin-statusnotifier) / System Tray (plugin-tray)
|
|
||||||
|
|
||||||
Both provide a notification area within the panel, that is an area where arbitrary applications can place informational icons. This is frequently used e. g. by chat or mail clients to inform about incoming messages or tools configuring the network to inform about connections. (So it's some kind of counterpart to the desktop notifications displayed by [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd)).
|
|
||||||
The difference between the two plugins is a technical one. **plugin-tray** is implementing the so-called [System Tray Protocol](https://www.freedesktop.org/wiki/Specifications/systemtray-spec). It's a specification that has been around for years but has some serious technical limitations and in particular won't work under Wayland. **plugin-statusnotifier** on the other hand is implementing the so-called [StatusNotifierItem (SNI)](https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem) specification which can be considered a successor of the System Tray Protocol.
|
|
||||||
Both plugins are maintained in parallel as not all relevant applications are compatible with SNI so far. In particular both Qt 4 and all GTK applications need some kind of wrapper to deal with it. Both plugins can be used in parallel without any issue, applications supporting both specifications will normally chose to display their icons in plugin-statusnotifier.
|
|
||||||
|
|
||||||
#### Volume control (plugin-volume)
|
|
||||||
|
|
||||||
As indicated by the name, a volume control. Technically Alsa, OSS and PulseAudio can be used as backend. The plugin itself is providing a control to adjust the main volume only but it allows for launching specific UIs of the backend in use like e. g. [pavucontrol-qt](https://github.com/lxde/pavucontrol-qt) to adjust PulseAudio.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Compiling source code
|
|
||||||
|
|
||||||
The runtime dependencies are libxcomposite, libdbusmenu-qt5, KGuiAddons, KWindowSystem, Solid, menu-cache, lxmenu-data, [liblxqt](https://github.com/lxde/liblxqt) and [lxqt-globalkeys](https://github.com/lxde/lxqt-globalkeys).
|
|
||||||
Several plugins or features thereof are optional and need additional runtime dependencies. Namely these are (plugin / feature in parenthesis) Alsa library (Alsa support in plugin-volume), PulseAudio client library (PulseAudio support in plugin-volume), lm-sensors (plugin-sensors), libstatgrab (plugin-cpuload, plugin-networkmonitor), [libsysstat](https://github.com/lxde/libsysstat) (plugin-sysstat). All of them are enabled by default and have to be disabled by CMake variables as required, see below.
|
|
||||||
In addition CMake is a mandatory build dependency. Git is optionally needed to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
|
|
||||||
|
|
||||||
Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems, depending on the way library paths are dealt with on 64bit systems variables like CMAKE_INSTALL_LIBDIR may have to be set as well.
|
|
||||||
By default all available plugins and features thereof are built and CMake fails when dependencies aren't met. Building particular plugins can be disabled by boolean CMake variables `<plugin>_PLUGIN` where the plugin is referred by its technical term like e. g. in `SYSSTAT_PLUGIN`. Alsa and PulseAudio support in plugin-volume can be disabled by boolean CMake variables `VOLUME_USE_ALSA` and `VOLUME_USE_PULSEAUDIO`.
|
|
||||||
|
|
||||||
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
|
|
||||||
|
|
||||||
### Binary packages
|
|
||||||
|
|
||||||
Official binary packages are provided by all major Linux distributions like Arch Linux, Debian (as of Debian stretch only), Fedora and openSUSE. Just use your package manager to search for string `lxqt-panel`.
|
|
||||||
|
|
||||||
## Configuration, Usage
|
|
||||||
|
|
||||||
### Launching
|
|
||||||
|
|
||||||
The panel is run as a daemon-like [LXQt Module](https://github.com/lxde/lxqt-session#lxqt-modules) the launch of which can be adjusted in section "Basic Settings" of configuration dialogue [LXQt Session Settings](https://github.com/lxde/lxqt-session#lxqt-session-settings) of [lxqt-session](https://github.com/lxde/lxqt-session).
|
|
||||||
|
|
||||||
### Customizing
|
|
||||||
|
|
||||||
To customize the panel itself there's a context menu, that is a menu opened by right-clicking the pointer device. It is comprising sections "\<plugin\>" and "Panel" which allow for configuring the plugin the pointer is currently over and the panel as a whole respectively.
|
|
||||||
|
|
||||||
In section "Panel" topics "Configure Panel" and "Manage Widgets" open different panes of a dialogue "Configure Panel" which allow for configuring the panel as a whole and the various plugins respectively.
|
|
||||||
Pane "Widgets" allows for configuring and removing all plugins currently included in lxqt-panel. The plus sign opens another dialogue "Add plugins" which is used to add plugins. It comes with a list of all plugins plus some short descriptions and can hence serve as overview what plugins are available.
|
|
||||||
|
|
||||||
Sometimes right-clicking over particular plugins may bring up a context menu dealing with the respective plugin's functionality *only* which means the plugin in question cannot be configured the usual way. This affects e. g. plugin-quicklaunch as soon as items were added (the context menu is limited to topics dealing with the items included in plugin-quicklaunch).
|
|
||||||
Currently there are two ways to deal with this. Some themes like e. g. `Frost` come with handles at the plugins' left end providing the regular context menu. Also, it can be assumed at least one plugin is included in the panel that's always featuring the regular context menu like e. g. plugin-mainmenu. Either way pane "Widgets" of "Configure Panel" can be accessed and used to configure the particular plugin.
|
|
@ -1,17 +0,0 @@
|
|||||||
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(lxqt_panel_autostart_desktop_files ALL DEPENDS ${DESKTOP_FILES})
|
|
||||||
#************************************************
|
|
||||||
|
|
||||||
install(FILES
|
|
||||||
${DESKTOP_FILES}
|
|
||||||
DESTINATION "${LXQT_ETC_XDG_DIR}/autostart"
|
|
||||||
COMPONENT Runtime
|
|
||||||
)
|
|
@ -1,9 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Name=Panel
|
|
||||||
TryExec=lxqt-panel
|
|
||||||
Exec=lxqt-panel
|
|
||||||
OnlyShowIn=LXQt;
|
|
||||||
X-LXQt-Module=true
|
|
||||||
|
|
||||||
#TRANSLATIONS_DIR=translations
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[ar]=اللوحة
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[cs]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[cs_CZ]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[da]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[de]=Bedienfeld
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[el]=Πίνακας
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[eo]=Panelo
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[es]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[es_VE]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[eu]=Panela
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[fi]=Paneeli
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[fr]=Tableau de bord
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[hu]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[hu_HU]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[ia]=Panello
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[it_IT]=Pannello
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[ja]=パネル
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[lt]=Skydelis
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[nl]=Paneel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[pl]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[pt]=Painel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[pt_BR]=Painel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[ro_RO]=Panou
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[ru]=панель
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[ru_RU]=Панель
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[sl]=Pult
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[th_TH]=พาเนล
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[tr]=Panel
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[uk]=Панель
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[zh_CN]=面板
|
|
@ -1,2 +0,0 @@
|
|||||||
# Translations
|
|
||||||
Name[zh_TW]=面板
|
|
@ -1,69 +0,0 @@
|
|||||||
MACRO (BUILD_LXQT_PLUGIN NAME)
|
|
||||||
set(PROGRAM "lxqt-panel")
|
|
||||||
project(${PROGRAM}_${NAME})
|
|
||||||
|
|
||||||
set(PROG_SHARE_DIR ${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/${PROGRAM})
|
|
||||||
set(PLUGIN_SHARE_DIR ${PROG_SHARE_DIR}/${NAME})
|
|
||||||
|
|
||||||
# Translations **********************************
|
|
||||||
lxqt_translate_ts(${PROJECT_NAME}_QM_FILES
|
|
||||||
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
|
|
||||||
SOURCES
|
|
||||||
${HEADERS}
|
|
||||||
${SOURCES}
|
|
||||||
${MOCS}
|
|
||||||
${UIS}
|
|
||||||
TEMPLATE
|
|
||||||
${NAME}
|
|
||||||
INSTALL_DIR
|
|
||||||
${LXQT_TRANSLATIONS_DIR}/${PROGRAM}/${NAME}
|
|
||||||
PULL_TRANSLATIONS
|
|
||||||
${PULL_TRANSLATIONS}
|
|
||||||
CLEAN_TRANSLATIONS
|
|
||||||
${CLEAN_TRANSLATIONS}
|
|
||||||
TRANSLATIONS_REPO
|
|
||||||
${TRANSLATIONS_REPO}
|
|
||||||
TRANSLATIONS_REFSPEC
|
|
||||||
${TRANSLATIONS_REFSPEC}
|
|
||||||
REPO_SUBDIR
|
|
||||||
"${PROGRAM}/plugin-${NAME}"
|
|
||||||
)
|
|
||||||
|
|
||||||
#lxqt_translate_to(QM_FILES ${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/${PROGRAM}/${PROJECT_NAME})
|
|
||||||
file (GLOB ${PROJECT_NAME}_DESKTOP_FILES_IN resources/*.desktop.in)
|
|
||||||
lxqt_translate_desktop(DESKTOP_FILES
|
|
||||||
SOURCES
|
|
||||||
${${PROJECT_NAME}_DESKTOP_FILES_IN}
|
|
||||||
)
|
|
||||||
|
|
||||||
lxqt_plugin_translation_loader(QM_LOADER ${NAME} "lxqt-panel")
|
|
||||||
#************************************************
|
|
||||||
|
|
||||||
file (GLOB CONFIG_FILES resources/*.conf)
|
|
||||||
|
|
||||||
if (NOT DEFINED PLUGIN_DIR)
|
|
||||||
set (PLUGIN_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROGRAM})
|
|
||||||
endif (NOT DEFINED PLUGIN_DIR)
|
|
||||||
|
|
||||||
set(QTX_LIBRARIES Qt5::Widgets)
|
|
||||||
if(QT_USE_QTXML)
|
|
||||||
set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt5::Xml)
|
|
||||||
endif()
|
|
||||||
if(QT_USE_QTDBUS)
|
|
||||||
set(QTX_LIBRARIES ${QTX_LIBRARIES} Qt5::DBus)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(FIND STATIC_PLUGINS ${NAME} IS_STATIC)
|
|
||||||
set(SRC ${HEADERS} ${SOURCES} ${QM_LOADER} ${MOC_SOURCES} ${${PROJECT_NAME}_QM_FILES} ${RESOURCES} ${UIS} ${DESKTOP_FILES})
|
|
||||||
if (${IS_STATIC} EQUAL -1) # not static
|
|
||||||
add_library(${NAME} MODULE ${SRC}) # build dynamically loadable modules
|
|
||||||
install(TARGETS ${NAME} DESTINATION ${PLUGIN_DIR}) # install the *.so file
|
|
||||||
else() # static
|
|
||||||
add_library(${NAME} STATIC ${SRC}) # build statically linked lib
|
|
||||||
endif()
|
|
||||||
target_link_libraries(${NAME} ${QTX_LIBRARIES} lxqt ${LIBRARIES} KF5::WindowSystem)
|
|
||||||
|
|
||||||
install(FILES ${CONFIG_FILES} DESTINATION ${PLUGIN_SHARE_DIR})
|
|
||||||
install(FILES ${DESKTOP_FILES} DESTINATION ${PROG_SHARE_DIR})
|
|
||||||
|
|
||||||
ENDMACRO(BUILD_LXQT_PLUGIN)
|
|
@ -1,21 +0,0 @@
|
|||||||
file(GLOB DIRECTORY_FILES_IN desktop-directories/*.directory.in)
|
|
||||||
|
|
||||||
# Translations **********************************
|
|
||||||
lxqt_translate_desktop(DIRECTORY_FILES
|
|
||||||
SOURCES
|
|
||||||
${DIRECTORY_FILES_IN}
|
|
||||||
)
|
|
||||||
add_custom_target(desktop_directories_files ALL DEPENDS ${DIRECTORY_FILES})
|
|
||||||
#************************************************
|
|
||||||
|
|
||||||
install(FILES
|
|
||||||
${DIRECTORY_FILES}
|
|
||||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/desktop-directories"
|
|
||||||
COMPONENT Runtime
|
|
||||||
)
|
|
||||||
|
|
||||||
install(FILES
|
|
||||||
lxqt-applications.menu
|
|
||||||
DESTINATION "${LXQT_ETC_XDG_DIR}/menus"
|
|
||||||
COMPONENT Runtime
|
|
||||||
)
|
|
@ -1,7 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Leave
|
|
||||||
Comment=Leave Session
|
|
||||||
Icon=system-shutdown
|
|
||||||
Type=Directory
|
|
||||||
|
|
||||||
#TRANSLATIONS_DIR=../translations
|
|
@ -1,9 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Type=Directory
|
|
||||||
Name=LXQt settings
|
|
||||||
Icon=preferences-system
|
|
||||||
|
|
||||||
#TRANSLATIONS_DIR=translations
|
|
||||||
|
|
||||||
# Translations
|
|
@ -1,237 +0,0 @@
|
|||||||
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
|
|
||||||
<Name>Applications</Name>
|
|
||||||
<Directory>lxde-menu-applications.directory</Directory>
|
|
||||||
|
|
||||||
<!-- Read standard .directory and .desktop file locations -->
|
|
||||||
<DefaultAppDirs/>
|
|
||||||
<DefaultDirectoryDirs/>
|
|
||||||
|
|
||||||
<!-- Read in overrides and child menus from applications-merged/ -->
|
|
||||||
<DefaultMergeDirs/>
|
|
||||||
|
|
||||||
<!-- Accessories submenu -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Accessories</Name>
|
|
||||||
<Directory>lxde-utility.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Utility</Category>
|
|
||||||
<!-- Accessibility spec must have either the Utility or Settings
|
|
||||||
category, and we display an accessibility submenu already for
|
|
||||||
the ones that do not have Settings, so don't display accessibility
|
|
||||||
applications here -->
|
|
||||||
<Not><Category>Accessibility</Category></Not>
|
|
||||||
<Not><Category>System</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Accessories -->
|
|
||||||
|
|
||||||
<!-- Accessibility submenu -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Universal Access</Name>
|
|
||||||
<Directory>lxde-utility-accessibility.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Accessibility</Category>
|
|
||||||
<Not><Category>Settings</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Accessibility -->
|
|
||||||
|
|
||||||
<!-- Development Tools -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Development</Name>
|
|
||||||
<Directory>lxde-development.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Development</Category>
|
|
||||||
</And>
|
|
||||||
<Filename>emacs.desktop</Filename>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Development Tools -->
|
|
||||||
|
|
||||||
<!-- Education -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Education</Name>
|
|
||||||
<Directory>lxde-education.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Education</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Education -->
|
|
||||||
|
|
||||||
<!-- Games -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Games</Name>
|
|
||||||
<Directory>lxde-game.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Game</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Games -->
|
|
||||||
|
|
||||||
<!-- Graphics -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Graphics</Name>
|
|
||||||
<Directory>lxde-graphics.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Graphics</Category>
|
|
||||||
<Not><Category>Utility</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Graphics -->
|
|
||||||
|
|
||||||
<!-- Internet -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Internet</Name>
|
|
||||||
<Directory>lxde-network.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Network</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Internet -->
|
|
||||||
|
|
||||||
<!-- LXQt-About -->
|
|
||||||
<Menu>
|
|
||||||
<Name>LXQt-About</Name>
|
|
||||||
<Include>
|
|
||||||
<Filename>lxqt-about.desktop</Filename>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End LXQt-About -->
|
|
||||||
|
|
||||||
<!-- Multimedia -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Multimedia</Name>
|
|
||||||
<Directory>lxde-audio-video.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>AudioVideo</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Multimedia -->
|
|
||||||
|
|
||||||
<!-- Office -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Office</Name>
|
|
||||||
<Directory>lxde-office.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Office</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Office -->
|
|
||||||
|
|
||||||
<!-- System Tools-->
|
|
||||||
<Menu>
|
|
||||||
<Name>System</Name>
|
|
||||||
<Directory>lxde-system-tools.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>System</Category>
|
|
||||||
<Not><Category>Settings</Category></Not>
|
|
||||||
<Not><Category>PackageManager</Category></Not>
|
|
||||||
<Not><Category>X-Leave</Category></Not>
|
|
||||||
<Not><Category>Screensaver</Category></Not>
|
|
||||||
<Not><Filename>lxqt-about.desktop</Filename></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End System Tools -->
|
|
||||||
|
|
||||||
<!-- Other -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Other</Name>
|
|
||||||
<Directory>lxde-other.directory</Directory>
|
|
||||||
<OnlyUnallocated/>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Not><Category>Core</Category></Not>
|
|
||||||
<Not><Category>Settings</Category></Not>
|
|
||||||
<Not><Category>Screensaver</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Other -->
|
|
||||||
|
|
||||||
<!-- Settings -->
|
|
||||||
<Menu>
|
|
||||||
<Name>DesktopSettings</Name>
|
|
||||||
<Directory>lxde-settings.directory</Directory>
|
|
||||||
<Menu>
|
|
||||||
<Name>LXQtSettings</Name>
|
|
||||||
<Directory>lxqt-settings.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>LXQt</Category>
|
|
||||||
<Or>
|
|
||||||
<Category>Settings</Category>
|
|
||||||
<Category>PackageManager</Category>
|
|
||||||
</Or>
|
|
||||||
</And>
|
|
||||||
<!-- Include some optional components here -->
|
|
||||||
<Filename>obconf-qt.desktop</Filename>
|
|
||||||
<Filename>compton-conf.desktop</Filename>
|
|
||||||
<Filename>pcmanfm-qt-desktop-pref.desktop</Filename>
|
|
||||||
</Include>
|
|
||||||
<Layout>
|
|
||||||
<Filename>lxqt-config.desktop</Filename>
|
|
||||||
<Separator/>
|
|
||||||
<Merge type="menus"/>
|
|
||||||
<Merge type="files"/>
|
|
||||||
</Layout>
|
|
||||||
</Menu>
|
|
||||||
<OnlyUnallocated/>
|
|
||||||
<Include>
|
|
||||||
<Or>
|
|
||||||
<Category>Settings</Category>
|
|
||||||
<Category>PackageManager</Category>
|
|
||||||
</Or>
|
|
||||||
</Include>
|
|
||||||
<Exclude>
|
|
||||||
<Or>
|
|
||||||
<Filename>lxqt-config.desktop</Filename>
|
|
||||||
</Or>
|
|
||||||
</Exclude>
|
|
||||||
<Layout>
|
|
||||||
<Merge type="menus"/>
|
|
||||||
<Merge type="files"/>
|
|
||||||
</Layout>
|
|
||||||
</Menu> <!-- End Settings -->
|
|
||||||
|
|
||||||
<!-- Leave -->
|
|
||||||
<Menu>
|
|
||||||
<Name>X-Leave</Name>
|
|
||||||
<Directory>lxqt-leave.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>X-Leave</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Leave -->
|
|
||||||
|
|
||||||
<!-- Screensaver -->
|
|
||||||
<Menu>
|
|
||||||
<Name>Screensaver</Name>
|
|
||||||
<Include>
|
|
||||||
<Filename>lxqt-lockscreen.desktop</Filename>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End Screensaver -->
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<Merge type="files"/>
|
|
||||||
<Merge type="menus"/>
|
|
||||||
<Separator/>
|
|
||||||
<Menuname>DesktopSettings</Menuname>
|
|
||||||
<Menuname show_empty="false" inline="true">LXQt-About</Menuname>
|
|
||||||
<Separator/>
|
|
||||||
<Menuname show_empty="false">X-Leave</Menuname>
|
|
||||||
<Menuname show_empty="false" inline="true">Screensaver</Menuname>
|
|
||||||
</Layout>
|
|
||||||
|
|
||||||
</Menu> <!-- End Applications -->
|
|
@ -1,8 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Leave
|
|
||||||
Comment=Leave Session
|
|
||||||
Icon=system-shutdown
|
|
||||||
Type=Directory
|
|
||||||
|
|
||||||
Comment[de]=Sitzung verlassen
|
|
||||||
Name[de]=Verlassen
|
|
@ -1 +0,0 @@
|
|||||||
Name[el]=Έξοδος
|
|
@ -1,3 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name[fr]=Quitter
|
|
||||||
Comment[fr]=Quitter la session
|
|
@ -1,2 +0,0 @@
|
|||||||
Comment[hu]=LXQt elhagyása
|
|
||||||
Name[hu]=Kilépés
|
|
@ -1,2 +0,0 @@
|
|||||||
Name[it]=Esci
|
|
||||||
Comment[it]=Chiudere la sessione
|
|
@ -1,8 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Leave
|
|
||||||
Comment=Leave Session
|
|
||||||
Icon=system-shutdown
|
|
||||||
Type=Directory
|
|
||||||
|
|
||||||
Comment[lt]=Užbaigti seansą
|
|
||||||
Name[lt]=Išeiti
|
|
@ -1,2 +0,0 @@
|
|||||||
Name[pl]=Opuść
|
|
||||||
Comment[pl]=Zakończ sesję
|
|
@ -1,3 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name[pt]=Sair
|
|
||||||
Comment[pt]=Sair da sessão
|
|
@ -1,11 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Leave
|
|
||||||
Comment=Leave Session
|
|
||||||
Icon=system-shutdown
|
|
||||||
Type=Directory
|
|
||||||
|
|
||||||
Comment[ru]=Завершить сеанс
|
|
||||||
Name[ru]=Выйти
|
|
||||||
|
|
||||||
Comment[ru_RU]=Завершить сеанс
|
|
||||||
Name[ru_RU]=Выйти
|
|
@ -1 +0,0 @@
|
|||||||
Name[de]=LXQt-Systemeinstellungen
|
|
@ -1,2 +0,0 @@
|
|||||||
Name[el]=Ρυθμίσεις LXQt
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
Name[fr]=LXQt-Paramétrage du système
|
|
@ -1 +0,0 @@
|
|||||||
Name[hu]=LXQt beállítása
|
|
@ -1 +0,0 @@
|
|||||||
Name[it]=Impostazioni di LXQt
|
|
@ -1 +0,0 @@
|
|||||||
Name[lt]=LXQt nustatymai
|
|
@ -1 +0,0 @@
|
|||||||
Name[pl]=Ustawienia LXQt
|
|
@ -1,2 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Definições do LXQt
|
|
@ -1,13 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Type=Directory
|
|
||||||
Name=LXQt settings
|
|
||||||
Icon=preferences-system
|
|
||||||
|
|
||||||
#TRANSLATIONS_DIR=translations
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
Name[ru]=Настройки LXQt
|
|
||||||
|
|
||||||
Name[ru_RU]=Настройки LXQt
|
|
@ -1,123 +0,0 @@
|
|||||||
set(PROJECT lxqt-panel)
|
|
||||||
|
|
||||||
set(PRIV_HEADERS
|
|
||||||
panelpluginsmodel.h
|
|
||||||
windownotifier.h
|
|
||||||
lxqtpanel.h
|
|
||||||
lxqtpanelapplication.h
|
|
||||||
lxqtpanelapplication_p.h
|
|
||||||
lxqtpanellayout.h
|
|
||||||
plugin.h
|
|
||||||
pluginsettings_p.h
|
|
||||||
lxqtpanellimits.h
|
|
||||||
popupmenu.h
|
|
||||||
pluginmoveprocessor.h
|
|
||||||
lxqtpanelpluginconfigdialog.h
|
|
||||||
config/configpaneldialog.h
|
|
||||||
config/configpanelwidget.h
|
|
||||||
config/configpluginswidget.h
|
|
||||||
config/addplugindialog.h
|
|
||||||
)
|
|
||||||
|
|
||||||
# using LXQt namespace in the public headers.
|
|
||||||
set(PUB_HEADERS
|
|
||||||
lxqtpanelglobals.h
|
|
||||||
pluginsettings.h
|
|
||||||
ilxqtpanelplugin.h
|
|
||||||
ilxqtpanel.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(SOURCES
|
|
||||||
main.cpp
|
|
||||||
panelpluginsmodel.cpp
|
|
||||||
windownotifier.cpp
|
|
||||||
lxqtpanel.cpp
|
|
||||||
lxqtpanelapplication.cpp
|
|
||||||
lxqtpanellayout.cpp
|
|
||||||
plugin.cpp
|
|
||||||
pluginsettings.cpp
|
|
||||||
popupmenu.cpp
|
|
||||||
pluginmoveprocessor.cpp
|
|
||||||
lxqtpanelpluginconfigdialog.cpp
|
|
||||||
config/configpaneldialog.cpp
|
|
||||||
config/configpanelwidget.cpp
|
|
||||||
config/configpluginswidget.cpp
|
|
||||||
config/addplugindialog.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(UI
|
|
||||||
config/configpanelwidget.ui
|
|
||||||
config/configpluginswidget.ui
|
|
||||||
config/addplugindialog.ui
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBRARIES
|
|
||||||
lxqt
|
|
||||||
)
|
|
||||||
|
|
||||||
file(GLOB CONFIG_FILES resources/*.conf)
|
|
||||||
|
|
||||||
############################################
|
|
||||||
|
|
||||||
add_definitions(-DCOMPILE_LXQT_PANEL)
|
|
||||||
|
|
||||||
set(PLUGIN_DESKTOPS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/${PROJECT}")
|
|
||||||
add_definitions(-DPLUGIN_DESKTOPS_DIR=\"${PLUGIN_DESKTOPS_DIR}\")
|
|
||||||
|
|
||||||
if (WITH_SCREENSAVER_FALLBACK)
|
|
||||||
message(STATUS "Building with conversion of deprecated 'screensaver' plugin")
|
|
||||||
add_definitions(-DWITH_SCREENSAVER_FALLBACK "-DLXQT_LOCK_DESKTOP=\"${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications/lxqt-lockscreen.desktop\"")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
project(${PROJECT})
|
|
||||||
|
|
||||||
set(QTX_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::DBus)
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
lxqt_translate_ts(QM_FILES SOURCES
|
|
||||||
UPDATE_TRANSLATIONS
|
|
||||||
${UPDATE_TRANSLATIONS}
|
|
||||||
SOURCES
|
|
||||||
${PUB_HEADERS}
|
|
||||||
${PRIV_HEADERS}
|
|
||||||
${SOURCES}
|
|
||||||
${UI}
|
|
||||||
INSTALL_DIR
|
|
||||||
"${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
|
|
||||||
PULL_TRANSLATIONS
|
|
||||||
${PULL_TRANSLATIONS}
|
|
||||||
CLEAN_TRANSLATIONS
|
|
||||||
${CLEAN_TRANSLATIONS}
|
|
||||||
TRANSLATIONS_REPO
|
|
||||||
${TRANSLATIONS_REPO}
|
|
||||||
TRANSLATIONS_REFSPEC
|
|
||||||
${TRANSLATIONS_REFSPEC}
|
|
||||||
REPO_SUBDIR
|
|
||||||
"${PROJECT_NAME}/panel"
|
|
||||||
)
|
|
||||||
|
|
||||||
lxqt_app_translation_loader(SOURCES ${PROJECT_NAME})
|
|
||||||
|
|
||||||
add_executable(${PROJECT}
|
|
||||||
${PUB_HEADERS}
|
|
||||||
${PRIV_HEADERS}
|
|
||||||
${QM_FILES}
|
|
||||||
${SOURCES}
|
|
||||||
${UI}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT}
|
|
||||||
${LIBRARIES}
|
|
||||||
${QTX_LIBRARIES}
|
|
||||||
KF5::WindowSystem
|
|
||||||
${STATIC_PLUGINS}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS ${PROJECT} RUNTIME DESTINATION bin)
|
|
||||||
install(FILES ${CONFIG_FILES} DESTINATION ${LXQT_ETC_XDG_DIR}/lxqt)
|
|
||||||
install(FILES ${PUB_HEADERS} DESTINATION include/lxqt)
|
|
||||||
install(FILES
|
|
||||||
man/lxqt-panel.1
|
|
||||||
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
|
|
||||||
COMPONENT Runtime
|
|
||||||
)
|
|
@ -1,135 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#include "ui_addplugindialog.h"
|
|
||||||
#include "addplugindialog.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "../lxqtpanelapplication.h"
|
|
||||||
|
|
||||||
#include <LXQt/HtmlDelegate>
|
|
||||||
#include <XdgIcon>
|
|
||||||
#include <XdgDirs>
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QListWidgetItem>
|
|
||||||
#include <QIcon>
|
|
||||||
|
|
||||||
#define SEARCH_ROLE Qt::UserRole
|
|
||||||
#define INDEX_ROLE SEARCH_ROLE+1
|
|
||||||
|
|
||||||
AddPluginDialog::AddPluginDialog(QWidget *parent):
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::AddPluginDialog)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
QStringList desktopFilesDirs;
|
|
||||||
desktopFilesDirs << QString(getenv("LXQT_PANEL_PLUGINS_DIR")).split(':', QString::SkipEmptyParts);
|
|
||||||
desktopFilesDirs << QString("%1/%2").arg(XdgDirs::dataHome(), "/lxqt/lxqt-panel");
|
|
||||||
desktopFilesDirs << PLUGIN_DESKTOPS_DIR;
|
|
||||||
|
|
||||||
mPlugins = LXQt::PluginInfo::search(desktopFilesDirs, QLatin1String("LXQtPanel/Plugin"), QLatin1String("*"));
|
|
||||||
std::sort(mPlugins.begin(), mPlugins.end(), [](const LXQt::PluginInfo &p1, const LXQt::PluginInfo &p2) {
|
|
||||||
return p1.name() < p2.name() || (p1.name() == p2.name() && p1.comment() < p2.comment());
|
|
||||||
});
|
|
||||||
|
|
||||||
ui->pluginList->setItemDelegate(new LXQt::HtmlDelegate(QSize(32, 32), ui->pluginList));
|
|
||||||
ui->pluginList->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
||||||
|
|
||||||
filter();
|
|
||||||
|
|
||||||
// search
|
|
||||||
mSearchTimer.setInterval(300);
|
|
||||||
mSearchTimer.setSingleShot(true);
|
|
||||||
connect(ui->searchEdit, &QLineEdit::textEdited,
|
|
||||||
&mSearchTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
|
||||||
connect(&mSearchTimer, &QTimer::timeout, this, &AddPluginDialog::filter);
|
|
||||||
connect(ui->pluginList, &QListWidget::doubleClicked, this, &AddPluginDialog::emitPluginSelected);
|
|
||||||
connect(ui->addButton, &QPushButton::clicked, this, &AddPluginDialog::emitPluginSelected);
|
|
||||||
|
|
||||||
connect(dynamic_cast<LXQtPanelApplication *>(qApp), &LXQtPanelApplication::pluginAdded
|
|
||||||
, this, &AddPluginDialog::filter);
|
|
||||||
connect(dynamic_cast<LXQtPanelApplication *>(qApp), &LXQtPanelApplication::pluginRemoved
|
|
||||||
, this, &AddPluginDialog::filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddPluginDialog::~AddPluginDialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddPluginDialog::filter()
|
|
||||||
{
|
|
||||||
QListWidget* pluginList = ui->pluginList;
|
|
||||||
|
|
||||||
const int curr_item = 0 < pluginList->count() ? pluginList->currentRow() : 0;
|
|
||||||
pluginList->clear();
|
|
||||||
|
|
||||||
static QIcon fallIco = XdgIcon::fromTheme("preferences-plugin");
|
|
||||||
|
|
||||||
int pluginCount = mPlugins.length();
|
|
||||||
for (int i = 0; i < pluginCount; ++i)
|
|
||||||
{
|
|
||||||
const LXQt::PluginInfo &plugin = mPlugins.at(i);
|
|
||||||
|
|
||||||
QString s = QString("%1 %2 %3 %4 %5").arg(plugin.name(),
|
|
||||||
plugin.comment(),
|
|
||||||
plugin.value("Name").toString(),
|
|
||||||
plugin.value("Comment").toString(),
|
|
||||||
plugin.id());
|
|
||||||
if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
QListWidgetItem* item = new QListWidgetItem(ui->pluginList);
|
|
||||||
// disable single-instances plugins already in use
|
|
||||||
if (dynamic_cast<LXQtPanelApplication const *>(qApp)->isPluginSingletonAndRunnig(plugin.id()))
|
|
||||||
{
|
|
||||||
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
|
|
||||||
item->setBackground(palette().brush(QPalette::Disabled, QPalette::Text));
|
|
||||||
item->setText(QString("<b>%1</b> (%2)<br>%3<br><small>%4</small>")
|
|
||||||
.arg(plugin.name(), plugin.id(), plugin.comment(), tr("(only one instance can run at a time)")));
|
|
||||||
} else
|
|
||||||
item->setText(QString("<b>%1</b> (%2)<br>%3").arg(plugin.name(), plugin.id(), plugin.comment()));
|
|
||||||
item->setIcon(plugin.icon(fallIco));
|
|
||||||
item->setData(INDEX_ROLE, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pluginCount > 0)
|
|
||||||
ui->pluginList->setCurrentRow(curr_item < pluginCount ? curr_item : pluginCount - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddPluginDialog::emitPluginSelected()
|
|
||||||
{
|
|
||||||
QListWidget* pluginList = ui->pluginList;
|
|
||||||
if (pluginList->currentItem() && pluginList->currentItem()->isSelected())
|
|
||||||
{
|
|
||||||
LXQt::PluginInfo plugin = mPlugins.at(pluginList->currentItem()->data(INDEX_ROLE).toInt());
|
|
||||||
emit pluginSelected(plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LXQT_ADDPLUGINDIALOG_H
|
|
||||||
#define LXQT_ADDPLUGINDIALOG_H
|
|
||||||
|
|
||||||
#include <LXQt/PluginInfo>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#define SEARCH_DELAY 125
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class AddPluginDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class AddPluginDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
AddPluginDialog(QWidget *parent = 0);
|
|
||||||
~AddPluginDialog();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void pluginSelected(const LXQt::PluginInfo &plugin);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::AddPluginDialog *ui;
|
|
||||||
LXQt::PluginInfoList mPlugins;
|
|
||||||
QTimer mSearchTimer;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void filter();
|
|
||||||
void emitPluginSelected();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LXQT_ADDPLUGINDIALOG_H
|
|
@ -1,144 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>AddPluginDialog</class>
|
|
||||||
<widget class="QDialog" name="AddPluginDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>400</width>
|
|
||||||
<height>359</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Add Plugins</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="searchLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Search:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="searchEdit"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="pluginList">
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
|
||||||
</property>
|
|
||||||
<property name="showDropIndicator" stdset="0">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior">
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="movement">
|
|
||||||
<enum>QListView::Static</enum>
|
|
||||||
</property>
|
|
||||||
<property name="flow">
|
|
||||||
<enum>QListView::TopToBottom</enum>
|
|
||||||
</property>
|
|
||||||
<property name="resizeMode">
|
|
||||||
<enum>QListView::Adjust</enum>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="modelColumn">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="uniformItemSizes">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionRectVisible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="currentRow">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add Widget</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="closeButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Close</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<tabstops>
|
|
||||||
<tabstop>pluginList</tabstop>
|
|
||||||
<tabstop>addButton</tabstop>
|
|
||||||
<tabstop>closeButton</tabstop>
|
|
||||||
<tabstop>searchEdit</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>closeButton</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>AddPluginDialog</receiver>
|
|
||||||
<slot>close()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>380</x>
|
|
||||||
<y>279</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>118</x>
|
|
||||||
<y>270</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@ -1,58 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Marat "Morion" Talipov <morion.self@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#include "configpaneldialog.h"
|
|
||||||
|
|
||||||
ConfigPanelDialog::ConfigPanelDialog(LXQtPanel *panel, QWidget *parent):
|
|
||||||
LXQt::ConfigDialog(tr("Configure Panel"), panel->settings(), parent),
|
|
||||||
mPanelPage(nullptr),
|
|
||||||
mPluginsPage(nullptr)
|
|
||||||
{
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
mPanelPage = new ConfigPanelWidget(panel, this);
|
|
||||||
addPage(mPanelPage, tr("Panel"), QLatin1String("configure"));
|
|
||||||
connect(this, &ConfigPanelDialog::reset, mPanelPage, &ConfigPanelWidget::reset);
|
|
||||||
|
|
||||||
mPluginsPage = new ConfigPluginsWidget(panel, this);
|
|
||||||
addPage(mPluginsPage, tr("Widgets"), QLatin1String("preferences-plugin"));
|
|
||||||
connect(this, &ConfigPanelDialog::reset, mPluginsPage, &ConfigPluginsWidget::reset);
|
|
||||||
|
|
||||||
connect(this, &ConfigPanelDialog::accepted, [panel] {
|
|
||||||
panel->saveSettings();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigPanelDialog::showConfigPanelPage()
|
|
||||||
{
|
|
||||||
showPage(mPanelPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigPanelDialog::showConfigPluginsPage()
|
|
||||||
{
|
|
||||||
showPage(mPluginsPage);
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Marat "Morion" Talipov <morion.self@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef CONFIGPANELDIALOG_H
|
|
||||||
#define CONFIGPANELDIALOG_H
|
|
||||||
|
|
||||||
#include "configpanelwidget.h"
|
|
||||||
#include "configpluginswidget.h"
|
|
||||||
#include "../lxqtpanel.h"
|
|
||||||
|
|
||||||
#include <LXQt/ConfigDialog>
|
|
||||||
|
|
||||||
class ConfigPanelDialog : public LXQt::ConfigDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ConfigPanelDialog(LXQtPanel *panel, QWidget *parent = 0);
|
|
||||||
|
|
||||||
void showConfigPanelPage();
|
|
||||||
void showConfigPluginsPage();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ConfigPanelWidget *mPanelPage;
|
|
||||||
ConfigPluginsWidget *mPluginsPage;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CONFIGPANELDIALOG_H
|
|
@ -1,408 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Marat "Morion" Talipov <morion.self@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#include "configpanelwidget.h"
|
|
||||||
#include "ui_configpanelwidget.h"
|
|
||||||
|
|
||||||
#include "../lxqtpanellimits.h"
|
|
||||||
|
|
||||||
#include <KWindowSystem/KWindowSystem>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QListView>
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QWindow>
|
|
||||||
#include <QColorDialog>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
|
|
||||||
using namespace LXQt;
|
|
||||||
|
|
||||||
struct ScreenPosition
|
|
||||||
{
|
|
||||||
int screen;
|
|
||||||
ILXQtPanel::Position position;
|
|
||||||
};
|
|
||||||
Q_DECLARE_METATYPE(ScreenPosition)
|
|
||||||
|
|
||||||
ConfigPanelWidget::ConfigPanelWidget(LXQtPanel *panel, QWidget *parent) :
|
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::ConfigPanelWidget),
|
|
||||||
mPanel(panel)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
fillComboBox_position();
|
|
||||||
fillComboBox_alignment();
|
|
||||||
|
|
||||||
mOldPanelSize = mPanel->panelSize();
|
|
||||||
mOldIconSize = mPanel->iconSize();
|
|
||||||
mOldLineCount = mPanel->lineCount();
|
|
||||||
|
|
||||||
mOldLength = mPanel->length();
|
|
||||||
mOldLengthInPercents = mPanel->lengthInPercents();
|
|
||||||
|
|
||||||
mOldAlignment = mPanel->alignment();
|
|
||||||
|
|
||||||
mOldScreenNum = mPanel->screenNum();
|
|
||||||
mScreenNum = mOldScreenNum;
|
|
||||||
|
|
||||||
mOldPosition = mPanel->position();
|
|
||||||
mPosition = mOldPosition;
|
|
||||||
|
|
||||||
mOldHidable = mPanel->hidable();
|
|
||||||
|
|
||||||
mOldAnimation = mPanel->animationTime();
|
|
||||||
mOldShowDelay = mPanel->showDelay();
|
|
||||||
|
|
||||||
ui->spinBox_panelSize->setMinimum(PANEL_MINIMUM_SIZE);
|
|
||||||
ui->spinBox_panelSize->setMaximum(PANEL_MAXIMUM_SIZE);
|
|
||||||
|
|
||||||
mOldFontColor = mPanel->fontColor();
|
|
||||||
mFontColor = mOldFontColor;
|
|
||||||
mOldBackgroundColor = mPanel->backgroundColor();
|
|
||||||
mBackgroundColor = mOldBackgroundColor;
|
|
||||||
mOldBackgroundImage = mPanel->backgroundImage();
|
|
||||||
mOldOpacity = mPanel->opacity();
|
|
||||||
mOldReserveSpace = mPanel->reserveSpace();
|
|
||||||
|
|
||||||
// reset configurations from file
|
|
||||||
reset();
|
|
||||||
|
|
||||||
connect(ui->spinBox_panelSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->spinBox_iconSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->spinBox_lineCount, SIGNAL(valueChanged(int)), this, SLOT(editChanged()));
|
|
||||||
|
|
||||||
connect(ui->spinBox_length, SIGNAL(valueChanged(int)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->comboBox_lenghtType, SIGNAL(activated(int)), this, SLOT(widthTypeChanged()));
|
|
||||||
|
|
||||||
connect(ui->comboBox_alignment, SIGNAL(activated(int)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->comboBox_position, SIGNAL(activated(int)), this, SLOT(positionChanged()));
|
|
||||||
connect(ui->checkBox_hidable, SIGNAL(toggled(bool)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->spinBox_animation, SIGNAL(valueChanged(int)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->spinBox_delay, SIGNAL(valueChanged(int)), this, SLOT(editChanged()));
|
|
||||||
|
|
||||||
connect(ui->checkBox_customFontColor, SIGNAL(toggled(bool)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->pushButton_customFontColor, SIGNAL(clicked(bool)), this, SLOT(pickFontColor()));
|
|
||||||
connect(ui->checkBox_customBgColor, SIGNAL(toggled(bool)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->pushButton_customBgColor, SIGNAL(clicked(bool)), this, SLOT(pickBackgroundColor()));
|
|
||||||
connect(ui->checkBox_customBgImage, SIGNAL(toggled(bool)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->lineEdit_customBgImage, SIGNAL(textChanged(QString)), this, SLOT(editChanged()));
|
|
||||||
connect(ui->pushButton_customBgImage, SIGNAL(clicked(bool)), this, SLOT(pickBackgroundImage()));
|
|
||||||
connect(ui->slider_opacity, &QSlider::valueChanged, this, &ConfigPanelWidget::editChanged);
|
|
||||||
|
|
||||||
connect(ui->checkBox_reserveSpace, &QAbstractButton::toggled, [this](bool checked) { mPanel->setReserveSpace(checked, true); });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::reset()
|
|
||||||
{
|
|
||||||
ui->spinBox_panelSize->setValue(mOldPanelSize);
|
|
||||||
ui->spinBox_iconSize->setValue(mOldIconSize);
|
|
||||||
ui->spinBox_lineCount->setValue(mOldLineCount);
|
|
||||||
|
|
||||||
ui->comboBox_position->setCurrentIndex(indexForPosition(mOldScreenNum, mOldPosition));
|
|
||||||
|
|
||||||
ui->checkBox_hidable->setChecked(mOldHidable);
|
|
||||||
|
|
||||||
ui->spinBox_animation->setValue(mOldAnimation);
|
|
||||||
ui->spinBox_delay->setValue(mOldShowDelay);
|
|
||||||
|
|
||||||
fillComboBox_alignment();
|
|
||||||
ui->comboBox_alignment->setCurrentIndex(mOldAlignment + 1);
|
|
||||||
|
|
||||||
ui->comboBox_lenghtType->setCurrentIndex(mOldLengthInPercents ? 0 : 1);
|
|
||||||
widthTypeChanged();
|
|
||||||
ui->spinBox_length->setValue(mOldLength);
|
|
||||||
|
|
||||||
mFontColor.setNamedColor(mOldFontColor.name());
|
|
||||||
ui->pushButton_customFontColor->setStyleSheet(QString("background: %1").arg(mOldFontColor.name()));
|
|
||||||
mBackgroundColor.setNamedColor(mOldBackgroundColor.name());
|
|
||||||
ui->pushButton_customBgColor->setStyleSheet(QString("background: %1").arg(mOldBackgroundColor.name()));
|
|
||||||
ui->lineEdit_customBgImage->setText(mOldBackgroundImage);
|
|
||||||
ui->slider_opacity->setValue(mOldOpacity);
|
|
||||||
ui->checkBox_reserveSpace->setChecked(mOldReserveSpace);
|
|
||||||
|
|
||||||
ui->checkBox_customFontColor->setChecked(mOldFontColor.isValid());
|
|
||||||
ui->checkBox_customBgColor->setChecked(mOldBackgroundColor.isValid());
|
|
||||||
ui->checkBox_customBgImage->setChecked(QFileInfo(mOldBackgroundImage).exists());
|
|
||||||
|
|
||||||
// update position
|
|
||||||
positionChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::fillComboBox_position()
|
|
||||||
{
|
|
||||||
int screenCount = QApplication::desktop()->screenCount();
|
|
||||||
if (screenCount == 1)
|
|
||||||
{
|
|
||||||
addPosition(tr("Top of desktop"), 0, LXQtPanel::PositionTop);
|
|
||||||
addPosition(tr("Left of desktop"), 0, LXQtPanel::PositionLeft);
|
|
||||||
addPosition(tr("Right of desktop"), 0, LXQtPanel::PositionRight);
|
|
||||||
addPosition(tr("Bottom of desktop"), 0, LXQtPanel::PositionBottom);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int screenNum = 0; screenNum < screenCount; screenNum++)
|
|
||||||
{
|
|
||||||
if (screenNum)
|
|
||||||
ui->comboBox_position->insertSeparator(9999);
|
|
||||||
|
|
||||||
addPosition(tr("Top of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionTop);
|
|
||||||
addPosition(tr("Left of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionLeft);
|
|
||||||
addPosition(tr("Right of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionRight);
|
|
||||||
addPosition(tr("Bottom of desktop %1").arg(screenNum +1), screenNum, LXQtPanel::PositionBottom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::fillComboBox_alignment()
|
|
||||||
{
|
|
||||||
ui->comboBox_alignment->setItemData(0, QVariant(LXQtPanel::AlignmentLeft));
|
|
||||||
ui->comboBox_alignment->setItemData(1, QVariant(LXQtPanel::AlignmentCenter));
|
|
||||||
ui->comboBox_alignment->setItemData(2, QVariant(LXQtPanel::AlignmentRight));
|
|
||||||
|
|
||||||
|
|
||||||
if (mPosition == ILXQtPanel::PositionTop ||
|
|
||||||
mPosition == ILXQtPanel::PositionBottom)
|
|
||||||
{
|
|
||||||
ui->comboBox_alignment->setItemText(0, tr("Left"));
|
|
||||||
ui->comboBox_alignment->setItemText(1, tr("Center"));
|
|
||||||
ui->comboBox_alignment->setItemText(2, tr("Right"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->comboBox_alignment->setItemText(0, tr("Top"));
|
|
||||||
ui->comboBox_alignment->setItemText(1, tr("Center"));
|
|
||||||
ui->comboBox_alignment->setItemText(2, tr("Bottom"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::addPosition(const QString& name, int screen, LXQtPanel::Position position)
|
|
||||||
{
|
|
||||||
if (LXQtPanel::canPlacedOn(screen, position))
|
|
||||||
ui->comboBox_position->addItem(name, QVariant::fromValue((ScreenPosition){screen, position}));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
int ConfigPanelWidget::indexForPosition(int screen, ILXQtPanel::Position position)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < ui->comboBox_position->count(); i++)
|
|
||||||
{
|
|
||||||
ScreenPosition sp = ui->comboBox_position->itemData(i).value<ScreenPosition>();
|
|
||||||
if (screen == sp.screen && position == sp.position)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
ConfigPanelWidget::~ConfigPanelWidget()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::editChanged()
|
|
||||||
{
|
|
||||||
mPanel->setPanelSize(ui->spinBox_panelSize->value(), true);
|
|
||||||
mPanel->setIconSize(ui->spinBox_iconSize->value(), true);
|
|
||||||
mPanel->setLineCount(ui->spinBox_lineCount->value(), true);
|
|
||||||
|
|
||||||
mPanel->setLength(ui->spinBox_length->value(),
|
|
||||||
ui->comboBox_lenghtType->currentIndex() == 0,
|
|
||||||
true);
|
|
||||||
|
|
||||||
LXQtPanel::Alignment align = LXQtPanel::Alignment(
|
|
||||||
ui->comboBox_alignment->itemData(
|
|
||||||
ui->comboBox_alignment->currentIndex()
|
|
||||||
).toInt());
|
|
||||||
|
|
||||||
mPanel->setAlignment(align, true);
|
|
||||||
mPanel->setPosition(mScreenNum, mPosition, true);
|
|
||||||
mPanel->setHidable(ui->checkBox_hidable->isChecked(), true);
|
|
||||||
mPanel->setAnimationTime(ui->spinBox_animation->value(), true);
|
|
||||||
mPanel->setShowDelay(ui->spinBox_delay->value(), true);
|
|
||||||
|
|
||||||
mPanel->setFontColor(ui->checkBox_customFontColor->isChecked() ? mFontColor : QColor(), true);
|
|
||||||
if (ui->checkBox_customBgColor->isChecked())
|
|
||||||
{
|
|
||||||
mPanel->setBackgroundColor(mBackgroundColor, true);
|
|
||||||
mPanel->setOpacity(ui->slider_opacity->value(), true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mPanel->setBackgroundColor(QColor(), true);
|
|
||||||
mPanel->setOpacity(100, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString image = ui->checkBox_customBgImage->isChecked() ? ui->lineEdit_customBgImage->text() : QString();
|
|
||||||
mPanel->setBackgroundImage(image, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::widthTypeChanged()
|
|
||||||
{
|
|
||||||
int max = getMaxLength();
|
|
||||||
|
|
||||||
if (ui->comboBox_lenghtType->currentIndex() == 0)
|
|
||||||
{
|
|
||||||
// Percents .............................
|
|
||||||
int v = ui->spinBox_length->value() * 100.0 / max;
|
|
||||||
ui->spinBox_length->setRange(1, 100);
|
|
||||||
ui->spinBox_length->setValue(v);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Pixels ...............................
|
|
||||||
int v = max / 100.0 * ui->spinBox_length->value();
|
|
||||||
ui->spinBox_length->setRange(-max, max);
|
|
||||||
ui->spinBox_length->setValue(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
int ConfigPanelWidget::getMaxLength()
|
|
||||||
{
|
|
||||||
QDesktopWidget* dw = QApplication::desktop();
|
|
||||||
|
|
||||||
if (mPosition == ILXQtPanel::PositionTop ||
|
|
||||||
mPosition == ILXQtPanel::PositionBottom)
|
|
||||||
return dw->screenGeometry(mScreenNum).width();
|
|
||||||
else
|
|
||||||
return dw->screenGeometry(mScreenNum).height();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::positionChanged()
|
|
||||||
{
|
|
||||||
ScreenPosition sp = ui->comboBox_position->itemData(
|
|
||||||
ui->comboBox_position->currentIndex()).value<ScreenPosition>();
|
|
||||||
|
|
||||||
bool updateAlig = (sp.position == ILXQtPanel::PositionTop ||
|
|
||||||
sp.position == ILXQtPanel::PositionBottom) !=
|
|
||||||
(mPosition == ILXQtPanel::PositionTop ||
|
|
||||||
mPosition == ILXQtPanel::PositionBottom);
|
|
||||||
|
|
||||||
int oldMax = getMaxLength();
|
|
||||||
mPosition = sp.position;
|
|
||||||
mScreenNum = sp.screen;
|
|
||||||
int newMax = getMaxLength();
|
|
||||||
|
|
||||||
if (ui->comboBox_lenghtType->currentIndex() == 1 &&
|
|
||||||
oldMax != newMax)
|
|
||||||
{
|
|
||||||
// Pixels ...............................
|
|
||||||
int v = ui->spinBox_length->value() * 1.0 * newMax / oldMax;
|
|
||||||
ui->spinBox_length->setMaximum(newMax);
|
|
||||||
ui->spinBox_length->setValue(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateAlig)
|
|
||||||
fillComboBox_alignment();
|
|
||||||
|
|
||||||
editChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::pickFontColor()
|
|
||||||
{
|
|
||||||
QColorDialog d(QColor(mFontColor.name()), this);
|
|
||||||
d.setWindowTitle(tr("Pick color"));
|
|
||||||
d.setWindowModality(Qt::WindowModal);
|
|
||||||
if (d.exec() && d.currentColor().isValid())
|
|
||||||
{
|
|
||||||
mFontColor.setNamedColor(d.currentColor().name());
|
|
||||||
ui->pushButton_customFontColor->setStyleSheet(QString("background: %1").arg(mFontColor.name()));
|
|
||||||
editChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::pickBackgroundColor()
|
|
||||||
{
|
|
||||||
QColorDialog d(QColor(mBackgroundColor.name()), this);
|
|
||||||
d.setWindowTitle(tr("Pick color"));
|
|
||||||
d.setWindowModality(Qt::WindowModal);
|
|
||||||
if (d.exec() && d.currentColor().isValid())
|
|
||||||
{
|
|
||||||
mBackgroundColor.setNamedColor(d.currentColor().name());
|
|
||||||
ui->pushButton_customBgColor->setStyleSheet(QString("background: %1").arg(mBackgroundColor.name()));
|
|
||||||
editChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
*
|
|
||||||
************************************************/
|
|
||||||
void ConfigPanelWidget::pickBackgroundImage()
|
|
||||||
{
|
|
||||||
QString picturesLocation;
|
|
||||||
picturesLocation = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
|
||||||
|
|
||||||
QFileDialog* d = new QFileDialog(this, tr("Pick image"), picturesLocation, tr("Images (*.png *.gif *.jpg)"));
|
|
||||||
d->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
d->setWindowModality(Qt::WindowModal);
|
|
||||||
connect(d, &QFileDialog::fileSelected, ui->lineEdit_customBgImage, &QLineEdit::setText);
|
|
||||||
d->show();
|
|
||||||
}
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Marat "Morion" Talipov <morion.self@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef CONFIGPANELWIDGET_H
|
|
||||||
#define CONFIGPANELWIDGET_H
|
|
||||||
|
|
||||||
#include "../lxqtpanel.h"
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <LXQt/ConfigDialog>
|
|
||||||
|
|
||||||
class LXQtPanel;
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ConfigPanelWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ConfigPanelWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ConfigPanelWidget(LXQtPanel *panel, QWidget *parent = 0);
|
|
||||||
~ConfigPanelWidget();
|
|
||||||
|
|
||||||
int screenNum() const { return mScreenNum; }
|
|
||||||
ILXQtPanel::Position position() const { return mPosition; }
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void changed();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void editChanged();
|
|
||||||
void widthTypeChanged();
|
|
||||||
void positionChanged();
|
|
||||||
void pickFontColor();
|
|
||||||
void pickBackgroundColor();
|
|
||||||
void pickBackgroundImage();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::ConfigPanelWidget *ui;
|
|
||||||
LXQtPanel *mPanel;
|
|
||||||
int mScreenNum;
|
|
||||||
ILXQtPanel::Position mPosition;
|
|
||||||
|
|
||||||
void addPosition(const QString& name, int screen, LXQtPanel::Position position);
|
|
||||||
void fillComboBox_position();
|
|
||||||
void fillComboBox_alignment();
|
|
||||||
int indexForPosition(int screen, ILXQtPanel::Position position);
|
|
||||||
int getMaxLength();
|
|
||||||
|
|
||||||
// new values
|
|
||||||
QColor mFontColor;
|
|
||||||
QColor mBackgroundColor;
|
|
||||||
|
|
||||||
// old values for reset
|
|
||||||
int mOldPanelSize;
|
|
||||||
int mOldIconSize;
|
|
||||||
int mOldLineCount;
|
|
||||||
int mOldLength;
|
|
||||||
bool mOldLengthInPercents;
|
|
||||||
LXQtPanel::Alignment mOldAlignment;
|
|
||||||
ILXQtPanel::Position mOldPosition;
|
|
||||||
bool mOldHidable;
|
|
||||||
int mOldAnimation;
|
|
||||||
int mOldShowDelay;
|
|
||||||
int mOldScreenNum;
|
|
||||||
QColor mOldFontColor;
|
|
||||||
QColor mOldBackgroundColor;
|
|
||||||
QString mOldBackgroundImage;
|
|
||||||
int mOldOpacity;
|
|
||||||
bool mOldReserveSpace;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,675 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ConfigPanelWidget</class>
|
|
||||||
<widget class="QWidget" name="ConfigPanelWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>382</width>
|
|
||||||
<height>517</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Configure panel</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_size">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Size</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_8" native="true">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinBox_length">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><p>Negative pixel value sets the panel length to that many pixels less than available screen space.</p><p/><p><i>E.g. "Length" set to -100px, screen size is 1000px, then real panel length will be 900 px.</i></p></string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_length">
|
|
||||||
<property name="text">
|
|
||||||
<string>Length:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QComboBox" name="comboBox_lenghtType">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>%</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>px</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" colspan="2">
|
|
||||||
<widget class="QSpinBox" name="spinBox_panelSize">
|
|
||||||
<property name="suffix">
|
|
||||||
<string> px</string>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>24</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>5</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_9" native="true">
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinBox_iconSize">
|
|
||||||
<property name="suffix">
|
|
||||||
<string> px</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>128</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_iconSize">
|
|
||||||
<property name="text">
|
|
||||||
<string>Icon size:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_lineCount">
|
|
||||||
<property name="text">
|
|
||||||
<string>Rows count:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinBox_lineCount">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Alignment && position</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_alignment">
|
|
||||||
<property name="text">
|
|
||||||
<string>Alignment:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_alignment">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Left</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Center</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Right</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_position">
|
|
||||||
<property name="text">
|
|
||||||
<string>Position:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_position"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QGroupBox" name="checkBox_hidable">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>A&uto-hide</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_animation">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Zero means no animation</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Animation duration:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>102</width>
|
|
||||||
<height>5</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QSpinBox" name="spinBox_animation">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Zero means no animation</string>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> ms</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>500</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_delay">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Zero means no delay</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Show with delay:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QSpinBox" name="spinBox_delay">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Zero means no delay</string>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> ms</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>2000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkBox_reserveSpace">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Don't allow maximized windows go under the panel window</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Reserve space on display</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Custom styling</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0" colspan="5">
|
|
||||||
<widget class="QWidget" name="widget_6" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_customFontColor">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font color:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_customFontColor">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="color-picker">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>5</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_customBgColor">
|
|
||||||
<property name="text">
|
|
||||||
<string>Background color:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_customBgColor">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="color-picker">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="5">
|
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Background opacity:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="slider_opacity">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="5">
|
|
||||||
<widget class="QLabel" name="compositingL">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string><small>Compositing is required for panel transparency.</small></string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0" colspan="2">
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkBox_customBgImage">
|
|
||||||
<property name="text">
|
|
||||||
<string>Background image:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1" colspan="4">
|
|
||||||
<widget class="QWidget" name="widget_4" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_customBgImage">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_customBgImage">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="insert-image">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customBgColor</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>pushButton_customBgColor</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>144</x>
|
|
||||||
<y>332</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>350</x>
|
|
||||||
<y>350</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customBgImage</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>lineEdit_customBgImage</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>137</x>
|
|
||||||
<y>403</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>149</x>
|
|
||||||
<y>440</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customBgImage</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>pushButton_customBgImage</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>125</x>
|
|
||||||
<y>403</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>350</x>
|
|
||||||
<y>441</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customFontColor</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>pushButton_customFontColor</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>190</x>
|
|
||||||
<y>294</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>350</x>
|
|
||||||
<y>312</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customBgColor</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>slider_opacity</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>99</x>
|
|
||||||
<y>333</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>114</x>
|
|
||||||
<y>367</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customBgColor</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>label_2</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>34</x>
|
|
||||||
<y>341</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>32</x>
|
|
||||||
<y>362</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>checkBox_customBgColor</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>compositingL</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>20</x>
|
|
||||||
<y>20</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>20</x>
|
|
||||||
<y>20</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@ -1,118 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
* Authors:
|
|
||||||
* Paulo Lieuthier <paulolieuthier@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#include "configpluginswidget.h"
|
|
||||||
#include "ui_configpluginswidget.h"
|
|
||||||
#include "addplugindialog.h"
|
|
||||||
#include "panelpluginsmodel.h"
|
|
||||||
#include "../plugin.h"
|
|
||||||
#include "../ilxqtpanelplugin.h"
|
|
||||||
|
|
||||||
#include <HtmlDelegate>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QItemSelectionModel>
|
|
||||||
|
|
||||||
ConfigPluginsWidget::ConfigPluginsWidget(LXQtPanel *panel, QWidget* parent) :
|
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::ConfigPluginsWidget),
|
|
||||||
mPanel(panel)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
PanelPluginsModel * plugins = mPanel->mPlugins.data();
|
|
||||||
{
|
|
||||||
QScopedPointer<QItemSelectionModel> m(ui->listView_plugins->selectionModel());
|
|
||||||
ui->listView_plugins->setModel(plugins);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
QScopedPointer<QAbstractItemDelegate> d(ui->listView_plugins->itemDelegate());
|
|
||||||
ui->listView_plugins->setItemDelegate(new LXQt::HtmlDelegate(QSize(16, 16), ui->listView_plugins));
|
|
||||||
}
|
|
||||||
|
|
||||||
resetButtons();
|
|
||||||
|
|
||||||
connect(ui->listView_plugins->selectionModel(), &QItemSelectionModel::selectionChanged,
|
|
||||||
this, &ConfigPluginsWidget::resetButtons);
|
|
||||||
|
|
||||||
connect(ui->pushButton_moveUp, &QToolButton::clicked, [this, plugins] { plugins->onMovePluginUp(ui->listView_plugins->currentIndex()); });
|
|
||||||
connect(ui->pushButton_moveDown, &QToolButton::clicked, [this, plugins] { plugins->onMovePluginDown(ui->listView_plugins->currentIndex()); });
|
|
||||||
|
|
||||||
connect(ui->pushButton_addPlugin, &QPushButton::clicked, this, &ConfigPluginsWidget::showAddPluginDialog);
|
|
||||||
connect(ui->pushButton_removePlugin, &QToolButton::clicked, [this, plugins] { plugins->onRemovePlugin(ui->listView_plugins->currentIndex()); });
|
|
||||||
|
|
||||||
connect(ui->pushButton_pluginConfig, &QToolButton::clicked, [this, plugins] { plugins->onConfigurePlugin(ui->listView_plugins->currentIndex()); });
|
|
||||||
|
|
||||||
connect(plugins, &PanelPluginsModel::pluginAdded, this, &ConfigPluginsWidget::resetButtons);
|
|
||||||
connect(plugins, &PanelPluginsModel::pluginRemoved, this, &ConfigPluginsWidget::resetButtons);
|
|
||||||
connect(plugins, &PanelPluginsModel::pluginMoved, this, &ConfigPluginsWidget::resetButtons);
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigPluginsWidget::~ConfigPluginsWidget()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigPluginsWidget::reset()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigPluginsWidget::showAddPluginDialog()
|
|
||||||
{
|
|
||||||
if (mAddPluginDialog.isNull())
|
|
||||||
{
|
|
||||||
mAddPluginDialog.reset(new AddPluginDialog);
|
|
||||||
connect(mAddPluginDialog.data(), &AddPluginDialog::pluginSelected,
|
|
||||||
mPanel->mPlugins.data(), &PanelPluginsModel::addPlugin);
|
|
||||||
}
|
|
||||||
mAddPluginDialog->show();
|
|
||||||
mAddPluginDialog->raise();
|
|
||||||
mAddPluginDialog->activateWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigPluginsWidget::resetButtons()
|
|
||||||
{
|
|
||||||
PanelPluginsModel *model = mPanel->mPlugins.data();
|
|
||||||
QItemSelectionModel *selectionModel = ui->listView_plugins->selectionModel();
|
|
||||||
bool hasSelection = selectionModel->hasSelection();
|
|
||||||
bool isFirstSelected = selectionModel->isSelected(model->index(0));
|
|
||||||
bool isLastSelected = selectionModel->isSelected(model->index(model->rowCount() - 1));
|
|
||||||
|
|
||||||
bool hasConfigDialog = false;
|
|
||||||
if (hasSelection)
|
|
||||||
{
|
|
||||||
Plugin const * plugin
|
|
||||||
= ui->listView_plugins->model()->data(selectionModel->currentIndex(), Qt::UserRole).value<Plugin const *>();
|
|
||||||
if (nullptr != plugin)
|
|
||||||
hasConfigDialog = plugin->iPlugin()->flags().testFlag(ILXQtPanelPlugin::HaveConfigDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->pushButton_removePlugin->setEnabled(hasSelection);
|
|
||||||
ui->pushButton_moveUp->setEnabled(hasSelection && !isFirstSelected);
|
|
||||||
ui->pushButton_moveDown->setEnabled(hasSelection && !isLastSelected);
|
|
||||||
ui->pushButton_pluginConfig->setEnabled(hasSelection && hasConfigDialog);
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
* Authors:
|
|
||||||
* Paulo Lieuthier <paulolieuthier@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef CONFIGPLUGINSWIDGET_H
|
|
||||||
#define CONFIGPLUGINSWIDGET_H
|
|
||||||
|
|
||||||
#include "../lxqtpanel.h"
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ConfigPluginsWidget;
|
|
||||||
}
|
|
||||||
class AddPluginDialog;
|
|
||||||
|
|
||||||
class ConfigPluginsWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ConfigPluginsWidget(LXQtPanel *panel, QWidget* parent = 0);
|
|
||||||
~ConfigPluginsWidget();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void changed();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void showAddPluginDialog();
|
|
||||||
void resetButtons();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::ConfigPluginsWidget *ui;
|
|
||||||
QScopedPointer<AddPluginDialog> mAddPluginDialog;
|
|
||||||
LXQtPanel *mPanel;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,213 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ConfigPluginsWidget</class>
|
|
||||||
<widget class="QWidget" name="ConfigPluginsWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>339</width>
|
|
||||||
<height>220</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Configure Plugins</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="listView_plugins">
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior">
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="flow">
|
|
||||||
<enum>QListView::TopToBottom</enum>
|
|
||||||
</property>
|
|
||||||
<property name="resizeMode">
|
|
||||||
<enum>QListView::Adjust</enum>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="uniformItemSizes">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionRectVisible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Note: changes made in this page cannot be reset.</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_5" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="pushButton_moveUp">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Move up</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="go-up">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="pushButton_moveDown">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Move down</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="go-down">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="pushButton_addPlugin">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-add">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="pushButton_removePlugin">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="list-remove">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="pushButton_pluginConfig">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Configure</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="preferences-other">
|
|
||||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</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>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,115 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ILXQTPANEL_H
|
|
||||||
#define ILXQTPANEL_H
|
|
||||||
#include <QRect>
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
class ILXQtPanelPlugin;
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
/**
|
|
||||||
**/
|
|
||||||
class LXQT_PANEL_API ILXQtPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Specifies the position of the panel on screen.
|
|
||||||
*/
|
|
||||||
enum Position{
|
|
||||||
PositionBottom, //!< The bottom side of the screen.
|
|
||||||
PositionTop, //!< The top side of the screen.
|
|
||||||
PositionLeft, //!< The left side of the screen.
|
|
||||||
PositionRight //!< The right side of the screen.
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the position of the panel. Possible values for the
|
|
||||||
* return value are described by the Position enum.
|
|
||||||
*/
|
|
||||||
virtual Position position() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the edge length of the icons that are shown on the panel
|
|
||||||
* in pixels. The icons are square.
|
|
||||||
*/
|
|
||||||
virtual int iconSize() const = 0;
|
|
||||||
/**
|
|
||||||
* @brief Returns the number of lines/rows of this panel.
|
|
||||||
*/
|
|
||||||
virtual int lineCount() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper function for convenient direction/alignment checking.
|
|
||||||
* @return True if the panel is on the top or the bottom of the
|
|
||||||
* screen; otherwise returns false.
|
|
||||||
*/
|
|
||||||
bool isHorizontal() const { return position() == PositionBottom || position() == PositionTop; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper method that returns the global screen coordinates of the
|
|
||||||
* panel, so you do not need to use QWidget::mapToGlobal() by yourself.
|
|
||||||
* @return The QRect where the panel is located in global screen
|
|
||||||
* coordinates.
|
|
||||||
*/
|
|
||||||
virtual QRect globalGometry() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper method for calculating the global screen position of a
|
|
||||||
* popup window with size windowSize.
|
|
||||||
* @param absolutePos Contains the global screen coordinates where the
|
|
||||||
* popup should be appear, i.e. the point where the user has clicked.
|
|
||||||
* @param windowSize The size that the window will occupy.
|
|
||||||
* @return The global screen position where the popup window can be shown.
|
|
||||||
*/
|
|
||||||
virtual QRect calculatePopupWindowPos(const QPoint &absolutePos, const QSize &windowSize) const = 0;
|
|
||||||
/**
|
|
||||||
* @brief Helper method for calculating the global screen position of a
|
|
||||||
* popup window with size windowSize. The parameter plugin should be a
|
|
||||||
* plugin
|
|
||||||
* @param plugin Plugin that the popup window will belong to. The position
|
|
||||||
* will be calculated according to the position of the plugin in the panel.
|
|
||||||
* @param windowSize The size that the window will occupy.
|
|
||||||
* @return The global screen position where the popup window can be shown.
|
|
||||||
*/
|
|
||||||
virtual QRect calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const = 0;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief By calling this function, a plugin (or any other object) notifies the panel
|
|
||||||
* about showing a (standalone) window/menu -> the panel needs this to avoid "hiding" in case any
|
|
||||||
* standalone window is shown. The widget/window must be shown later than this notification call because
|
|
||||||
* the panel needs to observe its show/hide/close events.
|
|
||||||
*
|
|
||||||
* \param w the window that will be shown
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
virtual void willShowWindow(QWidget * w) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ILXQTPANEL_H
|
|
@ -1,241 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ILXQTPANELPLUGIN_H
|
|
||||||
#define ILXQTPANELPLUGIN_H
|
|
||||||
|
|
||||||
#include <QtPlugin>
|
|
||||||
#include "ilxqtpanel.h"
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
LXQt panel plugins are standalone sharedlibraries
|
|
||||||
(*.so) located in PLUGIN_DIR (define provided by CMakeLists.txt).
|
|
||||||
|
|
||||||
Plugin for the panel is a library written in C++. One more necessary thing
|
|
||||||
is a .desktop file describing this plugin. The same may be additional files,
|
|
||||||
like translations. Themselves plugins will be installed to
|
|
||||||
/usr/local/lib/lxqt-panel or /usr/lib/lxqt-panel (dependent on cmake option
|
|
||||||
-DCMAKE_INSTALL_PREFIX). Desktop files are installed to
|
|
||||||
/usr/local/share/lxqt/lxqt-panel, translations to
|
|
||||||
/usr/local/share/lxqt/lxqt-panel/PLUGIN_NAME.
|
|
||||||
**/
|
|
||||||
|
|
||||||
class QDialog;
|
|
||||||
class PluginSettings;
|
|
||||||
namespace LXQt
|
|
||||||
{
|
|
||||||
class PluginInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct LXQT_PANEL_API ILXQtPanelPluginStartupInfo
|
|
||||||
{
|
|
||||||
ILXQtPanel *lxqtPanel;
|
|
||||||
PluginSettings *settings;
|
|
||||||
const LXQt::PluginInfo *desktopFile;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** \brief Base abstract class for LXQt panel widgets/plugins.
|
|
||||||
All plugins *must* be inherited from this one.
|
|
||||||
|
|
||||||
This class provides some basic API and inherited/implemented
|
|
||||||
plugins GUIs will be responsible on the functionality itself.
|
|
||||||
**/
|
|
||||||
|
|
||||||
class LXQT_PANEL_API ILXQtPanelPlugin
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
This enum describes the properties of a plugin.
|
|
||||||
**/
|
|
||||||
enum Flag {
|
|
||||||
NoFlags = 0, ///< It does not have any properties set.
|
|
||||||
PreferRightAlignment = 1, /**< The plugin prefers right alignment (for example the clock plugin);
|
|
||||||
otherwise the plugin prefers left alignment (like main menu).
|
|
||||||
This flag is used only at the first start, later positions of all
|
|
||||||
plugins are saved in a config, and this saved information is used. */
|
|
||||||
HaveConfigDialog = 2, ///< The plugin have a configuration dialog.
|
|
||||||
SingleInstance = 4, ///< The plugin allows only one instance to run.
|
|
||||||
NeedsHandle = 8 ///< The plugin needs a handle for the context menu
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(Flags, Flag)
|
|
||||||
|
|
||||||
/**
|
|
||||||
This enum describes the reason the plugin was activated.
|
|
||||||
**/
|
|
||||||
enum ActivationReason {
|
|
||||||
Unknown = 0, ///< Unknown reason
|
|
||||||
DoubleClick = 2, ///< The plugin entry was double clicked
|
|
||||||
Trigger = 3, ///< The plugin was clicked
|
|
||||||
MiddleClick = 4 ///< The plugin was clicked with the middle mouse button
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructs an ILXQtPanelPlugin object with the given startupInfo. You do not have to worry
|
|
||||||
about the startupInfo parameters, ILXQtPanelPlugin processes the parameters itself.
|
|
||||||
**/
|
|
||||||
ILXQtPanelPlugin(const ILXQtPanelPluginStartupInfo &startupInfo):
|
|
||||||
mSettings(startupInfo.settings),
|
|
||||||
mPanel(startupInfo.lxqtPanel),
|
|
||||||
mDesktopFile(startupInfo.desktopFile)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Destroys the object.
|
|
||||||
**/
|
|
||||||
virtual ~ILXQtPanelPlugin() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the plugin flags.
|
|
||||||
The base class implementation returns a NoFlags.
|
|
||||||
**/
|
|
||||||
virtual Flags flags() const { return NoFlags; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the string that is used in the theme QSS file.
|
|
||||||
If you return "WorldClock" string, theme author may write something like `#WorldClock { border: 1px solid red; }`
|
|
||||||
to set a custom border for your plugin.
|
|
||||||
**/
|
|
||||||
virtual QString themeId() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
From the user's point of view, your plugin is some visual widget on the panel. This function returns a pointer to it.
|
|
||||||
This method is called only once, so you are free to return the pointer on a class member, or create the widget on the fly.
|
|
||||||
**/
|
|
||||||
virtual QWidget *widget() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the plugin settings dialog. Reimplement this function if your plugin has it.
|
|
||||||
The panel does not take ownership of the dialog, it is probably a good idea to set Qt::WA_DeleteOnClose
|
|
||||||
attribute for the dialog.
|
|
||||||
The default implementation returns 0, no dialog;
|
|
||||||
|
|
||||||
Note that the flags method has to return HaveConfigDialog flag.
|
|
||||||
To save the settings you should use a ready-to-use ILXQtPanelPlugin::settings() object.
|
|
||||||
|
|
||||||
**/
|
|
||||||
virtual QDialog *configureDialog() { return 0; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is called when values are changed in the plugin settings.
|
|
||||||
Reimplement this function to your plugin corresponded the new settings.
|
|
||||||
|
|
||||||
The default implementation do nothing.
|
|
||||||
**/
|
|
||||||
virtual void settingsChanged() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is called when the user activates the plugin. reason specifies the reason for activation.
|
|
||||||
ILXQtPanelPlugin::ActivationReason enumerates the various reasons.
|
|
||||||
|
|
||||||
The default implementation do nothing.
|
|
||||||
**/
|
|
||||||
virtual void activated(ActivationReason reason) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function is called when the panel geometry or lines count are changed.
|
|
||||||
|
|
||||||
The default implementation do nothing.
|
|
||||||
|
|
||||||
**/
|
|
||||||
virtual void realign() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the panel object.
|
|
||||||
**/
|
|
||||||
ILXQtPanel *panel() const { return mPanel; }
|
|
||||||
|
|
||||||
|
|
||||||
PluginSettings *settings() const { return mSettings; }
|
|
||||||
const LXQt::PluginInfo *desktopFile() const { return mDesktopFile; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Helper functions for calculating global screen position of some popup window with windowSize size.
|
|
||||||
If you need to show some popup window, you can use it, to get global screen position for the new window.
|
|
||||||
**/
|
|
||||||
virtual QRect calculatePopupWindowPos(const QSize &windowSize)
|
|
||||||
{
|
|
||||||
return mPanel->calculatePopupWindowPos(this, windowSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief By calling this function plugin notifies the panel about showing a (standalone) window/menu.
|
|
||||||
*
|
|
||||||
* \param w the shown window
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
inline void willShowWindow(QWidget * w)
|
|
||||||
{
|
|
||||||
mPanel->willShowWindow(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool isSeparate() const { return false; }
|
|
||||||
virtual bool isExpandable() const { return false; }
|
|
||||||
private:
|
|
||||||
PluginSettings *mSettings;
|
|
||||||
ILXQtPanel *mPanel;
|
|
||||||
const LXQt::PluginInfo *mDesktopFile;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ILXQtPanelPlugin::Flags)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Every plugin must have the ILXQtPanelPluginLibrary loader. You should only reimplement the instance() method which should return your plugin.
|
|
||||||
Example:
|
|
||||||
@code
|
|
||||||
class LXQtClockPluginLibrary: public QObject, public ILXQtPanelPluginLibrary
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "lxde-qt.org/Panel/PluginInterface/3.0")
|
|
||||||
Q_INTERFACES(ILXQtPanelPluginLibrary)
|
|
||||||
public:
|
|
||||||
ILXQtPanelPlugin *instance(const ILXQtPanelPluginStartupInfo &startupInfo) { return new LXQtClock(startupInfo);}
|
|
||||||
};
|
|
||||||
@endcode
|
|
||||||
**/
|
|
||||||
class LXQT_PANEL_API ILXQtPanelPluginLibrary
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
Destroys the ILXQtPanelPluginLibrary object.
|
|
||||||
**/
|
|
||||||
virtual ~ILXQtPanelPluginLibrary() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the root component object of the plugin. When the library is finally unloaded, the root component will automatically be deleted.
|
|
||||||
**/
|
|
||||||
virtual ILXQtPanelPlugin* instance(const ILXQtPanelPluginStartupInfo &startupInfo) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(ILXQtPanelPluginLibrary,
|
|
||||||
"lxde-qt.org/Panel/PluginInterface/3.0")
|
|
||||||
|
|
||||||
#endif // ILXQTPANELPLUGIN_H
|
|
File diff suppressed because it is too large
Load Diff
@ -1,679 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LXQTPANEL_H
|
|
||||||
#define LXQTPANEL_H
|
|
||||||
|
|
||||||
#include <QFrame>
|
|
||||||
#include <QString>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QPointer>
|
|
||||||
#include <LXQt/Settings>
|
|
||||||
#include "ilxqtpanel.h"
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
class QMenu;
|
|
||||||
class Plugin;
|
|
||||||
class QAbstractItemModel;
|
|
||||||
|
|
||||||
namespace LXQt {
|
|
||||||
class Settings;
|
|
||||||
class PluginInfo;
|
|
||||||
}
|
|
||||||
class LXQtPanelLayout;
|
|
||||||
class ConfigPanelDialog;
|
|
||||||
class PanelPluginsModel;
|
|
||||||
class WindowNotifier;
|
|
||||||
|
|
||||||
/*! \brief The LXQtPanel class provides a single lxqt-panel. All LXQtPanel
|
|
||||||
* instances should be created and handled by LXQtPanelApplication. In turn,
|
|
||||||
* all Plugins should be created and handled by LXQtPanels.
|
|
||||||
*
|
|
||||||
* LXQtPanel is just the panel, it does not incorporate any functionality.
|
|
||||||
* Each function of the panel is implemented by Plugins, even the mainmenu
|
|
||||||
* (plugin-mainmenu) and the taskbar (plugin-taskbar). So the LXQtPanel is
|
|
||||||
* just the container for several Plugins while the different Plugins
|
|
||||||
* incorporate the functions of the panel. Without the Plugins, the panel
|
|
||||||
* is quite useless because it is just a box occupying space on the screen.
|
|
||||||
*
|
|
||||||
* LXQtPanel itself is a window (QFrame/QWidget) and this class is mainly
|
|
||||||
* responsible for handling the size and position of this window on the
|
|
||||||
* screen(s) as well as the different settings. The handling of the plugins
|
|
||||||
* is outsourced in PanelPluginsModel and LXQtPanelLayout. PanelPluginsModel
|
|
||||||
* is responsible for loading/creating and handling the plugins.
|
|
||||||
* LXQtPanelLayout is inherited from QLayout and set as layout to the
|
|
||||||
* background of LXQtPanel, so LXQtPanelLayout is responsible for the
|
|
||||||
* layout of all the Plugins.
|
|
||||||
*
|
|
||||||
* \sa LXQtPanelApplication, Plugin, PanelPluginsModel, LXQtPanelLayout.
|
|
||||||
*/
|
|
||||||
class LXQT_PANEL_API LXQtPanel : public QFrame, public ILXQtPanel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
Q_PROPERTY(QString position READ qssPosition)
|
|
||||||
|
|
||||||
// for configuration dialog
|
|
||||||
friend class ConfigPanelWidget;
|
|
||||||
friend class ConfigPluginsWidget;
|
|
||||||
friend class ConfigPanelDialog;
|
|
||||||
friend class PanelPluginsModel;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Stores how the panel should be aligned. Obviously, this applies
|
|
||||||
* only if the panel does not occupy 100 % of the available space. If the
|
|
||||||
* panel is vertical, AlignmentLeft means align to the top border of the
|
|
||||||
* screen, AlignmentRight means align to the bottom.
|
|
||||||
*/
|
|
||||||
enum Alignment {
|
|
||||||
AlignmentLeft = -1, //!< Align the panel to the left or top
|
|
||||||
AlignmentCenter = 0, //!< Center the panel
|
|
||||||
AlignmentRight = 1 //!< Align the panel to the right or bottom
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Creates and initializes the LXQtPanel. Performs the following
|
|
||||||
* steps:
|
|
||||||
* 1. Sets Qt window title, flags, attributes.
|
|
||||||
* 2. Creates the panel layout.
|
|
||||||
* 3. Prepares the timers.
|
|
||||||
* 4. Connects signals and slots.
|
|
||||||
* 5. Reads the settings for this panel.
|
|
||||||
* 6. Optionally moves the panel to a valid screen (position-dependent).
|
|
||||||
* 7. Loads the Plugins.
|
|
||||||
* 8. Shows the panel, even if it is hidable (but then, starts the timer).
|
|
||||||
* @param configGroup The name of the panel which is used as identifier
|
|
||||||
* in the config file.
|
|
||||||
* @param settings The settings instance of this lxqt panel application.
|
|
||||||
* @param parent Parent QWidget, can be omitted.
|
|
||||||
*/
|
|
||||||
LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidget *parent = 0);
|
|
||||||
virtual ~LXQtPanel();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the name of this panel which is also used as identifier
|
|
||||||
* in the config file.
|
|
||||||
*/
|
|
||||||
QString name() { return mConfigGroup; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reads all the necessary settings from mSettings and stores them
|
|
||||||
* in local variables. Additionally, calls necessary methods like realign()
|
|
||||||
* or updateStyleSheet() which need to get called after changing settings.
|
|
||||||
*/
|
|
||||||
void readSettings();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Creates and shows the popup menu (right click menu). If a plugin
|
|
||||||
* is given as parameter, the menu will be divided in two groups:
|
|
||||||
* plugin-specific options and panel-related options. As these two are
|
|
||||||
* shown together, this menu has to be created by LXQtPanel.
|
|
||||||
* @param plugin The plugin whose menu options will be included in the
|
|
||||||
* context menu.
|
|
||||||
*/
|
|
||||||
void showPopupMenu(Plugin *plugin = 0);
|
|
||||||
|
|
||||||
// ILXQtPanel overrides ........
|
|
||||||
ILXQtPanel::Position position() const override { return mPosition; }
|
|
||||||
QRect globalGometry() const override;
|
|
||||||
QRect calculatePopupWindowPos(QPoint const & absolutePos, QSize const & windowSize) const override;
|
|
||||||
QRect calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const QSize &windowSize) const override;
|
|
||||||
void willShowWindow(QWidget * w) override;
|
|
||||||
// ........ end of ILXQtPanel overrides
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Searches for a Plugin in the Plugins-list of this panel. Takes
|
|
||||||
* an ILXQtPanelPlugin as parameter and returns the corresponding Plugin.
|
|
||||||
* @param iPlugin ILXQtPanelPlugin that we are looking for.
|
|
||||||
* @return The corresponding Plugin if it is loaded in this panel, nullptr
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
Plugin *findPlugin(const ILXQtPanelPlugin *iPlugin) const;
|
|
||||||
|
|
||||||
// For QSS properties ..................
|
|
||||||
/**
|
|
||||||
* @brief Returns the position as string
|
|
||||||
*
|
|
||||||
* \sa positionToStr().
|
|
||||||
*/
|
|
||||||
QString qssPosition() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Checks if this LXQtPanel can be placed at a given position
|
|
||||||
* on the screen with the given screenNum. The condition for doing so
|
|
||||||
* is that the panel is not located between two screens.
|
|
||||||
*
|
|
||||||
* For example, if position is PositionRight, there should be no screen to
|
|
||||||
* the right of the given screen. That means that there should be no
|
|
||||||
* screen whose left border has a higher x-coordinate than the x-coordinate
|
|
||||||
* of the right border of the given screen. This method iterates over all
|
|
||||||
* screens and checks these conditions.
|
|
||||||
* @param screenNum screen index as it is used by QDesktopWidget methods
|
|
||||||
* @param position position where the panel should be placed
|
|
||||||
* @return true if this panel can be placed at the given position on the
|
|
||||||
* given screen.
|
|
||||||
*
|
|
||||||
* \sa findAvailableScreen(), mScreenNum, mActualScreenNum.
|
|
||||||
*/
|
|
||||||
static bool canPlacedOn(int screenNum, LXQtPanel::Position position);
|
|
||||||
/**
|
|
||||||
* @brief Returns a string representation of the given position. This
|
|
||||||
* string is human-readable and can be used in config files.
|
|
||||||
* @param position position that should be converted to a string.
|
|
||||||
* @return the string representation of the given position, i.e.
|
|
||||||
* "Top", "Left", "Right" or "Bottom".
|
|
||||||
*
|
|
||||||
* \sa strToPosition()
|
|
||||||
*/
|
|
||||||
static QString positionToStr(ILXQtPanel::Position position);
|
|
||||||
/**
|
|
||||||
* @brief Returns an ILXQtPanel::Position from the given string. This can
|
|
||||||
* be used to retrieve ILXQtPanel::Position values from the config files.
|
|
||||||
* @param str string that should be converted to ILXQtPanel::Position
|
|
||||||
* @param defaultValue value that will be returned if the string can not
|
|
||||||
* be converted to an ILXQtPanel::Position.
|
|
||||||
* @return ILXQtPanel::Position that was determined from str or
|
|
||||||
* defaultValue if str could not be converted.
|
|
||||||
*
|
|
||||||
* \sa positionToStr()
|
|
||||||
*/
|
|
||||||
static ILXQtPanel::Position strToPosition(const QString &str, ILXQtPanel::Position defaultValue);
|
|
||||||
|
|
||||||
// Settings
|
|
||||||
int iconSize() const override { return mIconSize; } //!< Implement ILXQtPanel::iconSize().
|
|
||||||
int lineCount() const override { return mLineCount; } //!< Implement ILXQtPanel::lineCount().
|
|
||||||
int panelSize() const { return mPanelSize; }
|
|
||||||
int length() const { return mLength; }
|
|
||||||
bool lengthInPercents() const { return mLengthInPercents; }
|
|
||||||
LXQtPanel::Alignment alignment() const { return mAlignment; }
|
|
||||||
int screenNum() const { return mScreenNum; }
|
|
||||||
QColor fontColor() const { return mFontColor; }
|
|
||||||
QColor backgroundColor() const { return mBackgroundColor; }
|
|
||||||
QString backgroundImage() const { return mBackgroundImage; }
|
|
||||||
int opacity() const { return mOpacity; }
|
|
||||||
int reserveSpace() const { return mReserveSpace; }
|
|
||||||
bool hidable() const { return mHidable; }
|
|
||||||
int animationTime() const { return mAnimationTime; }
|
|
||||||
int showDelay() const { return mShowDelayTimer.interval(); }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Checks if a given Plugin is running and has the
|
|
||||||
* ILXQtPanelPlugin::SingleInstance flag set.
|
|
||||||
* \param pluginId Plugin Identifier which is the basename of the
|
|
||||||
* .desktop file that specifies the plugin.
|
|
||||||
* \return true if the Plugin is running and has the
|
|
||||||
* ILXQtPanelPlugin::SingleInstance flag set, false otherwise.
|
|
||||||
*/
|
|
||||||
bool isPluginSingletonAndRunnig(QString const & pluginId) const;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief Shows the QWidget and makes it visible on all desktops. This
|
|
||||||
* method is NOT related to showPanel(), hidePanel() and hidePanelWork()
|
|
||||||
* which handle the LXQt hiding by resizing the panel.
|
|
||||||
*/
|
|
||||||
void show();
|
|
||||||
/**
|
|
||||||
* @brief Shows the panel (immediately) after it had been hidden before.
|
|
||||||
* Stops the QTimer mHideTimer. This it NOT the same as QWidget::show()
|
|
||||||
* because hiding the panel in LXQt is done by making it very thin. So
|
|
||||||
* this method in fact restores the original size of the panel.
|
|
||||||
* \param animate flag for the panel show-up animation disabling (\sa mAnimationTime).
|
|
||||||
*
|
|
||||||
* \sa mHidable, mHidden, mHideTimer, hidePanel(), hidePanelWork()
|
|
||||||
*/
|
|
||||||
void showPanel(bool animate);
|
|
||||||
/**
|
|
||||||
* @brief Hides the panel (delayed) by starting the QTimer mHideTimer.
|
|
||||||
* When this timer times out, hidePanelWork() will be called. So this
|
|
||||||
* method is called when the cursor leaves the panel area but the panel
|
|
||||||
* will be hidden later.
|
|
||||||
*
|
|
||||||
* \sa mHidable, mHidden, mHideTimer, showPanel(), hidePanelWork()
|
|
||||||
*/
|
|
||||||
void hidePanel();
|
|
||||||
/**
|
|
||||||
* @brief Actually hides the panel. Will be invoked when the QTimer
|
|
||||||
* mHideTimer times out. That timer will be started by showPanel(). This
|
|
||||||
* is NOT the same as QWidget::hide() because hiding the panel in LXQt is
|
|
||||||
* done by making the panel very thin. So this method in fact makes the
|
|
||||||
* panel very thin while the QWidget stays visible.
|
|
||||||
*
|
|
||||||
* \sa mHidable, mHidden, mHideTimer, showPanel(), hidePanel()
|
|
||||||
*/
|
|
||||||
void hidePanelWork();
|
|
||||||
|
|
||||||
// Settings
|
|
||||||
/**
|
|
||||||
* @brief All the setter methods are designed similar:
|
|
||||||
* 1. Check if the given value is different from the current value. If not,
|
|
||||||
* do not do anything and return.
|
|
||||||
* 2. Set the value.
|
|
||||||
* 3. If parameter save is true, call saveSettings(true) to store the
|
|
||||||
* new settings on the disk.
|
|
||||||
* 4. If necessary, propagate the new value to child objects, e.g. to
|
|
||||||
* mLayout.
|
|
||||||
* 5. If necessary, call update methods like realign() or
|
|
||||||
* updateStyleSheet().
|
|
||||||
* @param value The value that should be set.
|
|
||||||
* @param save If true, saveSettings(true) will be called.
|
|
||||||
*/
|
|
||||||
void setPanelSize(int value, bool save);
|
|
||||||
void setIconSize(int value, bool save); //!< \sa setPanelSize()
|
|
||||||
void setLineCount(int value, bool save); //!< \sa setPanelSize()
|
|
||||||
void setLength(int length, bool inPercents, bool save); //!< \sa setPanelSize()
|
|
||||||
void setPosition(int screen, ILXQtPanel::Position position, bool save); //!< \sa setPanelSize()
|
|
||||||
void setAlignment(LXQtPanel::Alignment value, bool save); //!< \sa setPanelSize()
|
|
||||||
void setFontColor(QColor color, bool save); //!< \sa setPanelSize()
|
|
||||||
void setBackgroundColor(QColor color, bool save); //!< \sa setPanelSize()
|
|
||||||
void setBackgroundImage(QString path, bool save); //!< \sa setPanelSize()
|
|
||||||
void setOpacity(int opacity, bool save); //!< \sa setPanelSize()
|
|
||||||
void setReserveSpace(bool reserveSpace, bool save); //!< \sa setPanelSize()
|
|
||||||
void setHidable(bool hidable, bool save); //!< \sa setPanelSize()
|
|
||||||
void setAnimationTime(int animationTime, bool save); //!< \sa setPanelSize()
|
|
||||||
void setShowDelay(int showDelay, bool save); //!< \sa setPanelSize()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Saves the current configuration, i.e. writes the current
|
|
||||||
* configuration varibles to mSettings.
|
|
||||||
* @param later Determines if the settings are written immediately or
|
|
||||||
* after a short delay. If later==true, the QTimer mDelaySave is started.
|
|
||||||
* As soon as this timer times out, saveSettings(false) will be called. If
|
|
||||||
* later==false, settings will be written.
|
|
||||||
*/
|
|
||||||
void saveSettings(bool later=false);
|
|
||||||
/**
|
|
||||||
* @brief Checks if the panel can be placed on the current screen at the
|
|
||||||
* current position. If it can not, it will be moved on another screen
|
|
||||||
* where the desired position is possible.
|
|
||||||
*/
|
|
||||||
void ensureVisible();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
/**
|
|
||||||
* @brief This signal gets emitted whenever this panel receives a
|
|
||||||
* QEvent::LayoutRequest, i.e. "Widget layout needs to be redone.".
|
|
||||||
* The PanelPluginsModel will connect this signal to the individual
|
|
||||||
* plugins so they can realign, too.
|
|
||||||
*/
|
|
||||||
void realigned();
|
|
||||||
/**
|
|
||||||
* @brief This signal gets emitted at the end of
|
|
||||||
* userRequestForDeletion() which in turn gets called when the user
|
|
||||||
* decides to remove a panel. This signal is used by
|
|
||||||
* LXQtPanelApplication to get notified whenever an LXQtPanel should
|
|
||||||
* be removed.
|
|
||||||
* @param self This LXQtPanel. LXQtPanelApplication will use this
|
|
||||||
* parameter to identify the LXQtPanel that should be removed.
|
|
||||||
*/
|
|
||||||
void deletedByUser(LXQtPanel *self);
|
|
||||||
/**
|
|
||||||
* @brief This signal is just a relay signal. The pluginAdded signal
|
|
||||||
* of the PanelPluginsModel (mPlugins) will be connected to this
|
|
||||||
* signal. Thereby, we can make this signal of a private member
|
|
||||||
* available as a public signal.
|
|
||||||
* Currently, this signal is used by LXQtPanelApplication which
|
|
||||||
* will further re-emit this signal.
|
|
||||||
*/
|
|
||||||
void pluginAdded();
|
|
||||||
/**
|
|
||||||
* @brief This signal is just a relay signal. The pluginRemoved signal
|
|
||||||
* of the PanelPluginsModel (mPlugins) will be connected to this
|
|
||||||
* signal. Thereby, we can make this signal of a private member
|
|
||||||
* available as a public signal.
|
|
||||||
* Currently, this signal is used by LXQtPanelApplication which
|
|
||||||
* will further re-emit this signal.
|
|
||||||
*/
|
|
||||||
void pluginRemoved();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief Overrides QObject::event(QEvent * e). Some functions of
|
|
||||||
* the panel will be triggered by these events, e.g. showing/hiding
|
|
||||||
* the panel or showing the context menu.
|
|
||||||
* @param event The event that was received.
|
|
||||||
* @return "QObject::event(QEvent *e) should return true if the event e
|
|
||||||
* was recognized and processed." This is done by passing the event to
|
|
||||||
* QFrame::event(QEvent *e) at the end.
|
|
||||||
*/
|
|
||||||
bool event(QEvent *event) override;
|
|
||||||
/**
|
|
||||||
* @brief Overrides QWidget::showEvent(QShowEvent * event). This
|
|
||||||
* method is called when a widget (in this case: the LXQtPanel) is
|
|
||||||
* shown. The call could happen before and after the widget is shown.
|
|
||||||
* This method is just overridden to get notified when the LXQtPanel
|
|
||||||
* will be shown. Then, LXQtPanel will call realign().
|
|
||||||
* @param event The QShowEvent sent by Qt.
|
|
||||||
*/
|
|
||||||
void showEvent(QShowEvent *event) override;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* @brief Shows the ConfigPanelDialog and shows the "Config Panel"
|
|
||||||
* page, i.e. calls showConfigPanelPage(). If the dialog does not
|
|
||||||
* exist yet, it will be created before.
|
|
||||||
*
|
|
||||||
* The "Configure Panel" button in the context menu of the panel will
|
|
||||||
* be connected to this slot so this method gets called whenever the
|
|
||||||
* user clicks that button.
|
|
||||||
*
|
|
||||||
* Furthermore, this method will be called by LXQtPanelApplication
|
|
||||||
* when a new plugin gets added (the LXQtPanel instances are handled
|
|
||||||
* by LXQtPanelApplication). That is why this method/slot has to be
|
|
||||||
* public.
|
|
||||||
*/
|
|
||||||
void showConfigDialog();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
/**
|
|
||||||
* @brief Shows the ConfigPanelDialog and shows the "Config Plugins"
|
|
||||||
* page, i.e. calls showConfigPluginsPage(). If the dialog does not
|
|
||||||
* exist yet, it will be created before.
|
|
||||||
*
|
|
||||||
* The "Manage Widgets" button in the context menu of the panel will
|
|
||||||
* be connected to this slot so this method gets called whenever the
|
|
||||||
* user clicks that button.
|
|
||||||
*/
|
|
||||||
void showAddPluginDialog();
|
|
||||||
/**
|
|
||||||
* @brief Recalculates the geometry of the panel and reserves the
|
|
||||||
* window manager strut, i.e. it calls setPanelGeometry() and
|
|
||||||
* updateWmStrut().
|
|
||||||
* Two signals will be connected to this slot:
|
|
||||||
* 1. QDesktopWidget::workAreaResized(int screen) which will be emitted
|
|
||||||
* when the work area available (on screen) changes.
|
|
||||||
* 2. LXQt::Application::themeChanged(), i.e. when the user changes
|
|
||||||
* the theme.
|
|
||||||
*/
|
|
||||||
void realign();
|
|
||||||
/**
|
|
||||||
* @brief Moves a plugin in PanelPluginsModel, i.e. calls
|
|
||||||
* PanelPluginsModel::movePlugin(Plugin * plugin, QString const & nameAfter).
|
|
||||||
* LXQtPanelLayout::pluginMoved() will be connected to this slot so
|
|
||||||
* it gets called whenever a plugin was moved in the layout by the user.
|
|
||||||
* @param plug
|
|
||||||
*/
|
|
||||||
void pluginMoved(Plugin * plug);
|
|
||||||
/**
|
|
||||||
* @brief Removes this panel's entries from the config file and emits
|
|
||||||
* the deletedByUser signal.
|
|
||||||
* The "Remove Panel" button in the panel's contex menu will
|
|
||||||
* be connected to this slot, so this method will be called whenever
|
|
||||||
* the user clicks "Remove Panel".
|
|
||||||
*/
|
|
||||||
void userRequestForDeletion();
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief The LXQtPanelLayout of this panel. All the Plugins will be added
|
|
||||||
* to the UI via this layout.
|
|
||||||
*/
|
|
||||||
LXQtPanelLayout* mLayout;
|
|
||||||
/**
|
|
||||||
* @brief The LXQt::Settings instance as retrieved from
|
|
||||||
* LXQtPanelApplication.
|
|
||||||
*/
|
|
||||||
LXQt::Settings *mSettings;
|
|
||||||
/**
|
|
||||||
* @brief The background widget for the panel. This background widget will
|
|
||||||
* have the background color or the background image if any of these is
|
|
||||||
* set. This background widget will have the LXQtPanelLayout mLayout which
|
|
||||||
* will in turn contain all the Plugins.
|
|
||||||
*/
|
|
||||||
QFrame *LXQtPanelWidget;
|
|
||||||
/**
|
|
||||||
* @brief The name of the panel which will also be used as an identifier
|
|
||||||
* for config files.
|
|
||||||
*/
|
|
||||||
QString mConfigGroup;
|
|
||||||
/**
|
|
||||||
* @brief Pointer to the PanelPluginsModel which will store all the Plugins
|
|
||||||
* that are loaded.
|
|
||||||
*/
|
|
||||||
QScopedPointer<PanelPluginsModel> mPlugins;
|
|
||||||
/**
|
|
||||||
* @brief object for storing info if some standalone window is shown
|
|
||||||
* (for preventing hide)
|
|
||||||
*/
|
|
||||||
QScopedPointer<WindowNotifier> mStandaloneWindows;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the screen index of a screen on which this panel could
|
|
||||||
* be placed at the given position. If possible, the current screen index
|
|
||||||
* is preserved. So, if the panel can be placed on the current screen, the
|
|
||||||
* index of that screen will be returned.
|
|
||||||
* @param position position at which the panel should be placed.
|
|
||||||
* @return The current screen index if the panel can be placed on the
|
|
||||||
* current screen or the screen index of a screen that it can be placed on.
|
|
||||||
*
|
|
||||||
* \sa canPlacedOn(), mScreenNum, mActualScreenNum.
|
|
||||||
*/
|
|
||||||
int findAvailableScreen(LXQtPanel::Position position);
|
|
||||||
/**
|
|
||||||
* @brief Update the window manager struts _NET_WM_PARTIAL_STRUT and
|
|
||||||
* _NET_WM_STRUT for this widget. "The purpose of struts is to reserve
|
|
||||||
* space at the borders of the desktop. This is very useful for a
|
|
||||||
* docking area, a taskbar or a panel, for instance. The Window Manager
|
|
||||||
* should take this reserved area into account when constraining window
|
|
||||||
* positions - maximized windows, for example, should not cover that
|
|
||||||
* area."
|
|
||||||
* \sa http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#NETWMSTRUT
|
|
||||||
*/
|
|
||||||
void updateWmStrut();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Loads the plugins, i.e. creates a new PanelPluginsModel.
|
|
||||||
* Connects the signals and slots and adds all the plugins to the
|
|
||||||
* layout.
|
|
||||||
*/
|
|
||||||
void loadPlugins();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calculates and sets the geometry (i.e. the position and the size
|
|
||||||
* on the screen) of the panel. Considers alignment, position, if the panel
|
|
||||||
* is hidden and if its geometry should be set with animation.
|
|
||||||
* \param animate flag if showing/hiding the panel should be animated.
|
|
||||||
*/
|
|
||||||
void setPanelGeometry(bool animate = false);
|
|
||||||
/**
|
|
||||||
* @brief Sets the contents margins of the panel according to its position
|
|
||||||
* and hiddenness. All margins are zero for visible panels.
|
|
||||||
*/
|
|
||||||
void setMargins();
|
|
||||||
/**
|
|
||||||
* @brief Calculates the height of the panel if it is horizontal or the
|
|
||||||
* width if the panel is vertical. Considers if the panel is hidden and
|
|
||||||
* ensures that the result is at least PANEL_MINIMUM_SIZE.
|
|
||||||
* @return The height/width of the panel.
|
|
||||||
*/
|
|
||||||
int getReserveDimension();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stores the size of the panel, i.e. the height of a horizontal
|
|
||||||
* panel or the width of a vertical panel in pixels. If the panel is
|
|
||||||
* hidden (which is achieved by making the panel very thin), this value
|
|
||||||
* is unchanged. So this value stores the size of the non-hidden panel.
|
|
||||||
*
|
|
||||||
* \sa panelSize(), setPanelSize().
|
|
||||||
*/
|
|
||||||
int mPanelSize;
|
|
||||||
/**
|
|
||||||
* @brief Stores the edge length of the panel icons in pixels.
|
|
||||||
*
|
|
||||||
* \sa ILXQtPanel::iconSize(), setIconSize().
|
|
||||||
*/
|
|
||||||
int mIconSize;
|
|
||||||
/**
|
|
||||||
* @brief Stores the number of lines/rows of the panel.
|
|
||||||
*
|
|
||||||
* \sa ILXQtPanel::lineCount(), setLineCount().
|
|
||||||
*/
|
|
||||||
int mLineCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stores the length of the panel, i.e. the width of a horizontal
|
|
||||||
* panel or the height of a vertical panel. The unit of this value is
|
|
||||||
* determined by mLengthInPercents.
|
|
||||||
*
|
|
||||||
* \sa mLengthInPercents
|
|
||||||
*/
|
|
||||||
int mLength;
|
|
||||||
/**
|
|
||||||
* @brief Stores if mLength is stored in pixels or relative to the
|
|
||||||
* screen size in percents. If true, the length is stored in percents,
|
|
||||||
* otherwise in pixels.
|
|
||||||
*
|
|
||||||
* \sa mLength
|
|
||||||
*/
|
|
||||||
bool mLengthInPercents;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stores how this panel is aligned. The meaning of this value
|
|
||||||
* differs for horizontal and vertical panels.
|
|
||||||
*
|
|
||||||
* \sa Alignment.
|
|
||||||
*/
|
|
||||||
Alignment mAlignment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stores the position where the panel is shown
|
|
||||||
*/
|
|
||||||
ILXQtPanel::Position mPosition;
|
|
||||||
/**
|
|
||||||
* @brief Returns the index of the screen on which this panel should be
|
|
||||||
* shown. This is the user configured value which can differ from the
|
|
||||||
* screen that the panel is actually shown on. If the panel can not be
|
|
||||||
* shown on the configured screen, LXQtPanel will determine another
|
|
||||||
* screen. The screen that the panel is actually shown on is stored in
|
|
||||||
* mActualScreenNum.
|
|
||||||
*
|
|
||||||
* @return The index of the screen on which this panel should be shown.
|
|
||||||
*
|
|
||||||
* \sa mActualScreenNum, canPlacedOn(), findAvailableScreen().
|
|
||||||
*/
|
|
||||||
int mScreenNum;
|
|
||||||
/**
|
|
||||||
* @brief screen that the panel is currently shown at (this could
|
|
||||||
* differ from mScreenNum).
|
|
||||||
*
|
|
||||||
* \sa mScreenNum, canPlacedOn(), findAvailableScreen().
|
|
||||||
*/
|
|
||||||
int mActualScreenNum;
|
|
||||||
/**
|
|
||||||
* @brief QTimer for delayed saving of changed settings. In many cases,
|
|
||||||
* instead of storing changes to disk immediately we start this timer.
|
|
||||||
* If this timer times out, we store the changes to disk. This has the
|
|
||||||
* advantage that we can store a couple of changes with only one write to
|
|
||||||
* disk.
|
|
||||||
*
|
|
||||||
* \sa saveSettings()
|
|
||||||
*/
|
|
||||||
QTimer mDelaySave;
|
|
||||||
/**
|
|
||||||
* @brief Stores if the panel is hidable, i.e. if the panel will be
|
|
||||||
* hidden after the cursor has left the panel area.
|
|
||||||
*
|
|
||||||
* \sa mHidden, mHideTimer, showPanel(), hidePanel(), hidePanelWork()
|
|
||||||
*/
|
|
||||||
bool mHidable;
|
|
||||||
/**
|
|
||||||
* @brief Stores if the panel is currently hidden.
|
|
||||||
*
|
|
||||||
* \sa mHidable, mHideTimer, showPanel(), hidePanel(), hidePanelWork()
|
|
||||||
*/
|
|
||||||
bool mHidden;
|
|
||||||
/**
|
|
||||||
* @brief QTimer for hiding the panel. When the cursor leaves the panel
|
|
||||||
* area, this timer will be started. After this timer has timed out, the
|
|
||||||
* panel will actually be hidden.
|
|
||||||
*
|
|
||||||
* \sa mHidable, mHidden, showPanel(), hidePanel(), hidePanelWork()
|
|
||||||
*/
|
|
||||||
QTimer mHideTimer;
|
|
||||||
/**
|
|
||||||
* @brief Stores the duration of auto-hide animation.
|
|
||||||
*
|
|
||||||
* \sa mHidden, mHideTimer, showPanel(), hidePanel(), hidePanelWork()
|
|
||||||
*/
|
|
||||||
int mAnimationTime;
|
|
||||||
/**
|
|
||||||
* @brief The timer used for showing an auto-hiding panel wih delay.
|
|
||||||
*
|
|
||||||
* \sa showPanel()
|
|
||||||
*/
|
|
||||||
QTimer mShowDelayTimer;
|
|
||||||
|
|
||||||
QColor mFontColor; //!< Font color that is used in the style sheet.
|
|
||||||
QColor mBackgroundColor; //!< Background color that is used in the style sheet.
|
|
||||||
QString mBackgroundImage; //!< Background image that is used in the style sheet.
|
|
||||||
/**
|
|
||||||
* @brief Determines the opacity of the background color. The value
|
|
||||||
* should be in the range from 0 to 100. This will not affect the opacity
|
|
||||||
* of a background image.
|
|
||||||
*/
|
|
||||||
int mOpacity;
|
|
||||||
/*!
|
|
||||||
* \brief Flag if the panel should reserve the space under it as not usable
|
|
||||||
* for "normal" windows. Usable for not 100% wide/hight or hiddable panels,
|
|
||||||
* if user wants maximized windows go under the panel.
|
|
||||||
*
|
|
||||||
* \sa updateWmStrut()
|
|
||||||
*/
|
|
||||||
bool mReserveSpace;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Pointer to the current ConfigPanelDialog if there is any. Make
|
|
||||||
* sure to test this pointer for validity because it is lazily loaded.
|
|
||||||
*/
|
|
||||||
QPointer<ConfigPanelDialog> mConfigDialog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The animation used for showing/hiding an auto-hiding panel.
|
|
||||||
*/
|
|
||||||
QPropertyAnimation *mAnimation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Flag for providing the configuration options in panel's context menu
|
|
||||||
*/
|
|
||||||
bool mLockPanel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Updates the style sheet for the panel. First, the stylesheet is
|
|
||||||
* created from the preferences. Then, it is set via
|
|
||||||
* QWidget::setStyleSheet().
|
|
||||||
*/
|
|
||||||
void updateStyleSheet();
|
|
||||||
|
|
||||||
// settings should be kept private for security
|
|
||||||
LXQt::Settings *settings() const { return mSettings; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // LXQTPANEL_H
|
|
@ -1,281 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "lxqtpanelapplication.h"
|
|
||||||
#include "lxqtpanelapplication_p.h"
|
|
||||||
#include "lxqtpanel.h"
|
|
||||||
#include "config/configpaneldialog.h"
|
|
||||||
#include <LXQt/Settings>
|
|
||||||
#include <QtDebug>
|
|
||||||
#include <QUuid>
|
|
||||||
#include <QScreen>
|
|
||||||
#include <QWindow>
|
|
||||||
#include <QCommandLineParser>
|
|
||||||
|
|
||||||
LXQtPanelApplicationPrivate::LXQtPanelApplicationPrivate(LXQtPanelApplication *q)
|
|
||||||
: mSettings(0),
|
|
||||||
q_ptr(q)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILXQtPanel::Position LXQtPanelApplicationPrivate::computeNewPanelPosition(const LXQtPanel *p, const int screenNum)
|
|
||||||
{
|
|
||||||
Q_Q(LXQtPanelApplication);
|
|
||||||
QVector<bool> screenPositions(4, false); // false means not occupied
|
|
||||||
|
|
||||||
for (int i = 0; i < q->mPanels.size(); ++i) {
|
|
||||||
if (p != q->mPanels.at(i)) {
|
|
||||||
// We are not the newly added one
|
|
||||||
if (screenNum == q->mPanels.at(i)->screenNum()) { // Panels on the same screen
|
|
||||||
int p = static_cast<int> (q->mPanels.at(i)->position());
|
|
||||||
screenPositions[p] = true; // occupied
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int availablePosition = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) { // Bottom, Top, Left, Right
|
|
||||||
if (!screenPositions[i]) {
|
|
||||||
availablePosition = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<ILXQtPanel::Position> (availablePosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
|
|
||||||
: LXQt::Application(argc, argv, true),
|
|
||||||
d_ptr(new LXQtPanelApplicationPrivate(this))
|
|
||||||
|
|
||||||
{
|
|
||||||
Q_D(LXQtPanelApplication);
|
|
||||||
|
|
||||||
QCoreApplication::setApplicationName(QLatin1String("lxqt-panel"));
|
|
||||||
const QString VERINFO = QStringLiteral(LXQT_PANEL_VERSION
|
|
||||||
"\nliblxqt " LXQT_VERSION
|
|
||||||
"\nQt " QT_VERSION_STR);
|
|
||||||
|
|
||||||
QCoreApplication::setApplicationVersion(VERINFO);
|
|
||||||
|
|
||||||
QCommandLineParser parser;
|
|
||||||
parser.setApplicationDescription(QLatin1String("LXQt Panel"));
|
|
||||||
parser.addHelpOption();
|
|
||||||
parser.addVersionOption();
|
|
||||||
|
|
||||||
QCommandLineOption configFileOption(QStringList()
|
|
||||||
<< QLatin1String("c") << QLatin1String("config") << QLatin1String("configfile"),
|
|
||||||
QCoreApplication::translate("main", "Use alternate configuration file."),
|
|
||||||
QCoreApplication::translate("main", "Configuration file"));
|
|
||||||
parser.addOption(configFileOption);
|
|
||||||
|
|
||||||
parser.process(*this);
|
|
||||||
|
|
||||||
const QString configFile = parser.value(configFileOption);
|
|
||||||
|
|
||||||
if (configFile.isEmpty())
|
|
||||||
d->mSettings = new LXQt::Settings(QLatin1String("panel"), this);
|
|
||||||
else
|
|
||||||
d->mSettings = new LXQt::Settings(configFile, QSettings::IniFormat, this);
|
|
||||||
|
|
||||||
// This is a workaround for Qt 5 bug #40681.
|
|
||||||
Q_FOREACH(QScreen* screen, screens())
|
|
||||||
{
|
|
||||||
connect(screen, &QScreen::destroyed, this, &LXQtPanelApplication::screenDestroyed);
|
|
||||||
}
|
|
||||||
connect(this, &QGuiApplication::screenAdded, this, &LXQtPanelApplication::handleScreenAdded);
|
|
||||||
connect(this, &QCoreApplication::aboutToQuit, this, &LXQtPanelApplication::cleanup);
|
|
||||||
|
|
||||||
|
|
||||||
QStringList panels = d->mSettings->value("panels").toStringList();
|
|
||||||
|
|
||||||
if (panels.isEmpty())
|
|
||||||
{
|
|
||||||
panels << "panel1";
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_FOREACH(QString i, panels)
|
|
||||||
{
|
|
||||||
addPanel(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LXQtPanelApplication::~LXQtPanelApplication()
|
|
||||||
{
|
|
||||||
delete d_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LXQtPanelApplication::cleanup()
|
|
||||||
{
|
|
||||||
qDeleteAll(mPanels);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LXQtPanelApplication::addNewPanel()
|
|
||||||
{
|
|
||||||
Q_D(LXQtPanelApplication);
|
|
||||||
|
|
||||||
QString name("panel_" + QUuid::createUuid().toString());
|
|
||||||
|
|
||||||
LXQtPanel *p = addPanel(name);
|
|
||||||
int screenNum = p->screenNum();
|
|
||||||
ILXQtPanel::Position newPanelPosition = d->computeNewPanelPosition(p, screenNum);
|
|
||||||
p->setPosition(screenNum, newPanelPosition, true);
|
|
||||||
QStringList panels = d->mSettings->value("panels").toStringList();
|
|
||||||
panels << name;
|
|
||||||
d->mSettings->setValue("panels", panels);
|
|
||||||
|
|
||||||
// Poupup the configuration dialog to allow user configuration right away
|
|
||||||
p->showConfigDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
LXQtPanel* LXQtPanelApplication::addPanel(const QString& name)
|
|
||||||
{
|
|
||||||
Q_D(LXQtPanelApplication);
|
|
||||||
|
|
||||||
LXQtPanel *panel = new LXQtPanel(name, d->mSettings);
|
|
||||||
mPanels << panel;
|
|
||||||
|
|
||||||
// reemit signals
|
|
||||||
connect(panel, &LXQtPanel::deletedByUser, this, &LXQtPanelApplication::removePanel);
|
|
||||||
connect(panel, &LXQtPanel::pluginAdded, this, &LXQtPanelApplication::pluginAdded);
|
|
||||||
connect(panel, &LXQtPanel::pluginRemoved, this, &LXQtPanelApplication::pluginRemoved);
|
|
||||||
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LXQtPanelApplication::handleScreenAdded(QScreen* newScreen)
|
|
||||||
{
|
|
||||||
// qDebug() << "LXQtPanelApplication::handleScreenAdded" << newScreen;
|
|
||||||
connect(newScreen, &QScreen::destroyed, this, &LXQtPanelApplication::screenDestroyed);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LXQtPanelApplication::reloadPanelsAsNeeded()
|
|
||||||
{
|
|
||||||
Q_D(LXQtPanelApplication);
|
|
||||||
|
|
||||||
// NOTE by PCMan: This is a workaround for Qt 5 bug #40681.
|
|
||||||
// Here we try to re-create the missing panels which are deleted in
|
|
||||||
// LXQtPanelApplication::screenDestroyed().
|
|
||||||
|
|
||||||
// qDebug() << "LXQtPanelApplication::reloadPanelsAsNeeded()";
|
|
||||||
QStringList names = d->mSettings->value("panels").toStringList();
|
|
||||||
Q_FOREACH(const QString& name, names)
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
Q_FOREACH(LXQtPanel* panel, mPanels)
|
|
||||||
{
|
|
||||||
if(panel->name() == name)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!found)
|
|
||||||
{
|
|
||||||
// the panel is found in the config file but does not exist, create it.
|
|
||||||
qDebug() << "Workaround Qt 5 bug #40681: re-create panel:" << name;
|
|
||||||
addPanel(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
qApp->setQuitOnLastWindowClosed(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LXQtPanelApplication::screenDestroyed(QObject* screenObj)
|
|
||||||
{
|
|
||||||
// NOTE by PCMan: This is a workaround for Qt 5 bug #40681.
|
|
||||||
// With this very dirty workaround, we can fix lxde/lxde-qt bug #204, #205, and #206.
|
|
||||||
// Qt 5 has two new regression bugs which breaks lxqt-panel in a multihead environment.
|
|
||||||
// #40681: Regression bug: QWidget::winId() returns old value and QEvent::WinIdChange event is not emitted sometimes. (multihead setup)
|
|
||||||
// #40791: Regression: QPlatformWindow, QWindow, and QWidget::winId() are out of sync.
|
|
||||||
// Explanations for the workaround:
|
|
||||||
// Internally, Qt mantains a list of QScreens and update it when XRandR configuration changes.
|
|
||||||
// When the user turn off an monitor with xrandr --output <xxx> --off, this will destroy the QScreen
|
|
||||||
// object which represent the output. If the QScreen being destroyed contains our panel widget,
|
|
||||||
// Qt will call QWindow::setScreen(0) on the internal windowHandle() of our panel widget to move it
|
|
||||||
// to the primary screen. However, moving a window to a different screen is more than just changing
|
|
||||||
// its position. With XRandR, all screens are actually part of the same virtual desktop. However,
|
|
||||||
// this is not the case in other setups, such as Xinerama and moving a window to another screen is
|
|
||||||
// not possible unless you destroy the widget and create it again for a new screen.
|
|
||||||
// Therefore, Qt destroy the widget and re-create it when moving our panel to a new screen.
|
|
||||||
// Unfortunately, destroying the window also destroy the child windows embedded into it,
|
|
||||||
// using XEMBED such as the tray icons. (#206)
|
|
||||||
// Second, when the window is re-created, the winId of the QWidget is changed, but Qt failed to
|
|
||||||
// generate QEvent::WinIdChange event so we have no way to know that. We have to set
|
|
||||||
// some X11 window properties using the native winId() to make it a dock, but this stop working
|
|
||||||
// because we cannot get the correct winId(), so this causes #204 and #205.
|
|
||||||
//
|
|
||||||
// The workaround is very simple. Just completely destroy the panel before Qt has a chance to do
|
|
||||||
// QWindow::setScreen() for it. Later, we reload the panel ourselves. So this can bypassing the Qt bugs.
|
|
||||||
QScreen* screen = static_cast<QScreen*>(screenObj);
|
|
||||||
bool reloadNeeded = false;
|
|
||||||
qApp->setQuitOnLastWindowClosed(false);
|
|
||||||
Q_FOREACH(LXQtPanel* panel, mPanels)
|
|
||||||
{
|
|
||||||
QWindow* panelWindow = panel->windowHandle();
|
|
||||||
if(panelWindow && panelWindow->screen() == screen)
|
|
||||||
{
|
|
||||||
// the screen containing the panel is destroyed
|
|
||||||
// delete and then re-create the panel ourselves
|
|
||||||
QString name = panel->name();
|
|
||||||
panel->saveSettings(false);
|
|
||||||
delete panel; // delete the panel, so Qt does not have a chance to set a new screen to it.
|
|
||||||
mPanels.removeAll(panel);
|
|
||||||
reloadNeeded = true;
|
|
||||||
qDebug() << "Workaround Qt 5 bug #40681: delete panel:" << name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(reloadNeeded)
|
|
||||||
QTimer::singleShot(1000, this, SLOT(reloadPanelsAsNeeded()));
|
|
||||||
else
|
|
||||||
qApp->setQuitOnLastWindowClosed(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LXQtPanelApplication::removePanel(LXQtPanel* panel)
|
|
||||||
{
|
|
||||||
Q_D(LXQtPanelApplication);
|
|
||||||
Q_ASSERT(mPanels.contains(panel));
|
|
||||||
|
|
||||||
mPanels.removeAll(panel);
|
|
||||||
|
|
||||||
QStringList panels = d->mSettings->value("panels").toStringList();
|
|
||||||
panels.removeAll(panel->name());
|
|
||||||
d->mSettings->setValue("panels", panels);
|
|
||||||
|
|
||||||
panel->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LXQtPanelApplication::isPluginSingletonAndRunnig(QString const & pluginId) const
|
|
||||||
{
|
|
||||||
for (auto const & panel : mPanels)
|
|
||||||
if (panel->isPluginSingletonAndRunnig(pluginId))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -1,183 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LXQTPANELAPPLICATION_H
|
|
||||||
#define LXQTPANELAPPLICATION_H
|
|
||||||
|
|
||||||
#include <LXQt/Application>
|
|
||||||
#include "ilxqtpanelplugin.h"
|
|
||||||
|
|
||||||
class QScreen;
|
|
||||||
|
|
||||||
class LXQtPanel;
|
|
||||||
class LXQtPanelApplicationPrivate;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The LXQtPanelApplication class inherits from LXQt::Application and
|
|
||||||
* is therefore the QApplication that we will create and execute in our
|
|
||||||
* main()-function.
|
|
||||||
*
|
|
||||||
* LXQtPanelApplication itself is not a visible panel, rather it is only
|
|
||||||
* the container which holds the visible panels. These visible panels are
|
|
||||||
* LXQtPanel objects which are stored in mPanels. This approach enables us
|
|
||||||
* to have more than one panel (for example one panel at the top and one
|
|
||||||
* panel at the bottom of the screen) without additional effort.
|
|
||||||
*/
|
|
||||||
class LXQtPanelApplication : public LXQt::Application
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/*!
|
|
||||||
* \brief Creates a new LXQtPanelApplication with the given command line
|
|
||||||
* arguments. Performs the following steps:
|
|
||||||
* 1. Initializes the LXQt::Application, sets application name and version.
|
|
||||||
* 2. Handles command line arguments. Currently, the only cmdline argument
|
|
||||||
* is -c = -config = -configfile which chooses a different config file
|
|
||||||
* for the LXQt::Settings.
|
|
||||||
* 3. Creates the LXQt::Settings.
|
|
||||||
* 4. Connects QCoreApplication::aboutToQuit to cleanup().
|
|
||||||
* 5. Calls addPanel() for each panel found in the config file. If there is
|
|
||||||
* none, adds a new panel.
|
|
||||||
* \param argc
|
|
||||||
* \param argv
|
|
||||||
*/
|
|
||||||
explicit LXQtPanelApplication(int& argc, char** argv);
|
|
||||||
~LXQtPanelApplication();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Determines the number of LXQtPanel objects
|
|
||||||
* \return the current number of LXQtPanel objects
|
|
||||||
*/
|
|
||||||
int count() { return mPanels.count(); }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Checks if a given Plugin is running and has the
|
|
||||||
* ILXQtPanelPlugin::SingleInstance flag set. As Plugins are added to
|
|
||||||
* LXQtPanel instances, this method only iterates over these LXQtPanel
|
|
||||||
* instances and lets them check the conditions.
|
|
||||||
* \param pluginId Plugin Identifier which is the basename of the .desktop
|
|
||||||
* file that specifies the plugin.
|
|
||||||
* \return true if the Plugin is running and has the
|
|
||||||
* ILXQtPanelPlugin::SingleInstance flag set, false otherwise.
|
|
||||||
*/
|
|
||||||
bool isPluginSingletonAndRunnig(QString const & pluginId) const;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/*!
|
|
||||||
* \brief Adds a new LXQtPanel which consists of the following steps:
|
|
||||||
* 1. Create id/name.
|
|
||||||
* 2. Create the LXQtPanel: call addPanel(name).
|
|
||||||
* 3. Update the config file (add the new panel id to the list of panels).
|
|
||||||
* 4. Show the panel configuration dialog so that the user can add plugins.
|
|
||||||
*
|
|
||||||
* This method will create a new LXQtPanel with a new name and add this
|
|
||||||
* to the config file. So this should only be used while the application
|
|
||||||
* is running and the user decides to add a new panel. At application
|
|
||||||
* startup, addPanel() should be used instead.
|
|
||||||
*
|
|
||||||
* \note This slot will be used from the LXQtPanel right-click menu. As we
|
|
||||||
* can only add new panels from a visible panel, we should never run
|
|
||||||
* lxqt-panel without an LXQtPanel. Without a panel, we have just an
|
|
||||||
* invisible application.
|
|
||||||
*/
|
|
||||||
void addNewPanel();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
/*!
|
|
||||||
* \brief Signal that re-emits the signal pluginAdded() from LXQtPanel.
|
|
||||||
*/
|
|
||||||
void pluginAdded();
|
|
||||||
/*!
|
|
||||||
* \brief Signal that re-emits the signal pluginRemoved() from LXQtPanel.
|
|
||||||
*/
|
|
||||||
void pluginRemoved();
|
|
||||||
|
|
||||||
private:
|
|
||||||
/*!
|
|
||||||
* \brief Holds all the instances of LXQtPanel.
|
|
||||||
*/
|
|
||||||
QList<LXQtPanel*> mPanels;
|
|
||||||
/*!
|
|
||||||
* \brief Creates a new LXQtPanel with the given name and connects the
|
|
||||||
* appropriate signals and slots.
|
|
||||||
* This method can be used at application startup.
|
|
||||||
* \param name Name of the LXQtPanel as it is used in the config file.
|
|
||||||
* \return The newly created LXQtPanel.
|
|
||||||
*/
|
|
||||||
LXQtPanel* addPanel(const QString &name);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
/*!
|
|
||||||
* \brief Removes the given LXQtPanel which consists of the following
|
|
||||||
* steps:
|
|
||||||
* 1. Remove the panel from mPanels.
|
|
||||||
* 2. Remove the panel from the config file.
|
|
||||||
* 3. Schedule the QObject for deletion: QObject::deleteLater().
|
|
||||||
* \param panel LXQtPanel instance that should be removed.
|
|
||||||
*/
|
|
||||||
void removePanel(LXQtPanel* panel);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Connects the QScreen::destroyed signal of a new screen to
|
|
||||||
* the screenDestroyed() slot so that we can handle this screens'
|
|
||||||
* destruction as soon as it happens.
|
|
||||||
* \param newScreen The QScreen that was created and added.
|
|
||||||
*/
|
|
||||||
void handleScreenAdded(QScreen* newScreen);
|
|
||||||
/*!
|
|
||||||
* \brief Handles screen destruction. This is a workaround for a Qt bug.
|
|
||||||
* For further information, see the implementation notes.
|
|
||||||
* \param screenObj The QScreen that was destroyed.
|
|
||||||
*/
|
|
||||||
void screenDestroyed(QObject* screenObj);
|
|
||||||
/*!
|
|
||||||
* \brief Reloads the panels. This is the second part of the workaround
|
|
||||||
* mentioned above.
|
|
||||||
*/
|
|
||||||
void reloadPanelsAsNeeded();
|
|
||||||
/*!
|
|
||||||
* \brief Deletes all LXQtPanel instances that are stored in mPanels.
|
|
||||||
*/
|
|
||||||
void cleanup();
|
|
||||||
|
|
||||||
private:
|
|
||||||
/*!
|
|
||||||
* \brief mSettings is the LXQt::Settings object that is used for the
|
|
||||||
* current instance of lxqt-panel. Normally, this refers to the config file
|
|
||||||
* $HOME/.config/lxqt/panel.conf (on Unix systems). This behaviour can be
|
|
||||||
* changed with the -c command line option.
|
|
||||||
*/
|
|
||||||
|
|
||||||
LXQtPanelApplicationPrivate *const d_ptr;
|
|
||||||
|
|
||||||
Q_DECLARE_PRIVATE(LXQtPanelApplication)
|
|
||||||
Q_DISABLE_COPY(LXQtPanelApplication)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // LXQTPANELAPPLICATION_H
|
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* Copyright (C) 2016 Luís Pereira <luis.artur.pereira@gmail.com>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LXQTPANELAPPLICATION_P_H
|
|
||||||
#define LXQTPANELAPPLICATION_P_H
|
|
||||||
|
|
||||||
#include "lxqtpanelapplication.h"
|
|
||||||
|
|
||||||
namespace LXQt {
|
|
||||||
class Settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
class LXQtPanelApplicationPrivate {
|
|
||||||
Q_DECLARE_PUBLIC(LXQtPanelApplication)
|
|
||||||
public:
|
|
||||||
|
|
||||||
LXQtPanelApplicationPrivate(LXQtPanelApplication *q);
|
|
||||||
~LXQtPanelApplicationPrivate() {};
|
|
||||||
|
|
||||||
LXQt::Settings *mSettings;
|
|
||||||
|
|
||||||
ILXQtPanel::Position computeNewPanelPosition(const LXQtPanel *p, const int screenNum);
|
|
||||||
|
|
||||||
private:
|
|
||||||
LXQtPanelApplication *const q_ptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LXQTPANELAPPLICATION_P_H
|
|
@ -1,39 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxde.org/
|
|
||||||
*
|
|
||||||
* Copyright: 2013 LXDE-Qt team
|
|
||||||
* Authors:
|
|
||||||
* Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef __LXQT_PANEL_GLOBALS_H__
|
|
||||||
#define __LXQT_PANEL_GLOBALS_H__
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#ifdef COMPILE_LXQT_PANEL
|
|
||||||
#define LXQT_PANEL_API Q_DECL_EXPORT
|
|
||||||
#else
|
|
||||||
#define LXQT_PANEL_API Q_DECL_IMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __LXQT_PANEL_GLOBALS_H__
|
|
File diff suppressed because it is too large
Load Diff
@ -1,102 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LXQTPANELLAYOUT_H
|
|
||||||
#define LXQTPANELLAYOUT_H
|
|
||||||
|
|
||||||
#include <QLayout>
|
|
||||||
#include <QList>
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLayoutItem>
|
|
||||||
#include "ilxqtpanel.h"
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
class MoveInfo;
|
|
||||||
class QMouseEvent;
|
|
||||||
class QEvent;
|
|
||||||
|
|
||||||
class Plugin;
|
|
||||||
class LayoutItemGrid;
|
|
||||||
|
|
||||||
class LXQT_PANEL_API LXQtPanelLayout : public QLayout
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LXQtPanelLayout(QWidget *parent);
|
|
||||||
~LXQtPanelLayout();
|
|
||||||
|
|
||||||
void addItem(QLayoutItem *item);
|
|
||||||
QLayoutItem *itemAt(int index) const;
|
|
||||||
QLayoutItem *takeAt(int index);
|
|
||||||
int count() const;
|
|
||||||
void moveItem(int from, int to, bool withAnimation=false);
|
|
||||||
|
|
||||||
QSize sizeHint() const;
|
|
||||||
//QSize minimumSize() const;
|
|
||||||
void setGeometry(const QRect &geometry);
|
|
||||||
|
|
||||||
bool isHorizontal() const;
|
|
||||||
|
|
||||||
void invalidate();
|
|
||||||
|
|
||||||
int lineCount() const;
|
|
||||||
void setLineCount(int value);
|
|
||||||
|
|
||||||
int lineSize() const;
|
|
||||||
void setLineSize(int value);
|
|
||||||
|
|
||||||
ILXQtPanel::Position position() const { return mPosition; }
|
|
||||||
void setPosition(ILXQtPanel::Position value);
|
|
||||||
|
|
||||||
static bool itemIsSeparate(QLayoutItem *item);
|
|
||||||
signals:
|
|
||||||
void pluginMoved(Plugin * plugin);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void startMovePlugin();
|
|
||||||
void finishMovePlugin();
|
|
||||||
void moveUpPlugin(Plugin * plugin);
|
|
||||||
void addPlugin(Plugin * plugin);
|
|
||||||
|
|
||||||
private:
|
|
||||||
mutable QSize mMinPluginSize;
|
|
||||||
LayoutItemGrid *mLeftGrid;
|
|
||||||
LayoutItemGrid *mRightGrid;
|
|
||||||
ILXQtPanel::Position mPosition;
|
|
||||||
bool mAnimate;
|
|
||||||
|
|
||||||
|
|
||||||
void setGeometryHoriz(const QRect &geometry);
|
|
||||||
void setGeometryVert(const QRect &geometry);
|
|
||||||
void globalIndexToLocal(int index, LayoutItemGrid **grid, int *gridIndex);
|
|
||||||
void globalIndexToLocal(int index, LayoutItemGrid **grid, int *gridIndex) const;
|
|
||||||
|
|
||||||
void setItemGeometry(QLayoutItem *item, const QRect &geometry, bool withAnimation);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LXQTPANELLAYOUT_H
|
|
@ -1,47 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Luís Pereira <luis.artur.pereira@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef LXQTPANELLIMITS_H
|
|
||||||
#define LXQTPANELLIMITS_H
|
|
||||||
|
|
||||||
#define PANEL_DEFAULT_SIZE 32
|
|
||||||
#define PANEL_MINIMUM_SIZE 16
|
|
||||||
#define PANEL_MAXIMUM_SIZE 200
|
|
||||||
#define PANEL_HIDE_SIZE 4
|
|
||||||
|
|
||||||
#define PANEL_DEFAULT_ICON_SIZE 22
|
|
||||||
#define PANEL_DEFAULT_LINE_COUNT 1
|
|
||||||
|
|
||||||
#define PANEL_DEFAULT_BACKGROUND_COLOR "#CCCCCC"
|
|
||||||
|
|
||||||
#define PANEL_HIDE_DELAY 500
|
|
||||||
#define PANEL_HIDE_FIRST_TIME (5000 - PANEL_HIDE_DELAY)
|
|
||||||
|
|
||||||
#define PANEL_SHOW_DELAY 0
|
|
||||||
|
|
||||||
#define SETTINGS_SAVE_DELAY 3000
|
|
||||||
#endif // LXQTPANELLIMITS_H
|
|
@ -1,93 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "lxqtpanelpluginconfigdialog.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <QButtonGroup>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QDebug>
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
LXQtPanelPluginConfigDialog::LXQtPanelPluginConfigDialog(PluginSettings &settings, QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
mSettings(settings)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
LXQtPanelPluginConfigDialog::~LXQtPanelPluginConfigDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
PluginSettings& LXQtPanelPluginConfigDialog::settings() const
|
|
||||||
{
|
|
||||||
return mSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void LXQtPanelPluginConfigDialog::dialogButtonsAction(QAbstractButton *btn)
|
|
||||||
{
|
|
||||||
QDialogButtonBox *box = qobject_cast<QDialogButtonBox*>(btn->parent());
|
|
||||||
|
|
||||||
if (box && box->buttonRole(btn) == QDialogButtonBox::ResetRole)
|
|
||||||
{
|
|
||||||
mSettings.loadFromCache();
|
|
||||||
loadSettings();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void LXQtPanelPluginConfigDialog::setComboboxIndexByData(QComboBox *comboBox, const QVariant &data, int defaultIndex) const
|
|
||||||
{
|
|
||||||
int index = comboBox ->findData(data);
|
|
||||||
if (index < 0)
|
|
||||||
index = defaultIndex;
|
|
||||||
|
|
||||||
comboBox->setCurrentIndex(index);
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LXQTPANELPLUGINCONFIGDIALOG_H
|
|
||||||
#define LXQTPANELPLUGINCONFIGDIALOG_H
|
|
||||||
|
|
||||||
#include <QAbstractButton>
|
|
||||||
#include <QDialog>
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
#include "pluginsettings.h"
|
|
||||||
|
|
||||||
class QComboBox;
|
|
||||||
|
|
||||||
class LXQT_PANEL_API LXQtPanelPluginConfigDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit LXQtPanelPluginConfigDialog(PluginSettings &settings, QWidget *parent = nullptr);
|
|
||||||
explicit LXQtPanelPluginConfigDialog(PluginSettings *settings, QWidget *parent = nullptr) : LXQtPanelPluginConfigDialog(*settings, parent) {}
|
|
||||||
virtual ~LXQtPanelPluginConfigDialog();
|
|
||||||
|
|
||||||
PluginSettings &settings() const;
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
/*
|
|
||||||
Saves settings in conf file.
|
|
||||||
*/
|
|
||||||
virtual void loadSettings() = 0;
|
|
||||||
virtual void dialogButtonsAction(QAbstractButton *btn);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void setComboboxIndexByData(QComboBox *comboBox, const QVariant &data, int defaultIndex = 0) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
PluginSettings &mSettings;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LXQTPANELPLUGINCONFIGDIALOG_H
|
|
@ -1,43 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2011 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "lxqtpanelapplication.h"
|
|
||||||
|
|
||||||
/*! The lxqt-panel is the panel of LXDE-Qt.
|
|
||||||
Usage: lxqt-panel [CONFIG_ID]
|
|
||||||
CONFIG_ID Section name in config file ~/.config/lxqt-panel/panel.conf
|
|
||||||
(default main)
|
|
||||||
*/
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
LXQtPanelApplication app(argc, argv);
|
|
||||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
|
||||||
|
|
||||||
return app.exec();
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
.TH lxqt-panel "1" "2015-11-05" "LXQt 0.10.0" "LXQt Desktop Panel Module"
|
|
||||||
.SH NAME
|
|
||||||
lxqt-panel \- Desktop panel for \fBLXQt\fR: The Lightweight Qt Desktop Environment
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B lxqt-panel
|
|
||||||
.br
|
|
||||||
.SH DESCRIPTION
|
|
||||||
This module adds a panel, with optional plugins, to the desktop.
|
|
||||||
.SH BEHAVIOR
|
|
||||||
The panel can be run independently of \fBLXQt\fR, autostarted at logon, and have
|
|
||||||
multiple instances. A horizontal bottom panel shows by default on the desktop,
|
|
||||||
but the alignment, size, autohide, transparency (requires compositor), and other
|
|
||||||
attributes are user configurable.
|
|
||||||
.P
|
|
||||||
The panel is comprised of plugins which provide a visual widget; like the menu,
|
|
||||||
clock, or volume. They can be added or removed in the panel Widget settings.
|
|
||||||
.P
|
|
||||||
Several plugins are loaded by default; the desktop menu and windows workspaces
|
|
||||||
are also managed here.
|
|
||||||
.SH CONFIGURATIONS
|
|
||||||
Right-click over any plugin to reach the panel Configure settings option, or
|
|
||||||
that of each respective plugin.
|
|
||||||
.SH "REPORTING BUGS"
|
|
||||||
Report bugs to https://github.com/LXDE/LXQt/issues
|
|
||||||
.SH "SEE ALSO"
|
|
||||||
.\" any module must refer to the session application, for module overview and initiation
|
|
||||||
\fBstartlxqt.1\fR LXQt session initialization and launch script (e.g. in \fB.xinitrc\fR)
|
|
||||||
.P
|
|
||||||
\fBlxqt-session.1\fR LXQt \fIoverview\fR and complete session environment
|
|
||||||
.P
|
|
||||||
\fBlxqt-config-session.1\fR LXQt default and autostart applications settings,
|
|
||||||
plus environment settings
|
|
||||||
.P
|
|
||||||
\fBlxqt-config.1\fR LXQt settings Configuration Center interface
|
|
||||||
.P
|
|
@ -1,378 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#include "panelpluginsmodel.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "ilxqtpanelplugin.h"
|
|
||||||
#include "lxqtpanel.h"
|
|
||||||
#include "lxqtpanelapplication.h"
|
|
||||||
#include <QPointer>
|
|
||||||
#include <XdgIcon>
|
|
||||||
#include <LXQt/Settings>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
PanelPluginsModel::PanelPluginsModel(LXQtPanel * panel,
|
|
||||||
QString const & namesKey,
|
|
||||||
QStringList const & desktopDirs,
|
|
||||||
QObject * parent/* = nullptr*/)
|
|
||||||
: QAbstractListModel{parent},
|
|
||||||
mNamesKey(namesKey),
|
|
||||||
mPanel(panel)
|
|
||||||
{
|
|
||||||
loadPlugins(desktopDirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
PanelPluginsModel::~PanelPluginsModel()
|
|
||||||
{
|
|
||||||
qDeleteAll(plugins());
|
|
||||||
}
|
|
||||||
|
|
||||||
int PanelPluginsModel::rowCount(const QModelIndex & parent/* = QModelIndex()*/) const
|
|
||||||
{
|
|
||||||
return QModelIndex() == parent ? mPlugins.size() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QVariant PanelPluginsModel::data(const QModelIndex & index, int role/* = Qt::DisplayRole*/) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(QModelIndex() == index.parent()
|
|
||||||
&& 0 == index.column()
|
|
||||||
&& mPlugins.size() > index.row()
|
|
||||||
);
|
|
||||||
|
|
||||||
pluginslist_t::const_reference plugin = mPlugins[index.row()];
|
|
||||||
QVariant ret;
|
|
||||||
switch (role)
|
|
||||||
{
|
|
||||||
case Qt::DisplayRole:
|
|
||||||
if (plugin.second.isNull())
|
|
||||||
ret = QString("<b>Unknown</b> (%1)").arg(plugin.first);
|
|
||||||
else
|
|
||||||
ret = QString("<b>%1</b> (%2)").arg(plugin.second->name(), plugin.first);
|
|
||||||
break;
|
|
||||||
case Qt::DecorationRole:
|
|
||||||
if (plugin.second.isNull())
|
|
||||||
ret = XdgIcon::fromTheme("preferences-plugin");
|
|
||||||
else
|
|
||||||
ret = plugin.second->desktopFile().icon(XdgIcon::fromTheme("preferences-plugin"));
|
|
||||||
break;
|
|
||||||
case Qt::UserRole:
|
|
||||||
ret = QVariant::fromValue(const_cast<Plugin const *>(plugin.second.data()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::ItemFlags PanelPluginsModel::flags(const QModelIndex & index) const
|
|
||||||
{
|
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemNeverHasChildren;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList PanelPluginsModel::pluginNames() const
|
|
||||||
{
|
|
||||||
QStringList names;
|
|
||||||
for (auto const & p : mPlugins)
|
|
||||||
names.append(p.first);
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Plugin *> PanelPluginsModel::plugins() const
|
|
||||||
{
|
|
||||||
QList<Plugin *> plugins;
|
|
||||||
for (auto const & p : mPlugins)
|
|
||||||
if (!p.second.isNull())
|
|
||||||
plugins.append(p.second.data());
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
Plugin* PanelPluginsModel::pluginByName(QString name) const
|
|
||||||
{
|
|
||||||
for (auto const & p : mPlugins)
|
|
||||||
if (p.first == name)
|
|
||||||
return p.second.data();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Plugin const * PanelPluginsModel::pluginByID(QString id) const
|
|
||||||
{
|
|
||||||
for (auto const & p : mPlugins)
|
|
||||||
{
|
|
||||||
Plugin *plugin = p.second.data();
|
|
||||||
if (plugin && plugin->desktopFile().id() == id)
|
|
||||||
return plugin;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::addPlugin(const LXQt::PluginInfo &desktopFile)
|
|
||||||
{
|
|
||||||
if (dynamic_cast<LXQtPanelApplication const *>(qApp)->isPluginSingletonAndRunnig(desktopFile.id()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString name = findNewPluginSettingsGroup(desktopFile.id());
|
|
||||||
|
|
||||||
QPointer<Plugin> plugin = loadPlugin(desktopFile, name);
|
|
||||||
if (plugin.isNull())
|
|
||||||
return;
|
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), mPlugins.size(), mPlugins.size());
|
|
||||||
mPlugins.append({name, plugin});
|
|
||||||
endInsertRows();
|
|
||||||
mPanel->settings()->setValue(mNamesKey, pluginNames());
|
|
||||||
emit pluginAdded(plugin.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::removePlugin(pluginslist_t::iterator plugin)
|
|
||||||
{
|
|
||||||
if (mPlugins.end() != plugin)
|
|
||||||
{
|
|
||||||
mPanel->settings()->remove(plugin->first);
|
|
||||||
Plugin * p = plugin->second.data();
|
|
||||||
const int row = plugin - mPlugins.begin();
|
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
|
||||||
mPlugins.erase(plugin);
|
|
||||||
endRemoveRows();
|
|
||||||
emit pluginRemoved(p); // p can be nullptr
|
|
||||||
mPanel->settings()->setValue(mNamesKey, pluginNames());
|
|
||||||
if (nullptr != p)
|
|
||||||
p->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::removePlugin()
|
|
||||||
{
|
|
||||||
Plugin * p = qobject_cast<Plugin*>(sender());
|
|
||||||
auto plugin = std::find_if(mPlugins.begin(), mPlugins.end(),
|
|
||||||
[p] (pluginslist_t::const_reference obj) { return p == obj.second; });
|
|
||||||
removePlugin(std::move(plugin));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::movePlugin(Plugin * plugin, QString const & nameAfter)
|
|
||||||
{
|
|
||||||
//merge list of plugins (try to preserve original position)
|
|
||||||
//subtract mPlugin.begin() from the found Plugins to get the model index
|
|
||||||
const int from =
|
|
||||||
std::find_if(mPlugins.begin(), mPlugins.end(), [plugin] (pluginslist_t::const_reference obj) { return plugin == obj.second.data(); })
|
|
||||||
- mPlugins.begin();
|
|
||||||
const int to =
|
|
||||||
std::find_if(mPlugins.begin(), mPlugins.end(), [nameAfter] (pluginslist_t::const_reference obj) { return nameAfter == obj.first; })
|
|
||||||
- mPlugins.begin();
|
|
||||||
/* 'from' is the current position of the Plugin to be moved ("moved Plugin"),
|
|
||||||
* 'to' is the position of the Plugin behind the one that is being moved
|
|
||||||
* ("behind Plugin"). There are several cases to distinguish:
|
|
||||||
* 1. from > to: The moved Plugin had been behind the behind Plugin before
|
|
||||||
* and is moved to the front of the behind Plugin. The moved Plugin will
|
|
||||||
* be inserted at position 'to', the behind Plugin and all the following
|
|
||||||
* Plugins (until the former position of the moved Plugin) will increment
|
|
||||||
* their indexes.
|
|
||||||
* 2. from < to: The moved Plugin had already been located before the
|
|
||||||
* behind Plugin. In this case, the move operation only reorders the
|
|
||||||
* Plugins before the behind Plugin. All the Plugins between the moved
|
|
||||||
* Plugin and the behind Plugin will decrement their index. Therefore, the
|
|
||||||
* movedPlugin will not be at position 'to' but rather on position 'to-1'.
|
|
||||||
* 3. from == to: This does not make sense, we catch this case to prevent
|
|
||||||
* errors.
|
|
||||||
* 4. from == to-1: The moved Plugin has not moved because it had already
|
|
||||||
* been located in front of the behind Plugin.
|
|
||||||
*/
|
|
||||||
const int to_plugins = from < to ? to - 1 : to;
|
|
||||||
|
|
||||||
if (from != to && from != to_plugins)
|
|
||||||
{
|
|
||||||
/* Although the new position of the moved Plugin will be 'to-1' if
|
|
||||||
* from < to, we insert 'to' here. This is exactly how it is done
|
|
||||||
* in the Qt documentation.
|
|
||||||
*/
|
|
||||||
beginMoveRows(QModelIndex(), from, from, QModelIndex(), to);
|
|
||||||
// For the QList::move method, use the right position
|
|
||||||
mPlugins.move(from, to_plugins);
|
|
||||||
endMoveRows();
|
|
||||||
emit pluginMoved(plugin);
|
|
||||||
mPanel->settings()->setValue(mNamesKey, pluginNames());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::loadPlugins(QStringList const & desktopDirs)
|
|
||||||
{
|
|
||||||
QStringList plugin_names = mPanel->settings()->value(mNamesKey).toStringList();
|
|
||||||
|
|
||||||
#ifdef DEBUG_PLUGIN_LOADTIME
|
|
||||||
QElapsedTimer timer;
|
|
||||||
timer.start();
|
|
||||||
qint64 lastTime = 0;
|
|
||||||
#endif
|
|
||||||
for (auto const & name : plugin_names)
|
|
||||||
{
|
|
||||||
pluginslist_t::iterator i = mPlugins.insert(mPlugins.end(), {name, nullptr});
|
|
||||||
QString type = mPanel->settings()->value(name + "/type").toString();
|
|
||||||
if (type.isEmpty())
|
|
||||||
{
|
|
||||||
qWarning() << QString("Section \"%1\" not found in %2.").arg(name, mPanel->settings()->fileName());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#ifdef WITH_SCREENSAVER_FALLBACK
|
|
||||||
if (QStringLiteral("screensaver") == type)
|
|
||||||
{
|
|
||||||
//plugin-screensaver was dropped
|
|
||||||
//convert settings to plugin-quicklaunch
|
|
||||||
const QString & lock_desktop = QStringLiteral(LXQT_LOCK_DESKTOP);
|
|
||||||
qWarning().noquote() << "Found deprecated plugin of type 'screensaver', migrating to 'quicklaunch' with '" << lock_desktop << '\'';
|
|
||||||
type = QStringLiteral("quicklaunch");
|
|
||||||
LXQt::Settings * settings = mPanel->settings();
|
|
||||||
settings->beginGroup(name);
|
|
||||||
settings->remove(QString{});//remove all existing keys
|
|
||||||
settings->setValue(QStringLiteral("type"), type);
|
|
||||||
settings->beginWriteArray(QStringLiteral("apps"), 1);
|
|
||||||
settings->setArrayIndex(0);
|
|
||||||
settings->setValue(QStringLiteral("desktop"), lock_desktop);
|
|
||||||
settings->endArray();
|
|
||||||
settings->endGroup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LXQt::PluginInfoList list = LXQt::PluginInfo::search(desktopDirs, "LXQtPanel/Plugin", QString("%1.desktop").arg(type));
|
|
||||||
if( !list.count())
|
|
||||||
{
|
|
||||||
qWarning() << QString("Plugin \"%1\" not found.").arg(type);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
i->second = loadPlugin(list.first(), name);
|
|
||||||
#ifdef DEBUG_PLUGIN_LOADTIME
|
|
||||||
qDebug() << "load plugin" << type << "takes" << (timer.elapsed() - lastTime) << "ms";
|
|
||||||
lastTime = timer.elapsed();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QPointer<Plugin> PanelPluginsModel::loadPlugin(LXQt::PluginInfo const & desktopFile, QString const & settingsGroup)
|
|
||||||
{
|
|
||||||
std::unique_ptr<Plugin> plugin(new Plugin(desktopFile, mPanel->settings(), settingsGroup, mPanel));
|
|
||||||
if (plugin->isLoaded())
|
|
||||||
{
|
|
||||||
connect(mPanel, &LXQtPanel::realigned, plugin.get(), &Plugin::realign);
|
|
||||||
connect(plugin.get(), &Plugin::remove,
|
|
||||||
this, static_cast<void (PanelPluginsModel::*)()>(&PanelPluginsModel::removePlugin));
|
|
||||||
return plugin.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PanelPluginsModel::findNewPluginSettingsGroup(const QString &pluginType) const
|
|
||||||
{
|
|
||||||
QStringList groups = mPanel->settings()->childGroups();
|
|
||||||
groups.sort();
|
|
||||||
|
|
||||||
// Generate new section name
|
|
||||||
QString pluginName = QString("%1").arg(pluginType);
|
|
||||||
|
|
||||||
if (!groups.contains(pluginName))
|
|
||||||
return pluginName;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 2; true; ++i)
|
|
||||||
{
|
|
||||||
pluginName = QString("%1%2").arg(pluginType).arg(i);
|
|
||||||
if (!groups.contains(pluginName))
|
|
||||||
return pluginName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PanelPluginsModel::isIndexValid(QModelIndex const & index) const
|
|
||||||
{
|
|
||||||
return index.isValid() && QModelIndex() == index.parent()
|
|
||||||
&& 0 == index.column() && mPlugins.size() > index.row();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::onMovePluginUp(QModelIndex const & index)
|
|
||||||
{
|
|
||||||
if (!isIndexValid(index))
|
|
||||||
return;
|
|
||||||
|
|
||||||
const int row = index.row();
|
|
||||||
if (0 >= row)
|
|
||||||
return; //can't move up
|
|
||||||
|
|
||||||
beginMoveRows(QModelIndex(), row, row, QModelIndex(), row - 1);
|
|
||||||
mPlugins.swap(row - 1, row);
|
|
||||||
endMoveRows();
|
|
||||||
pluginslist_t::const_reference moved_plugin = mPlugins[row - 1];
|
|
||||||
pluginslist_t::const_reference prev_plugin = mPlugins[row];
|
|
||||||
|
|
||||||
emit pluginMoved(moved_plugin.second.data());
|
|
||||||
//emit signal for layout only in case both plugins are loaded/displayed
|
|
||||||
if (!moved_plugin.second.isNull() && !prev_plugin.second.isNull())
|
|
||||||
emit pluginMovedUp(moved_plugin.second.data());
|
|
||||||
|
|
||||||
mPanel->settings()->setValue(mNamesKey, pluginNames());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::onMovePluginDown(QModelIndex const & index)
|
|
||||||
{
|
|
||||||
if (!isIndexValid(index))
|
|
||||||
return;
|
|
||||||
|
|
||||||
const int row = index.row();
|
|
||||||
if (mPlugins.size() <= row + 1)
|
|
||||||
return; //can't move down
|
|
||||||
|
|
||||||
beginMoveRows(QModelIndex(), row, row, QModelIndex(), row + 2);
|
|
||||||
mPlugins.swap(row, row + 1);
|
|
||||||
endMoveRows();
|
|
||||||
pluginslist_t::const_reference moved_plugin = mPlugins[row + 1];
|
|
||||||
pluginslist_t::const_reference next_plugin = mPlugins[row];
|
|
||||||
|
|
||||||
emit pluginMoved(moved_plugin.second.data());
|
|
||||||
//emit signal for layout only in case both plugins are loaded/displayed
|
|
||||||
if (!moved_plugin.second.isNull() && !next_plugin.second.isNull())
|
|
||||||
emit pluginMovedUp(next_plugin.second.data());
|
|
||||||
|
|
||||||
mPanel->settings()->setValue(mNamesKey, pluginNames());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::onConfigurePlugin(QModelIndex const & index)
|
|
||||||
{
|
|
||||||
if (!isIndexValid(index))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Plugin * const plugin = mPlugins[index.row()].second.data();
|
|
||||||
if (nullptr != plugin && (ILXQtPanelPlugin::HaveConfigDialog & plugin->iPlugin()->flags()))
|
|
||||||
plugin->showConfigureDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelPluginsModel::onRemovePlugin(QModelIndex const & index)
|
|
||||||
{
|
|
||||||
if (!isIndexValid(index))
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto plugin = mPlugins.begin() + index.row();
|
|
||||||
if (plugin->second.isNull())
|
|
||||||
removePlugin(std::move(plugin));
|
|
||||||
else
|
|
||||||
plugin->second->requestRemove();
|
|
||||||
}
|
|
@ -1,341 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef PANELPLUGINSMODEL_H
|
|
||||||
#define PANELPLUGINSMODEL_H
|
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace LXQt
|
|
||||||
{
|
|
||||||
class PluginInfo;
|
|
||||||
struct PluginData;
|
|
||||||
}
|
|
||||||
|
|
||||||
class LXQtPanel;
|
|
||||||
class Plugin;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The PanelPluginsModel class implements the Model part of the
|
|
||||||
* Qt Model/View architecture for the Plugins, i.e. it is the interface
|
|
||||||
* to access the Plugin data associated with this Panel. The
|
|
||||||
* PanelPluginsModel takes care for read-access as well as changes
|
|
||||||
* like adding, removing or moving Plugins.
|
|
||||||
*/
|
|
||||||
class PanelPluginsModel : public QAbstractListModel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
PanelPluginsModel(LXQtPanel * panel,
|
|
||||||
QString const & namesKey,
|
|
||||||
QStringList const & desktopDirs,
|
|
||||||
QObject * parent = nullptr);
|
|
||||||
~PanelPluginsModel();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief rowCount returns the number of Plugins. It overrides/implements
|
|
||||||
* QAbstractListModel::rowCount().
|
|
||||||
* \param parent The parameter parent should be omitted to get the number of
|
|
||||||
* Plugins. If it is given and a valid model index, the method returns 0
|
|
||||||
* because PanelPluginsModel is not a hierarchical model.
|
|
||||||
*/
|
|
||||||
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const override;
|
|
||||||
/*!
|
|
||||||
* \brief data returns the Plugin data as defined by the Model/View
|
|
||||||
* architecture. The Plugins itself can be accessed with the role
|
|
||||||
* Qt::UserRole but they can also be accessed by the methods plugins(),
|
|
||||||
* pluginByName() and pluginByID(). This method overrides/implements
|
|
||||||
* QAbstractListModel::data().
|
|
||||||
* \param index should be a valid model index to determine the Plugin
|
|
||||||
* that should be read.
|
|
||||||
* \param role The Qt::ItemDataRole to determine what kind of data should
|
|
||||||
* be read, can be one of the following:
|
|
||||||
* 1. Qt::DisplayRole to return a string that describes the Plugin.
|
|
||||||
* 2. Qt::DecorationRole to return an icon for the Plugin.
|
|
||||||
* 3. Qt::UserRole to return a Plugin*.
|
|
||||||
* \return The data as determined by index and role.
|
|
||||||
*/
|
|
||||||
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
|
|
||||||
/*!
|
|
||||||
* \brief flags returns the item flags for the given model index. For
|
|
||||||
* all Plugins, this is the same:
|
|
||||||
* Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemNeverHasChildren.
|
|
||||||
*/
|
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex & index) const override;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief pluginNames returns a list of names for all the Plugins in
|
|
||||||
* this panel. The names are not the human-readable names but the names
|
|
||||||
* that are used to identify the Plugins, e.g. in the config files. These
|
|
||||||
* names can be used in the method pluginByName() to get a corresponding
|
|
||||||
* Plugin.
|
|
||||||
*
|
|
||||||
* The plugin names are normally chosen to be equal to the
|
|
||||||
* filename of the corresponding *.desktop-file. If multiple instances
|
|
||||||
* of a single plugin-type are created, their names are created by
|
|
||||||
* appending increasing numbers, e.g. 'mainmenu' and 'mainmenu2'.
|
|
||||||
*
|
|
||||||
* \sa findNewPluginSettingsGroup
|
|
||||||
*/
|
|
||||||
QStringList pluginNames() const;
|
|
||||||
/*!
|
|
||||||
* \brief plugins returns a list of Plugins in this panel.
|
|
||||||
*/
|
|
||||||
QList<Plugin *> plugins() const;
|
|
||||||
/*!
|
|
||||||
* \brief pluginByName gets a Plugin by its name.
|
|
||||||
* \param name is the name of the plugin as it is used in the
|
|
||||||
* config files. A list of names can be retrieved with the
|
|
||||||
* method pluginNames().
|
|
||||||
* \return the Plugin with the given name.
|
|
||||||
*
|
|
||||||
* \sa pluginNames
|
|
||||||
*/
|
|
||||||
Plugin *pluginByName(QString name) const;
|
|
||||||
/*!
|
|
||||||
* \brief pluginByID gets a Plugin by its ID.
|
|
||||||
* \param id is the *.desktop-file-ID of the plugin which in turn is the
|
|
||||||
* QFileInfo::completeBaseName() of the desktop-file, e.g. "mainmenu".
|
|
||||||
*
|
|
||||||
* As these IDs are chosen according to the corresponding
|
|
||||||
* desktop-file, these IDs are not unique. If multiple
|
|
||||||
* instances of a single plugin-type are created, they share
|
|
||||||
* the same ID in this sense. Then, this method will return
|
|
||||||
* the first plugin of the given type.
|
|
||||||
* \return the first Plugin found with the given ID.
|
|
||||||
*/
|
|
||||||
Plugin const *pluginByID(QString id) const;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief movePlugin moves a Plugin in the underlying data.
|
|
||||||
*
|
|
||||||
* This method is useful whenever a Plugin should be moved several
|
|
||||||
* positions at once. If a Plugin should only be moved one position
|
|
||||||
* up or down, consider using onMovePluginUp or onMovePluginDown.
|
|
||||||
*
|
|
||||||
* \param plugin Plugin that has been moved
|
|
||||||
* \param nameAfter name of the Plugin that should be located after
|
|
||||||
* the moved Plugin after the move operation, so this parameter
|
|
||||||
* determines the new position of plugin. If an empty string is
|
|
||||||
* given, plugin will be moved to the end of the list.
|
|
||||||
*
|
|
||||||
* \note This method is especially useful for drag and drop reordering.
|
|
||||||
* Therefore, it will be called whenever the user moves a Plugin in
|
|
||||||
* the panel ("Move Plugin" in the context menu of the panel).
|
|
||||||
*
|
|
||||||
* \sa onMovePluginUp, onMovePluginDown
|
|
||||||
*/
|
|
||||||
void movePlugin(Plugin * plugin, QString const & nameAfter);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
/*!
|
|
||||||
* \brief pluginAdded gets emitted whenever a new Plugin is added
|
|
||||||
* to the panel.
|
|
||||||
*/
|
|
||||||
void pluginAdded(Plugin * plugin);
|
|
||||||
/*!
|
|
||||||
* \brief pluginRemoved gets emitted whenever a Plugin is removed.
|
|
||||||
* \param plugin The Plugin that was removed. This could be a nullptr.
|
|
||||||
*/
|
|
||||||
void pluginRemoved(Plugin * plugin);
|
|
||||||
/*!
|
|
||||||
* \brief pluginMoved gets emitted whenever a Plugin is moved.
|
|
||||||
*
|
|
||||||
* This signal gets emitted in movePlugin, onMovePluginUp and
|
|
||||||
* onMovePluginDown.
|
|
||||||
*
|
|
||||||
* \param plugin The Plugin that was moved. This could be a nullptr.
|
|
||||||
*
|
|
||||||
* \sa pluginMovedUp
|
|
||||||
*/
|
|
||||||
void pluginMoved(Plugin * plugin); //plugin can be nullptr in case of move of not loaded plugin
|
|
||||||
/*!
|
|
||||||
* \brief pluginMovedUp gets emitted whenever a Plugin is moved a single
|
|
||||||
* slot upwards.
|
|
||||||
*
|
|
||||||
* When a Plugin is moved a single slot upwards, this signal will be
|
|
||||||
* emitted additionally to the pluginMoved signal so that two signals
|
|
||||||
* get emitted.
|
|
||||||
*
|
|
||||||
* If a Plugin is moved downwards, that Plugin will swap places with
|
|
||||||
* the following Plugin so that the result equals moving the following
|
|
||||||
* Plugin a single slot upwards. So, whenever two adjacent Plugins
|
|
||||||
* swap their places, this signal gets emitted with the Plugin that
|
|
||||||
* moves upwards as parameter.
|
|
||||||
*
|
|
||||||
* For simplified use, only this signal is implemented. There is no
|
|
||||||
* similar pluginMovedDown-signal.
|
|
||||||
*
|
|
||||||
* This signal gets emitted from onMovePluginUp and onMovePluginDown.
|
|
||||||
*
|
|
||||||
* \param plugin The Plugin that moved a slot upwards.
|
|
||||||
*
|
|
||||||
* \sa pluginMoved
|
|
||||||
*/
|
|
||||||
void pluginMovedUp(Plugin * plugin);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/*!
|
|
||||||
* \brief addPlugin Adds a new Plugin to the model.
|
|
||||||
*
|
|
||||||
* \param desktopFile The PluginInfo (which inherits XdgDesktopFile)
|
|
||||||
* for the Plugin that should be added.
|
|
||||||
*
|
|
||||||
* \note AddPluginDialog::pluginSelected is connected to this slot.
|
|
||||||
*/
|
|
||||||
void addPlugin(const LXQt::PluginInfo &desktopFile);
|
|
||||||
/*!
|
|
||||||
* \brief removePlugin Removes a Plugin from the model.
|
|
||||||
*
|
|
||||||
* The Plugin to remove is identified by the QObject::sender() method
|
|
||||||
* when the slot is called. Therefore, this method should only be called
|
|
||||||
* by connecting a signal that a Plugin will emit to this slot.
|
|
||||||
* Otherwise, nothing will happen.
|
|
||||||
*
|
|
||||||
* \note Plugin::remove is connected to this slot as soon as the
|
|
||||||
* Plugin is loaded in the PanelPluginsModel.
|
|
||||||
*/
|
|
||||||
void removePlugin();
|
|
||||||
|
|
||||||
// slots for configuration dialog
|
|
||||||
/*!
|
|
||||||
* \brief onMovePluginUp Moves the Plugin corresponding to the given
|
|
||||||
* model index a slot upwards.
|
|
||||||
*
|
|
||||||
* \note The 'Up' button in the configuration widget is connected to this
|
|
||||||
* slot.
|
|
||||||
*/
|
|
||||||
void onMovePluginUp(QModelIndex const & index);
|
|
||||||
/*!
|
|
||||||
* \brief onMovePluginDown Moves the Plugin corresponding to the given
|
|
||||||
* model index a slot downwards.
|
|
||||||
*
|
|
||||||
* \note The 'Down' button in the configuration widget is connected to this
|
|
||||||
* slot.
|
|
||||||
*/
|
|
||||||
void onMovePluginDown(QModelIndex const & index);
|
|
||||||
/*!
|
|
||||||
* \brief onConfigurePlugin If the Plugin corresponding to the given
|
|
||||||
* model index has a config dialog (checked via the flag
|
|
||||||
* ILXQtPanelPlugin::HaveConfigDialog), this method shows
|
|
||||||
* it by calling plugin->showConfigureDialog().
|
|
||||||
*
|
|
||||||
* \note The 'Configure' button in the configuration widget is connected to
|
|
||||||
* this slot.
|
|
||||||
*/
|
|
||||||
void onConfigurePlugin(QModelIndex const & index);
|
|
||||||
/*!
|
|
||||||
* \brief onRemovePlugin Removes the Plugin corresponding to the given
|
|
||||||
* model index from the Model.
|
|
||||||
*
|
|
||||||
* \note The 'Remove' button in the configuration widget is connected to
|
|
||||||
* this slot.
|
|
||||||
*/
|
|
||||||
void onRemovePlugin(QModelIndex const & index);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/*!
|
|
||||||
* \brief pluginslist_t is the data type used for mPlugins which stores
|
|
||||||
* all the Plugins.
|
|
||||||
*
|
|
||||||
* \sa mPlugins
|
|
||||||
*/
|
|
||||||
typedef QList<QPair <QString/*name*/, QPointer<Plugin> > > pluginslist_t;
|
|
||||||
|
|
||||||
private:
|
|
||||||
/*!
|
|
||||||
* \brief loadPlugins Loads all the Plugins.
|
|
||||||
* \param desktopDirs These directories are scanned for corresponding
|
|
||||||
* .desktop-files which are necessary to load the plugins.
|
|
||||||
*/
|
|
||||||
void loadPlugins(QStringList const & desktopDirs);
|
|
||||||
/*!
|
|
||||||
* \brief loadPlugin Loads a Plugin and connects signals and slots.
|
|
||||||
* \param desktopFile The desktop file that specifies how to load the
|
|
||||||
* Plugin.
|
|
||||||
* \param settingsGroup QString which specifies the settings group. This
|
|
||||||
* will only be redirected to the Plugin so that it knows how to read
|
|
||||||
* its settings.
|
|
||||||
* \return A QPointer to the Plugin that was loaded.
|
|
||||||
*/
|
|
||||||
QPointer<Plugin> loadPlugin(LXQt::PluginInfo const & desktopFile, QString const & settingsGroup);
|
|
||||||
/*!
|
|
||||||
* \brief findNewPluginSettingsGroup Creates a name for a new Plugin
|
|
||||||
* that is not yet present in the settings file. Whenever multiple
|
|
||||||
* instances of a single Plugin type are created, they have to be
|
|
||||||
* distinguished by this name.
|
|
||||||
*
|
|
||||||
* The first Plugin of a given type will be named like the type, e.g.
|
|
||||||
* "mainmenu". If a name is already present, this method tries to
|
|
||||||
* find a free name by appending increasing integers (starting with 2),
|
|
||||||
* e.g. "mainmenu2". If, for example, only "mainmenu2" exists because
|
|
||||||
* "mainmenu" was deleted, "mainmenu" would be returned. So, the method
|
|
||||||
* always finds the first suitable name that is not yet present in the
|
|
||||||
* settings file.
|
|
||||||
* \param pluginType Type of the Plugin.
|
|
||||||
* \return The created name for the Plugin.
|
|
||||||
*/
|
|
||||||
QString findNewPluginSettingsGroup(const QString &pluginType) const;
|
|
||||||
/*!
|
|
||||||
* \brief isIndexValid Checks if a given model index is valid for the
|
|
||||||
* underlying data (column 0, row lower than number of Plugins and
|
|
||||||
* so on).
|
|
||||||
*/
|
|
||||||
bool isIndexValid(QModelIndex const & index) const;
|
|
||||||
/*!
|
|
||||||
* \brief removePlugin Removes a given Plugin from the model.
|
|
||||||
*/
|
|
||||||
void removePlugin(pluginslist_t::iterator plugin);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief mNamesKey The key to the settings-entry that stores the
|
|
||||||
* names of the Plugins in a panel. Set upon creation, passed as
|
|
||||||
* a parameter by the panel.
|
|
||||||
*/
|
|
||||||
const QString mNamesKey;
|
|
||||||
/*!
|
|
||||||
* \brief mPlugins Stores all the Plugins.
|
|
||||||
*
|
|
||||||
* mPlugins is a QList of elements while each element corresponds to a
|
|
||||||
* single Plugin. Each element is a QPair of a QString and a QPointer
|
|
||||||
* while the QPointer points to a Plugin.
|
|
||||||
*
|
|
||||||
* To access the elements, you can use indexing or an iterator on the
|
|
||||||
* list. For each element p, p.first is the name of the Plugin as it
|
|
||||||
* is used in the configuration files, p.second.data() is the Plugin.
|
|
||||||
*
|
|
||||||
* \sa pluginslist_t
|
|
||||||
*/
|
|
||||||
pluginslist_t mPlugins;
|
|
||||||
/*!
|
|
||||||
* \brief mPanel Stores a reference to the LXQtPanel.
|
|
||||||
*/
|
|
||||||
LXQtPanel * mPanel;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Plugin const *)
|
|
||||||
|
|
||||||
#endif // PANELPLUGINSMODEL_H
|
|
@ -1,517 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "ilxqtpanelplugin.h"
|
|
||||||
#include "pluginsettings_p.h"
|
|
||||||
#include "lxqtpanel.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QPluginLoader>
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QEvent>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QWindow>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <LXQt/Settings>
|
|
||||||
#include <LXQt/Translator>
|
|
||||||
#include <XdgIcon>
|
|
||||||
|
|
||||||
// statically linked built-in plugins
|
|
||||||
#include "../plugin-clock/lxqtclock.h" // clock
|
|
||||||
extern void * loadPluginTranslation_clock_helper;
|
|
||||||
#include "../plugin-desktopswitch/desktopswitch.h" // desktopswitch
|
|
||||||
extern void * loadPluginTranslation_desktopswitch_helper;
|
|
||||||
#include "../plugin-mainmenu/lxqtmainmenu.h" // mainmenu
|
|
||||||
extern void * loadPluginTranslation_mainmenu_helper;
|
|
||||||
#include "../plugin-quicklaunch/lxqtquicklaunchplugin.h" // quicklaunch
|
|
||||||
extern void * loadPluginTranslation_quicklaunch_helper;
|
|
||||||
#include "../plugin-showdesktop/showdesktop.h" // showdesktop
|
|
||||||
extern void * loadPluginTranslation_showdesktop_helper;
|
|
||||||
#include "../plugin-spacer/spacer.h" // spacer
|
|
||||||
extern void * loadPluginTranslation_spacer_helper;
|
|
||||||
#include "../plugin-statusnotifier/statusnotifier.h" // statusnotifier
|
|
||||||
extern void * loadPluginTranslation_statusnotifier_helper;
|
|
||||||
#include "../plugin-taskbar/lxqttaskbarplugin.h" // taskbar
|
|
||||||
extern void * loadPluginTranslation_taskbar_helper;
|
|
||||||
#include "../plugin-tray/lxqttrayplugin.h" // tray
|
|
||||||
extern void * loadPluginTranslation_tray_helper;
|
|
||||||
#include "../plugin-worldclock/lxqtworldclock.h" // worldclock
|
|
||||||
extern void * loadPluginTranslation_worldclock_helper;
|
|
||||||
|
|
||||||
QColor Plugin::mMoveMarkerColor= QColor(255, 0, 0, 255);
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
Plugin::Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, const QString &settingsGroup, LXQtPanel *panel) :
|
|
||||||
QFrame(panel),
|
|
||||||
mDesktopFile(desktopFile),
|
|
||||||
mPluginLoader(0),
|
|
||||||
mPlugin(0),
|
|
||||||
mPluginWidget(0),
|
|
||||||
mAlignment(AlignLeft),
|
|
||||||
mPanel(panel)
|
|
||||||
{
|
|
||||||
mSettings = PluginSettingsFactory::create(settings, settingsGroup);
|
|
||||||
|
|
||||||
setWindowTitle(desktopFile.name());
|
|
||||||
mName = desktopFile.name();
|
|
||||||
|
|
||||||
QStringList dirs;
|
|
||||||
dirs << QProcessEnvironment::systemEnvironment().value("LXQTPANEL_PLUGIN_PATH").split(":");
|
|
||||||
dirs << PLUGIN_DIR;
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
if(ILXQtPanelPluginLibrary const * pluginLib = findStaticPlugin(desktopFile.id()))
|
|
||||||
{
|
|
||||||
// this is a static plugin
|
|
||||||
found = true;
|
|
||||||
loadLib(pluginLib);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// this plugin is a dynamically loadable module
|
|
||||||
QString baseName = QString("lib%1.so").arg(desktopFile.id());
|
|
||||||
foreach(const QString &dirName, dirs)
|
|
||||||
{
|
|
||||||
QFileInfo fi(QDir(dirName), baseName);
|
|
||||||
if (fi.exists())
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
if (loadModule(fi.absoluteFilePath()))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoaded())
|
|
||||||
{
|
|
||||||
if (!found)
|
|
||||||
qWarning() << QString("Plugin %1 not found in the").arg(desktopFile.id()) << dirs;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setObjectName(mPlugin->themeId() + "Plugin");
|
|
||||||
|
|
||||||
// plugin handle for easy context menu
|
|
||||||
setProperty("NeedsHandle", mPlugin->flags().testFlag(ILXQtPanelPlugin::NeedsHandle));
|
|
||||||
|
|
||||||
QString s = mSettings->value("alignment").toString();
|
|
||||||
|
|
||||||
// Retrun default value
|
|
||||||
if (s.isEmpty())
|
|
||||||
{
|
|
||||||
mAlignment = (mPlugin->flags().testFlag(ILXQtPanelPlugin::PreferRightAlignment)) ?
|
|
||||||
Plugin::AlignRight :
|
|
||||||
Plugin::AlignLeft;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mAlignment = (s.toUpper() == "RIGHT") ?
|
|
||||||
Plugin::AlignRight :
|
|
||||||
Plugin::AlignLeft;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPluginWidget)
|
|
||||||
{
|
|
||||||
QGridLayout* layout = new QGridLayout(this);
|
|
||||||
layout->setSpacing(0);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
setLayout(layout);
|
|
||||||
layout->addWidget(mPluginWidget, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
saveSettings();
|
|
||||||
|
|
||||||
// delay the connection to settingsChanged to avoid conflicts
|
|
||||||
// while the plugin is still being initialized
|
|
||||||
connect(mSettings, &PluginSettings::settingsChanged,
|
|
||||||
this, &Plugin::settingsChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
Plugin::~Plugin()
|
|
||||||
{
|
|
||||||
delete mPlugin;
|
|
||||||
delete mPluginLoader;
|
|
||||||
delete mSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Plugin::setAlignment(Plugin::Alignment alignment)
|
|
||||||
{
|
|
||||||
mAlignment = alignment;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
//helper types for static plugins storage & binary search
|
|
||||||
typedef std::unique_ptr<ILXQtPanelPluginLibrary> plugin_ptr_t;
|
|
||||||
typedef std::tuple<QString, plugin_ptr_t, void *> plugin_tuple_t;
|
|
||||||
|
|
||||||
//NOTE: Please keep the plugins sorted by name while adding new plugins.
|
|
||||||
//NOTE2: we need to reference some (dummy) symbol from (autogenerated) LXQtPluginTranslationLoader.cpp
|
|
||||||
// to be not stripped (as unused/unreferenced) in static linking time
|
|
||||||
static plugin_tuple_t const static_plugins[] = {
|
|
||||||
#if defined(WITH_CLOCK_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("clock"), plugin_ptr_t{new LXQtClockPluginLibrary}, loadPluginTranslation_clock_helper),// clock
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_DESKTOPSWITCH_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("desktopswitch"), plugin_ptr_t{new DesktopSwitchPluginLibrary}, loadPluginTranslation_desktopswitch_helper),// desktopswitch
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_MAINMENU_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("mainmenu"), plugin_ptr_t{new LXQtMainMenuPluginLibrary}, loadPluginTranslation_mainmenu_helper),// mainmenu
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_QUICKLAUNCH_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("quicklaunch"), plugin_ptr_t{new LXQtQuickLaunchPluginLibrary}, loadPluginTranslation_quicklaunch_helper),// quicklaunch
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_SHOWDESKTOP_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("showdesktop"), plugin_ptr_t{new ShowDesktopLibrary}, loadPluginTranslation_showdesktop_helper),// showdesktop
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_SPACER_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("spacer"), plugin_ptr_t{new SpacerPluginLibrary}, loadPluginTranslation_spacer_helper),// spacer
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_STATUSNOTIFIER_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("statusnotifier"), plugin_ptr_t{new StatusNotifierLibrary}, loadPluginTranslation_statusnotifier_helper),// statusnotifier
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_TASKBAR_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("taskbar"), plugin_ptr_t{new LXQtTaskBarPluginLibrary}, loadPluginTranslation_taskbar_helper),// taskbar
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_TRAY_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("tray"), plugin_ptr_t{new LXQtTrayPluginLibrary}, loadPluginTranslation_tray_helper),// tray
|
|
||||||
#endif
|
|
||||||
#if defined(WITH_WORLDCLOCK_PLUGIN)
|
|
||||||
std::make_tuple(QLatin1String("worldclock"), plugin_ptr_t{new LXQtWorldClockLibrary}, loadPluginTranslation_worldclock_helper),// worldclock
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
static constexpr plugin_tuple_t const * const plugins_begin = static_plugins;
|
|
||||||
static constexpr plugin_tuple_t const * const plugins_end = static_plugins + sizeof (static_plugins) / sizeof (static_plugins[0]);
|
|
||||||
|
|
||||||
struct assert_helper
|
|
||||||
{
|
|
||||||
assert_helper()
|
|
||||||
{
|
|
||||||
Q_ASSERT(std::is_sorted(plugins_begin, plugins_end
|
|
||||||
, [] (plugin_tuple_t const & p1, plugin_tuple_t const & p2) -> bool { return std::get<0>(p1) < std::get<0>(p2); }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
static assert_helper h;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILXQtPanelPluginLibrary const * Plugin::findStaticPlugin(const QString &libraryName)
|
|
||||||
{
|
|
||||||
// find a static plugin library by name -> binary search
|
|
||||||
plugin_tuple_t const * plugin = std::lower_bound(plugins_begin, plugins_end, libraryName
|
|
||||||
, [] (plugin_tuple_t const & plugin, QString const & name) -> bool { return std::get<0>(plugin) < name; });
|
|
||||||
if (plugins_end != plugin && libraryName == std::get<0>(*plugin))
|
|
||||||
return std::get<1>(*plugin).get();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load a plugin from a library
|
|
||||||
bool Plugin::loadLib(ILXQtPanelPluginLibrary const * pluginLib)
|
|
||||||
{
|
|
||||||
ILXQtPanelPluginStartupInfo startupInfo;
|
|
||||||
startupInfo.settings = mSettings;
|
|
||||||
startupInfo.desktopFile = &mDesktopFile;
|
|
||||||
startupInfo.lxqtPanel = mPanel;
|
|
||||||
|
|
||||||
mPlugin = pluginLib->instance(startupInfo);
|
|
||||||
if (!mPlugin)
|
|
||||||
{
|
|
||||||
qWarning() << QString("Can't load plugin \"%1\". Plugin can't build ILXQtPanelPlugin.").arg(mDesktopFile.id());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPluginWidget = mPlugin->widget();
|
|
||||||
if (mPluginWidget)
|
|
||||||
{
|
|
||||||
mPluginWidget->setObjectName(mPlugin->themeId());
|
|
||||||
watchWidgets(mPluginWidget);
|
|
||||||
}
|
|
||||||
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load dynamic plugin from a *.so module
|
|
||||||
bool Plugin::loadModule(const QString &libraryName)
|
|
||||||
{
|
|
||||||
mPluginLoader = new QPluginLoader(libraryName);
|
|
||||||
|
|
||||||
if (!mPluginLoader->load())
|
|
||||||
{
|
|
||||||
qWarning() << mPluginLoader->errorString();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject *obj = mPluginLoader->instance();
|
|
||||||
if (!obj)
|
|
||||||
{
|
|
||||||
qWarning() << mPluginLoader->errorString();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILXQtPanelPluginLibrary* pluginLib= qobject_cast<ILXQtPanelPluginLibrary*>(obj);
|
|
||||||
if (!pluginLib)
|
|
||||||
{
|
|
||||||
qWarning() << QString("Can't load plugin \"%1\". Plugin is not a ILXQtPanelPluginLibrary.").arg(mPluginLoader->fileName());
|
|
||||||
delete obj;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return loadLib(pluginLib);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::watchWidgets(QObject * const widget)
|
|
||||||
{
|
|
||||||
// the QWidget might not be fully constructed yet, but we can rely on the isWidgetType()
|
|
||||||
if (!widget->isWidgetType())
|
|
||||||
return;
|
|
||||||
widget->installEventFilter(this);
|
|
||||||
// watch also children (recursive)
|
|
||||||
for (auto const & child : widget->children())
|
|
||||||
{
|
|
||||||
watchWidgets(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::unwatchWidgets(QObject * const widget)
|
|
||||||
{
|
|
||||||
widget->removeEventFilter(this);
|
|
||||||
// unwatch also children (recursive)
|
|
||||||
for (auto const & child : widget->children())
|
|
||||||
{
|
|
||||||
unwatchWidgets(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::settingsChanged()
|
|
||||||
{
|
|
||||||
mPlugin->settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::saveSettings()
|
|
||||||
{
|
|
||||||
mSettings->setValue("alignment", (mAlignment == AlignLeft) ? "Left" : "Right");
|
|
||||||
mSettings->setValue("type", mDesktopFile.id());
|
|
||||||
mSettings->sync();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::contextMenuEvent(QContextMenuEvent *event)
|
|
||||||
{
|
|
||||||
mPanel->showPopupMenu(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
switch (event->button())
|
|
||||||
{
|
|
||||||
case Qt::LeftButton:
|
|
||||||
mPlugin->activated(ILXQtPanelPlugin::Trigger);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qt::MidButton:
|
|
||||||
mPlugin->activated(ILXQtPanelPlugin::MiddleClick);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::mouseDoubleClickEvent(QMouseEvent*)
|
|
||||||
{
|
|
||||||
mPlugin->activated(ILXQtPanelPlugin::DoubleClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::showEvent(QShowEvent *)
|
|
||||||
{
|
|
||||||
if (mPluginWidget)
|
|
||||||
mPluginWidget->adjustSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
QMenu *Plugin::popupMenu() const
|
|
||||||
{
|
|
||||||
QString name = this->name().replace("&", "&&");
|
|
||||||
QMenu* menu = new QMenu(windowTitle());
|
|
||||||
|
|
||||||
if (mPlugin->flags().testFlag(ILXQtPanelPlugin::HaveConfigDialog))
|
|
||||||
{
|
|
||||||
QAction* configAction = new QAction(
|
|
||||||
XdgIcon::fromTheme(QLatin1String("preferences-other")),
|
|
||||||
tr("Configure \"%1\"").arg(name), menu);
|
|
||||||
menu->addAction(configAction);
|
|
||||||
connect(configAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction* moveAction = new QAction(XdgIcon::fromTheme("transform-move"), tr("Move \"%1\"").arg(name), menu);
|
|
||||||
menu->addAction(moveAction);
|
|
||||||
connect(moveAction, SIGNAL(triggered()), this, SIGNAL(startMove()));
|
|
||||||
|
|
||||||
menu->addSeparator();
|
|
||||||
|
|
||||||
QAction* removeAction = new QAction(
|
|
||||||
XdgIcon::fromTheme(QLatin1String("list-remove")),
|
|
||||||
tr("Remove \"%1\"").arg(name), menu);
|
|
||||||
menu->addAction(removeAction);
|
|
||||||
connect(removeAction, SIGNAL(triggered()), this, SLOT(requestRemove()));
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
bool Plugin::isSeparate() const
|
|
||||||
{
|
|
||||||
return mPlugin->isSeparate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
bool Plugin::isExpandable() const
|
|
||||||
{
|
|
||||||
return mPlugin->isExpandable();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
bool Plugin::eventFilter(QObject * watched, QEvent * event)
|
|
||||||
{
|
|
||||||
switch (event->type())
|
|
||||||
{
|
|
||||||
case QEvent::DragLeave:
|
|
||||||
emit dragLeft();
|
|
||||||
break;
|
|
||||||
case QEvent::ChildAdded:
|
|
||||||
watchWidgets(dynamic_cast<QChildEvent *>(event)->child());
|
|
||||||
break;
|
|
||||||
case QEvent::ChildRemoved:
|
|
||||||
unwatchWidgets(dynamic_cast<QChildEvent *>(event)->child());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::realign()
|
|
||||||
{
|
|
||||||
if (mPlugin)
|
|
||||||
mPlugin->realign();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::showConfigureDialog()
|
|
||||||
{
|
|
||||||
if (!mConfigDialog)
|
|
||||||
mConfigDialog = mPlugin->configureDialog();
|
|
||||||
|
|
||||||
if (!mConfigDialog)
|
|
||||||
return;
|
|
||||||
|
|
||||||
connect(this, &Plugin::destroyed, mConfigDialog.data(), &QWidget::close);
|
|
||||||
mPanel->willShowWindow(mConfigDialog);
|
|
||||||
mConfigDialog->show();
|
|
||||||
mConfigDialog->raise();
|
|
||||||
mConfigDialog->activateWindow();
|
|
||||||
|
|
||||||
WId wid = mConfigDialog->windowHandle()->winId();
|
|
||||||
KWindowSystem::activateWindow(wid);
|
|
||||||
KWindowSystem::setOnDesktop(wid, KWindowSystem::currentDesktop());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void Plugin::requestRemove()
|
|
||||||
{
|
|
||||||
emit remove();
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
@ -1,134 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLUGIN_H
|
|
||||||
#define PLUGIN_H
|
|
||||||
|
|
||||||
#include <QFrame>
|
|
||||||
#include <QString>
|
|
||||||
#include <QPointer>
|
|
||||||
#include <LXQt/PluginInfo>
|
|
||||||
#include <LXQt/Settings>
|
|
||||||
#include "ilxqtpanel.h"
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
#include "pluginsettings.h"
|
|
||||||
|
|
||||||
class QPluginLoader;
|
|
||||||
class QSettings;
|
|
||||||
class ILXQtPanelPlugin;
|
|
||||||
class ILXQtPanelPluginLibrary;
|
|
||||||
class LXQtPanel;
|
|
||||||
class QMenu;
|
|
||||||
|
|
||||||
|
|
||||||
class LXQT_PANEL_API Plugin : public QFrame
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
Q_PROPERTY(QColor moveMarkerColor READ moveMarkerColor WRITE setMoveMarkerColor)
|
|
||||||
public:
|
|
||||||
enum Alignment {
|
|
||||||
AlignLeft,
|
|
||||||
AlignRight
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
explicit Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, const QString &settingsGroup, LXQtPanel *panel);
|
|
||||||
~Plugin();
|
|
||||||
|
|
||||||
bool isLoaded() const { return mPlugin != 0; }
|
|
||||||
Alignment alignment() const { return mAlignment; }
|
|
||||||
void setAlignment(Alignment alignment);
|
|
||||||
|
|
||||||
QString settingsGroup() const { return mSettings->group(); }
|
|
||||||
|
|
||||||
void saveSettings();
|
|
||||||
|
|
||||||
QMenu* popupMenu() const;
|
|
||||||
const ILXQtPanelPlugin * iPlugin() const { return mPlugin; }
|
|
||||||
|
|
||||||
const LXQt::PluginInfo desktopFile() const { return mDesktopFile; }
|
|
||||||
|
|
||||||
bool isSeparate() const;
|
|
||||||
bool isExpandable() const;
|
|
||||||
|
|
||||||
QWidget *widget() { return mPluginWidget; }
|
|
||||||
|
|
||||||
QString name() const { return mName; }
|
|
||||||
|
|
||||||
virtual bool eventFilter(QObject * watched, QEvent * event);
|
|
||||||
|
|
||||||
// For QSS properties ..................
|
|
||||||
static QColor moveMarkerColor() { return mMoveMarkerColor; }
|
|
||||||
static void setMoveMarkerColor(QColor color) { mMoveMarkerColor = color; }
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void realign();
|
|
||||||
void showConfigureDialog();
|
|
||||||
void requestRemove();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void startMove();
|
|
||||||
void remove();
|
|
||||||
/*!
|
|
||||||
* \brief Signal emitted when this widget or some of its children
|
|
||||||
* get the DragLeave event delivered.
|
|
||||||
*/
|
|
||||||
void dragLeft();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void contextMenuEvent(QContextMenuEvent *event);
|
|
||||||
void mousePressEvent(QMouseEvent *event);
|
|
||||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
|
||||||
void showEvent(QShowEvent *event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool loadLib(ILXQtPanelPluginLibrary const * pluginLib);
|
|
||||||
bool loadModule(const QString &libraryName);
|
|
||||||
ILXQtPanelPluginLibrary const * findStaticPlugin(const QString &libraryName);
|
|
||||||
void watchWidgets(QObject * const widget);
|
|
||||||
void unwatchWidgets(QObject * const widget);
|
|
||||||
|
|
||||||
const LXQt::PluginInfo mDesktopFile;
|
|
||||||
QPluginLoader *mPluginLoader;
|
|
||||||
ILXQtPanelPlugin *mPlugin;
|
|
||||||
QWidget *mPluginWidget;
|
|
||||||
Alignment mAlignment;
|
|
||||||
PluginSettings *mSettings;
|
|
||||||
LXQtPanel *mPanel;
|
|
||||||
static QColor mMoveMarkerColor;
|
|
||||||
QString mName;
|
|
||||||
QPointer<QDialog> mConfigDialog; //!< plugin's config dialog (if any)
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void settingsChanged();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // PLUGIN_H
|
|
@ -1,314 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "pluginmoveprocessor.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "lxqtpanellayout.h"
|
|
||||||
#include <QMouseEvent>
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
PluginMoveProcessor::PluginMoveProcessor(LXQtPanelLayout *layout, Plugin *plugin):
|
|
||||||
QWidget(plugin),
|
|
||||||
mLayout(layout),
|
|
||||||
mPlugin(plugin)
|
|
||||||
{
|
|
||||||
mDestIndex = mLayout->indexOf(plugin);
|
|
||||||
|
|
||||||
grabKeyboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
PluginMoveProcessor::~PluginMoveProcessor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::start()
|
|
||||||
{
|
|
||||||
// We have not memoryleaks there.
|
|
||||||
// The animation will be automatically deleted when stopped.
|
|
||||||
CursorAnimation *cursorAnimation = new CursorAnimation();
|
|
||||||
connect(cursorAnimation, SIGNAL(finished()), this, SLOT(doStart()));
|
|
||||||
cursorAnimation->setEasingCurve(QEasingCurve::InOutQuad);
|
|
||||||
cursorAnimation->setDuration(150);
|
|
||||||
|
|
||||||
cursorAnimation->setStartValue(QCursor::pos());
|
|
||||||
cursorAnimation->setEndValue(mPlugin->mapToGlobal(mPlugin->rect().center()));
|
|
||||||
cursorAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::doStart()
|
|
||||||
{
|
|
||||||
setMouseTracking(true);
|
|
||||||
show(); // Only visible widgets can grab mouse input.
|
|
||||||
grabMouse(mLayout->isHorizontal() ? Qt::SizeHorCursor : Qt::SizeVerCursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::mouseMoveEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
QPoint mouse = mLayout->parentWidget()->mapFromGlobal(event->globalPos());
|
|
||||||
|
|
||||||
MousePosInfo pos = itemByMousePos(mouse);
|
|
||||||
|
|
||||||
QLayoutItem *prevItem = 0;
|
|
||||||
QLayoutItem *nextItem = 0;
|
|
||||||
if (pos.after)
|
|
||||||
{
|
|
||||||
mDestIndex = pos.index + 1;
|
|
||||||
prevItem = pos.item;
|
|
||||||
nextItem = mLayout->itemAt(pos.index + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
prevItem = mLayout->itemAt(pos.index - 1);
|
|
||||||
nextItem = pos.item;
|
|
||||||
mDestIndex = pos.index;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool plugSep = mPlugin->isSeparate();
|
|
||||||
bool prevSep = LXQtPanelLayout::itemIsSeparate(prevItem);
|
|
||||||
bool nextSep = LXQtPanelLayout::itemIsSeparate(nextItem);
|
|
||||||
|
|
||||||
if (!nextItem)
|
|
||||||
{
|
|
||||||
if (mLayout->isHorizontal())
|
|
||||||
drawMark(prevItem, prevSep ? RightMark : BottomMark);
|
|
||||||
else
|
|
||||||
drawMark(prevItem, prevSep ? BottomMark : RightMark);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mLayout->lineCount() == 1)
|
|
||||||
{
|
|
||||||
if (mLayout->isHorizontal())
|
|
||||||
drawMark(nextItem, LeftMark);
|
|
||||||
else
|
|
||||||
drawMark(nextItem, TopMark);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!prevItem)
|
|
||||||
{
|
|
||||||
if (mLayout->isHorizontal())
|
|
||||||
drawMark(nextItem, nextSep ? LeftMark : TopMark);
|
|
||||||
else
|
|
||||||
drawMark(nextItem, nextSep ? TopMark : LeftMark);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We prefer to draw line at the top/left of next item.
|
|
||||||
// But if next item and moved plugin have different types (separate an not) and
|
|
||||||
// previous item hase same type as moved plugin we draw line at the end of previous one.
|
|
||||||
if (plugSep != nextSep && plugSep == prevSep)
|
|
||||||
{
|
|
||||||
if (mLayout->isHorizontal())
|
|
||||||
drawMark(prevItem, prevSep ? RightMark : BottomMark);
|
|
||||||
else
|
|
||||||
drawMark(prevItem, prevSep ? BottomMark : RightMark);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mLayout->isHorizontal())
|
|
||||||
drawMark(nextItem, nextSep ? LeftMark : TopMark);
|
|
||||||
else
|
|
||||||
drawMark(nextItem, nextSep ? TopMark : LeftMark);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
PluginMoveProcessor::MousePosInfo PluginMoveProcessor::itemByMousePos(const QPoint mouse) const
|
|
||||||
{
|
|
||||||
MousePosInfo ret;
|
|
||||||
|
|
||||||
for (int i = mLayout->count()-1; i > -1; --i)
|
|
||||||
{
|
|
||||||
QLayoutItem *item = mLayout->itemAt(i);
|
|
||||||
QRect itemRect = item->geometry();
|
|
||||||
if (mouse.x() > itemRect.left() &&
|
|
||||||
mouse.y() > itemRect.top())
|
|
||||||
{
|
|
||||||
|
|
||||||
ret.index = i;
|
|
||||||
ret.item = item;
|
|
||||||
if (mLayout->isHorizontal())
|
|
||||||
{
|
|
||||||
ret.after = LXQtPanelLayout::itemIsSeparate(item) ?
|
|
||||||
mouse.x() > itemRect.center().x() :
|
|
||||||
mouse.y() > itemRect.center().y() ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret.after = LXQtPanelLayout::itemIsSeparate(item) ?
|
|
||||||
mouse.y() > itemRect.center().y() :
|
|
||||||
mouse.x() > itemRect.center().x() ;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.index = 0;
|
|
||||||
ret.item = mLayout->itemAt(0);
|
|
||||||
ret.after = false;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::drawMark(QLayoutItem *item, MarkType markType)
|
|
||||||
{
|
|
||||||
QWidget *widget = (item) ? item->widget() : 0;
|
|
||||||
|
|
||||||
static QWidget *prevWidget = 0;
|
|
||||||
if (prevWidget && prevWidget != widget)
|
|
||||||
prevWidget->setStyleSheet("");
|
|
||||||
|
|
||||||
prevWidget = widget;
|
|
||||||
|
|
||||||
if (!widget)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString border1;
|
|
||||||
QString border2;
|
|
||||||
switch(markType)
|
|
||||||
{
|
|
||||||
case TopMark:
|
|
||||||
border1 = "top";
|
|
||||||
border2 = "bottom";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BottomMark:
|
|
||||||
border1 = "bottom";
|
|
||||||
border2 = "top";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LeftMark:
|
|
||||||
border1 = "left";
|
|
||||||
border2 = "right";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RightMark:
|
|
||||||
border1 = "right";
|
|
||||||
border2 = "left";
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
widget->setStyleSheet(QString("#%1 {"
|
|
||||||
"border-%2: 2px solid rgba(%4, %5, %6, %7); "
|
|
||||||
"border-%3: -2px solid; "
|
|
||||||
"background-color: transparent; }")
|
|
||||||
.arg(widget->objectName())
|
|
||||||
.arg(border1)
|
|
||||||
.arg(border2)
|
|
||||||
.arg(Plugin::moveMarkerColor().red())
|
|
||||||
.arg(Plugin::moveMarkerColor().green())
|
|
||||||
.arg(Plugin::moveMarkerColor().blue())
|
|
||||||
.arg(Plugin::moveMarkerColor().alpha())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::mouseReleaseEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
event->accept();
|
|
||||||
releaseMouse();
|
|
||||||
setMouseTracking(false);
|
|
||||||
doFinish(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::keyPressEvent(QKeyEvent *event)
|
|
||||||
{
|
|
||||||
if (event->key() == Qt::Key_Escape) {
|
|
||||||
doFinish(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QWidget::keyPressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PluginMoveProcessor::doFinish(bool cancel)
|
|
||||||
{
|
|
||||||
releaseKeyboard();
|
|
||||||
|
|
||||||
drawMark(0, TopMark);
|
|
||||||
|
|
||||||
if (!cancel)
|
|
||||||
{
|
|
||||||
int currentIdx = mLayout->indexOf(mPlugin);
|
|
||||||
if (currentIdx == mDestIndex)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (mDestIndex > currentIdx)
|
|
||||||
mDestIndex--;
|
|
||||||
|
|
||||||
mLayout->moveItem(currentIdx, mDestIndex, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit finished();
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLUGINMOVEPROCESSOR_H
|
|
||||||
#define PLUGINMOVEPROCESSOR_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QVariantAnimation>
|
|
||||||
#include <QEvent>
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
class LXQtPanelLayout;
|
|
||||||
class QLayoutItem;
|
|
||||||
|
|
||||||
|
|
||||||
class LXQT_PANEL_API PluginMoveProcessor : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit PluginMoveProcessor(LXQtPanelLayout *layout, Plugin *plugin);
|
|
||||||
~PluginMoveProcessor();
|
|
||||||
|
|
||||||
Plugin *plugin() const { return mPlugin; }
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void finished();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void start();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
|
||||||
void mousePressEvent(QMouseEvent *event);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
|
||||||
void keyPressEvent(QKeyEvent *event);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void doStart();
|
|
||||||
void doFinish(bool cancel);
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum MarkType
|
|
||||||
{
|
|
||||||
TopMark,
|
|
||||||
BottomMark,
|
|
||||||
LeftMark,
|
|
||||||
RightMark
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MousePosInfo
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
QLayoutItem *item;
|
|
||||||
bool after;
|
|
||||||
};
|
|
||||||
|
|
||||||
LXQtPanelLayout *mLayout;
|
|
||||||
Plugin *mPlugin;
|
|
||||||
int mDestIndex;
|
|
||||||
|
|
||||||
MousePosInfo itemByMousePos(const QPoint mouse) const;
|
|
||||||
void drawMark(QLayoutItem *item, MarkType markType);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LXQT_PANEL_API CursorAnimation: public QVariantAnimation
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
void updateCurrentValue(const QVariant &value) { QCursor::setPos(value.toPoint()); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // PLUGINMOVEPROCESSOR_H
|
|
@ -1,216 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
* Authors:
|
|
||||||
* Paulo Lieuthier <paulolieuthier@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#include "pluginsettings.h"
|
|
||||||
#include "pluginsettings_p.h"
|
|
||||||
#include <LXQt/Settings>
|
|
||||||
|
|
||||||
class PluginSettingsPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PluginSettingsPrivate(LXQt::Settings* settings, const QString &group)
|
|
||||||
: mSettings(settings)
|
|
||||||
, mOldSettings(settings)
|
|
||||||
, mGroup(group)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString prefix() const;
|
|
||||||
inline QString fullPrefix() const
|
|
||||||
{
|
|
||||||
return mGroup + "/" + prefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
LXQt::Settings *mSettings;
|
|
||||||
LXQt::SettingsCache mOldSettings;
|
|
||||||
QString mGroup;
|
|
||||||
QStringList mSubGroups;
|
|
||||||
};
|
|
||||||
|
|
||||||
QString PluginSettingsPrivate::prefix() const
|
|
||||||
{
|
|
||||||
if (!mSubGroups.empty())
|
|
||||||
return mSubGroups.join('/');
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginSettings::PluginSettings(LXQt::Settings* settings, const QString &group, QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, d_ptr(new PluginSettingsPrivate{settings, group})
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
connect(d->mSettings, &LXQt::Settings::settingsChangedFromExternal, this, &PluginSettings::settingsChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PluginSettings::group() const
|
|
||||||
{
|
|
||||||
Q_D(const PluginSettings);
|
|
||||||
return d->mGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginSettings::~PluginSettings()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant PluginSettings::value(const QString &key, const QVariant &defaultValue) const
|
|
||||||
{
|
|
||||||
Q_D(const PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
QVariant value = d->mSettings->value(key, defaultValue);
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::setValue(const QString &key, const QVariant &value)
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
d->mSettings->setValue(key, value);
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
emit settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::remove(const QString &key)
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
d->mSettings->remove(key);
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
emit settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PluginSettings::contains(const QString &key) const
|
|
||||||
{
|
|
||||||
Q_D(const PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
bool ret = d->mSettings->contains(key);
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QMap<QString, QVariant> > PluginSettings::readArray(const QString& prefix)
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
QList<QMap<QString, QVariant> > array;
|
|
||||||
int size = d->mSettings->beginReadArray(prefix);
|
|
||||||
for (int i = 0; i < size; ++i)
|
|
||||||
{
|
|
||||||
d->mSettings->setArrayIndex(i);
|
|
||||||
QMap<QString, QVariant> hash;
|
|
||||||
for (const QString &key : d->mSettings->childKeys())
|
|
||||||
hash[key] = d->mSettings->value(key);
|
|
||||||
array << hash;
|
|
||||||
}
|
|
||||||
d->mSettings->endArray();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::setArray(const QString &prefix, const QList<QMap<QString, QVariant> > &hashList)
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
d->mSettings->beginWriteArray(prefix);
|
|
||||||
int size = hashList.size();
|
|
||||||
for (int i = 0; i < size; ++i)
|
|
||||||
{
|
|
||||||
d->mSettings->setArrayIndex(i);
|
|
||||||
QMapIterator<QString, QVariant> it(hashList.at(i));
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
it.next();
|
|
||||||
d->mSettings->setValue(it.key(), it.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
d->mSettings->endArray();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
emit settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::clear()
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->mGroup);
|
|
||||||
d->mSettings->clear();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
emit settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::sync()
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->mGroup);
|
|
||||||
d->mSettings->sync();
|
|
||||||
d->mOldSettings.loadFromSettings();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
emit settingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList PluginSettings::allKeys() const
|
|
||||||
{
|
|
||||||
Q_D(const PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
QStringList keys = d->mSettings->allKeys();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList PluginSettings::childGroups() const
|
|
||||||
{
|
|
||||||
Q_D(const PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->fullPrefix());
|
|
||||||
QStringList groups = d->mSettings->childGroups();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::beginGroup(const QString &subGroup)
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSubGroups.append(subGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::endGroup()
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
if (!d->mSubGroups.empty())
|
|
||||||
d->mSubGroups.removeLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginSettings::loadFromCache()
|
|
||||||
{
|
|
||||||
Q_D(PluginSettings);
|
|
||||||
d->mSettings->beginGroup(d->mGroup);
|
|
||||||
d->mOldSettings.loadToSettings();
|
|
||||||
d->mSettings->endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginSettings* PluginSettingsFactory::create(LXQt::Settings *settings, const QString &group, QObject *parent/* = nullptr*/)
|
|
||||||
{
|
|
||||||
return new PluginSettings{settings, group, parent};
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
* Authors:
|
|
||||||
* Paulo Lieuthier <paulolieuthier@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef PLUGIN_SETTINGS_H
|
|
||||||
#define PLUGIN_SETTINGS_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
#include <QVariant>
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
namespace LXQt
|
|
||||||
{
|
|
||||||
class Settings;
|
|
||||||
}
|
|
||||||
class PluginSettingsFactory;
|
|
||||||
class PluginSettingsPrivate;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
* Settings for particular plugin. This object/class can be used similarly as \sa QSettings.
|
|
||||||
* Object cannot be constructed direcly (it is the panel's responsibility to construct it for each plugin).
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* \note
|
|
||||||
* We are relying here on so called "back linking" (calling a function defined in executable
|
|
||||||
* back from an external library)...
|
|
||||||
*/
|
|
||||||
class LXQT_PANEL_API PluginSettings : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
//for instantiation
|
|
||||||
friend class PluginSettingsFactory;
|
|
||||||
|
|
||||||
public:
|
|
||||||
~PluginSettings();
|
|
||||||
|
|
||||||
QString group() const;
|
|
||||||
|
|
||||||
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
|
|
||||||
void setValue(const QString &key, const QVariant &value);
|
|
||||||
|
|
||||||
void remove(const QString &key);
|
|
||||||
bool contains(const QString &key) const;
|
|
||||||
|
|
||||||
QList<QMap<QString, QVariant> > readArray(const QString &prefix);
|
|
||||||
void setArray(const QString &prefix, const QList<QMap<QString, QVariant> > &hashList);
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
void sync();
|
|
||||||
|
|
||||||
QStringList allKeys() const;
|
|
||||||
QStringList childGroups() const;
|
|
||||||
|
|
||||||
void beginGroup(const QString &subGroup);
|
|
||||||
void endGroup();
|
|
||||||
|
|
||||||
void loadFromCache();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void settingsChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
explicit PluginSettings(LXQt::Settings *settings, const QString &group, QObject *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QScopedPointer<PluginSettingsPrivate> d_ptr;
|
|
||||||
Q_DECLARE_PRIVATE(PluginSettings)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXQt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://lxqt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2015 LXQt team
|
|
||||||
* Authors:
|
|
||||||
* Paulo Lieuthier <paulolieuthier@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
#ifndef PLUGIN_SETTINGS_P_H
|
|
||||||
#define PLUGIN_SETTINGS_P_H
|
|
||||||
|
|
||||||
#include "pluginsettings.h"
|
|
||||||
|
|
||||||
class PluginSettingsFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static PluginSettings * create(LXQt::Settings *settings, const QString &group, QObject *parent = nullptr);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //PLUGIN_SETTINGS_P_H
|
|
@ -1,123 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#include "popupmenu.h"
|
|
||||||
#include <QWidgetAction>
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <QEvent>
|
|
||||||
#include <QKeyEvent>
|
|
||||||
|
|
||||||
static const char POPUPMENU_TITLE[] = "POPUP_MENU_TITLE_OBJECT_NAME";
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
QAction* PopupMenu::addTitle(const QIcon &icon, const QString &text)
|
|
||||||
{
|
|
||||||
QAction *buttonAction = new QAction(this);
|
|
||||||
QFont font = buttonAction->font();
|
|
||||||
font.setBold(true);
|
|
||||||
buttonAction->setText(QString(text).replace("&", "&&"));
|
|
||||||
buttonAction->setFont(font);
|
|
||||||
buttonAction->setIcon(icon);
|
|
||||||
|
|
||||||
QWidgetAction *action = new QWidgetAction(this);
|
|
||||||
action->setObjectName(POPUPMENU_TITLE);
|
|
||||||
QToolButton *titleButton = new QToolButton(this);
|
|
||||||
titleButton->installEventFilter(this); // prevent clicks on the title of the menu
|
|
||||||
titleButton->setDefaultAction(buttonAction);
|
|
||||||
titleButton->setDown(true); // prevent hover style changes in some styles
|
|
||||||
titleButton->setCheckable(true);
|
|
||||||
titleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
|
||||||
action->setDefaultWidget(titleButton);
|
|
||||||
|
|
||||||
addAction(action);
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
QAction* PopupMenu::addTitle(const QString &text)
|
|
||||||
{
|
|
||||||
return addTitle(QIcon(), text);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
bool PopupMenu::eventFilter(QObject *object, QEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(object);
|
|
||||||
|
|
||||||
if (event->type() == QEvent::Paint ||
|
|
||||||
event->type() == QEvent::KeyPress ||
|
|
||||||
event->type() == QEvent::KeyRelease
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
event->accept();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
|
||||||
|
|
||||||
************************************************/
|
|
||||||
void PopupMenu::keyPressEvent(QKeyEvent* e)
|
|
||||||
{
|
|
||||||
if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)
|
|
||||||
{
|
|
||||||
QMenu::keyPressEvent(e);
|
|
||||||
|
|
||||||
QWidgetAction *action = qobject_cast<QWidgetAction*>(this->activeAction());
|
|
||||||
QWidgetAction *firstAction = action;
|
|
||||||
|
|
||||||
while (action && action->objectName() == POPUPMENU_TITLE)
|
|
||||||
{
|
|
||||||
this->keyPressEvent(e);
|
|
||||||
action = qobject_cast<QWidgetAction*>(this->activeAction());
|
|
||||||
|
|
||||||
if (firstAction == action) // we looped and only found titles
|
|
||||||
{
|
|
||||||
this->setActiveAction(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMenu::keyPressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
||||||
* (c)LGPL2+
|
|
||||||
*
|
|
||||||
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
||||||
* http://razor-qt.org
|
|
||||||
*
|
|
||||||
* Copyright: 2010-2012 Razor team
|
|
||||||
* Authors:
|
|
||||||
* Alexander Sokoloff <sokoloff.a@gmail.com>
|
|
||||||
*
|
|
||||||
* This program or library is free software; you can redistribute it
|
|
||||||
* and/or modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU Lesser General
|
|
||||||
* Public License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* END_COMMON_COPYRIGHT_HEADER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef POPUPMENU_H
|
|
||||||
#define POPUPMENU_H
|
|
||||||
|
|
||||||
#include <QMenu>
|
|
||||||
#include "lxqtpanelglobals.h"
|
|
||||||
|
|
||||||
class LXQT_PANEL_API PopupMenu: public QMenu
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit PopupMenu(QWidget *parent = 0): QMenu(parent) {}
|
|
||||||
explicit PopupMenu(const QString &title, QWidget *parent = 0): QMenu(title, parent) {}
|
|
||||||
|
|
||||||
QAction* addTitle(const QIcon &icon, const QString &text);
|
|
||||||
QAction* addTitle(const QString &text);
|
|
||||||
|
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void keyPressEvent(QKeyEvent* e);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // POPUPMENU_H
|
|
@ -1,40 +0,0 @@
|
|||||||
panels=panel1
|
|
||||||
|
|
||||||
[panel1]
|
|
||||||
plugins=mainmenu,desktopswitch,quicklaunch,taskbar,tray,statusnotifier,mount,volume,clock,showdesktop
|
|
||||||
position=Bottom
|
|
||||||
desktop=0
|
|
||||||
|
|
||||||
[mainmenu]
|
|
||||||
type=mainmenu
|
|
||||||
|
|
||||||
[desktopswitch]
|
|
||||||
type=desktopswitch
|
|
||||||
|
|
||||||
[quicklaunch]
|
|
||||||
type=quicklaunch
|
|
||||||
alignment=Left
|
|
||||||
|
|
||||||
[taskbar]
|
|
||||||
type=taskbar
|
|
||||||
|
|
||||||
[tray]
|
|
||||||
type=tray
|
|
||||||
|
|
||||||
[mount]
|
|
||||||
type=mount
|
|
||||||
|
|
||||||
[worldclock]
|
|
||||||
type=worldclock
|
|
||||||
|
|
||||||
[volume]
|
|
||||||
device=0
|
|
||||||
type=volume
|
|
||||||
|
|
||||||
[showdesktop]
|
|
||||||
alignment=Right
|
|
||||||
type=showdesktop
|
|
||||||
|
|
||||||
[statusnotifier]
|
|
||||||
alignment=Right
|
|
||||||
type=statusnotifier
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue