Cherry-picking upstream version 0.12.0.

This commit is contained in:
Alf Gaida 2017-12-05 19:29:46 +01:00
parent 605bba5c3e
commit afbcf828f3
164 changed files with 1304 additions and 350 deletions

View File

@ -4,7 +4,7 @@ Upstream Authors:
Copyright:
Copyright (c) 2010-2012 Razor team
Copyright (c) 2012-2016 LXQt team
Copyright (c) 2012-2017 LXQt team
License: LGPL-2.1+
The full text of the licenses can be found in the 'COPYING' file.

View File

@ -1,7 +1,93 @@
lxqt-panel-0.11.1 / 2017-01-01
lxqt-panel-0.12.0 / 2017-10-21
==============================
* Set patch version
* quicklaunch: Show popup menu aligned to clicked button
* quicklaunch: Add "Desktop Action" support
* l10n: Update Polish translation
* Fix Danish spelling
* plugin-tray: Fix dupe icon display error
* Don't export github templates
* Use worldclock by default instead of clock.
* clock: Show deprecation message on startup/add
* Fix clock text update
* Avoid calling text() in MatchAction on a QAction == 0
* volume: Do check for OSS availability in run-time
* Update Polish .desktop entry
* Remove space from end of "Show popup on mouse hover " string
* Updated Lithuanian translation
* Add/update Lithuanian translation
* Update directorymenu_it.desktop
* mainmenu: Don't hold the references for menu-cache
* mainmenu: Fix menu-cache usage
* set Qt::AA_UseHighDpiPixmaps to true
* l10n: Updated Polish translation
* Improved lxqt-panel version display
* Added default CMAKE_BUILD_TYPE and LXQT_PANEL_PATCH_VERSION
* plugins: Make widgets/buttons use whole space
* LXQtPanelLayout: Honor item's expanding size policy
* mainmenu: Install eventFiler for all (sub)menus
* volume: Add all changes notifications (configurable)
* Fixes a FTBFS in superbuild mode
* Added merged autostart and menu to CMakeLists.txt
* Updated *_da.desktop files and removed *_da_DK.desktop files
* translation: Add Portugese directories
* Update desktop entries and Replace fr_FR by fr
* Merge pull request #45 from lxde/menu-comment
* lxqt-applications.menu: remove accidentally added topics from "System Tools"
* Update Greek translation (el) Remove country variant from language code
* Rename LxQt to LXQt everywhere
* CMake: Adds Runtime and Devel install COMPONENTs
* Coding style changes
* Adds double quotes to everything that may break
* Use GNUINnstallDirs
* Updates the build system to use the Targets infrastructure
* Place LXQt About over Preferences in the main menu
* Added italian translation in menu
* Added german translation for the settings directory.
* Drops hardcoded /etc/xdg paths
* menu: hungarian translations added
* Add Russian translation
* Restore the old preferences menu layout of razor-qt.
* Updated german translation, replaced Qt4 by Qt in all xsession/translations
* add lxqt-leave directory files
* use LXQt-specific menu file
* Updates translations infrastructure
* Update the required minimum cmake version
* remove dead template lines switch OnlyShowIn from Razor -> LXQt stringchanges LxQt -> LXQt
* Support lxqt-session and add necessary xdg autostart desktop entry files.
* Fit the task group to its contents
* mainmenu: Add "true" translucency support
* Show "unknown" when an icon is missing
* volume: Force step for wheel over popup slider
* volume: Always show tooltip over button
* volume: Force configured step for wheel over button
* volume: Use "override" keyword
* Enable translucency for taskbar group popup
* tray: Move tray icon window into correct place
* taskbar: Elide texts of buttons when needed
* volume: Fix calculating of alsa volume
* volume: Remove duplicated code
* volume: Fix reporting of pulse volume
* sysstat: Fix saving of network maximum speed
* mainmenu: Redesign config dialog
* mainmenu: Clear search upon show (configurable)
* plugin-kbindicator: Undef the "explicit" workaround
* plugin-sysstat: Avoid "set but unused var" warning
* panel: Make space reserve on display configurable
* panel: Add wrong logic warning
* panel: Hide correctly upon the DragLeave
* plugin-mount: Fix firing the actions
* plugin-mount: Notify just on "real" add/remove
* plugin: Save settings before signal connect
* taskbar: Add Meta+1..9 shortcuts to raise windows
* Bump year
0.11.1 / 2017-01-01
===================
* Release 0.11.1: Update changelog
* Show Auto-Hiding Panels with Delay (#387)
* Enabling testing on weston (#380)
* Update *da.desktop files

View File

@ -58,6 +58,11 @@ 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)
@ -266,3 +271,7 @@ endforeach()
message(STATUS "*********************************************************************")
add_subdirectory(panel)
# merged from lxqt-common
add_subdirectory(autostart)
add_subdirectory(menu)

17
autostart/CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
file(GLOB DESKTOP_FILES_IN *.desktop.in)
# Translations **********************************
lxqt_translate_desktop(DESKTOP_FILES
SOURCES
${DESKTOP_FILES_IN}
)
add_custom_target(lxqt_panel_autostart_desktop_files ALL DEPENDS ${DESKTOP_FILES})
#************************************************
install(FILES
${DESKTOP_FILES}
DESTINATION "${LXQT_ETC_XDG_DIR}/autostart"
COMPONENT Runtime
)

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=Panel
TryExec=lxqt-panel
Exec=lxqt-panel
OnlyShowIn=LXQt;
X-LXQt-Module=true
#TRANSLATIONS_DIR=translations

View File

@ -0,0 +1,2 @@
# Translations
Name[ar]=اللوحة

View File

@ -0,0 +1,2 @@
# Translations
Name[cs]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[cs_CZ]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[da]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[de]=Bedienfeld

View File

@ -0,0 +1,2 @@
# Translations
Name[el]=Πίνακας

View File

@ -0,0 +1,2 @@
# Translations
Name[eo]=Panelo

View File

@ -0,0 +1,2 @@
# Translations
Name[es]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[es_VE]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[eu]=Panela

View File

@ -0,0 +1,2 @@
# Translations
Name[fi]=Paneeli

View File

@ -0,0 +1,2 @@
# Translations
Name[fr]=Tableau de bord

View File

@ -0,0 +1,2 @@
# Translations
Name[hu]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[hu_HU]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[ia]=Panello

View File

@ -0,0 +1,2 @@
# Translations
Name[it_IT]=Pannello

View File

@ -0,0 +1,2 @@
# Translations
Name[ja]=

View File

@ -0,0 +1,2 @@
# Translations
Name[lt]=Skydelis

View File

@ -0,0 +1,2 @@
# Translations
Name[nl]=Paneel

View File

@ -0,0 +1,2 @@
# Translations
Name[pl]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[pt]=Painel

View File

@ -0,0 +1,2 @@
# Translations
Name[pt_BR]=Painel

View File

@ -0,0 +1,2 @@
# Translations
Name[ro_RO]=Panou

View File

@ -0,0 +1,2 @@
# Translations
Name[ru]=панель

View File

@ -0,0 +1,2 @@
# Translations
Name[ru_RU]=Панель

View File

@ -0,0 +1,2 @@
# Translations
Name[sl]=Pult

View File

@ -0,0 +1,2 @@
# Translations
Name[th_TH]=

View File

@ -0,0 +1,2 @@
# Translations
Name[tr]=Panel

View File

@ -0,0 +1,2 @@
# Translations
Name[uk]=Панель

View File

@ -0,0 +1,2 @@
# Translations
Name[zh_CN]=

View File

@ -0,0 +1,2 @@
# Translations
Name[zh_TW]=

21
menu/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
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
)

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Leave
Comment=Leave Session
Icon=system-shutdown
Type=Directory
#TRANSLATIONS_DIR=../translations

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=LXQt settings
Icon=preferences-system
#TRANSLATIONS_DIR=translations
# Translations

237
menu/lxqt-applications.menu Normal file
View File

@ -0,0 +1,237 @@
<!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 -->

View File

@ -0,0 +1,8 @@
[Desktop Entry]
Name=Leave
Comment=Leave Session
Icon=system-shutdown
Type=Directory
Comment[de]=Sitzung verlassen
Name[de]=Verlassen

View File

@ -0,0 +1 @@
Name[el]=Έξοδος

View File

@ -0,0 +1,3 @@
[Desktop Entry]
Name[fr]=Quitter
Comment[fr]=Quitter la session

View File

@ -0,0 +1,2 @@
Comment[hu]=LXQt elhagyása
Name[hu]=Kilépés

View File

@ -0,0 +1,2 @@
Name[it]=Esci
Comment[it]=Chiudere la sessione

View File

@ -0,0 +1,8 @@
[Desktop Entry]
Name=Leave
Comment=Leave Session
Icon=system-shutdown
Type=Directory
Comment[lt]=Užbaigti seansą
Name[lt]=Išeiti

View File

@ -0,0 +1,2 @@
Name[pl]=Opuść
Comment[pl]=Zakończ sesję

View File

@ -0,0 +1,3 @@
[Desktop Entry]
Name[pt]=Sair
Comment[pt]=Sair da sessão

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Leave
Comment=Leave Session
Icon=system-shutdown
Type=Directory
Comment[ru]=Завершить сеанс
Name[ru]=Выйти
Comment[ru_RU]=Завершить сеанс
Name[ru_RU]=Выйти

View File

@ -0,0 +1 @@
Name[de]=LXQt-Systemeinstellungen

View File

@ -0,0 +1,2 @@
Name[el]=Ρυθμίσεις LXQt

View File

@ -0,0 +1 @@
Name[fr]=LXQt-Paramétrage du système

View File

@ -0,0 +1 @@
Name[hu]=LXQt beállítása

View File

@ -0,0 +1 @@
Name[it]=Impostazioni di LXQt

View File

@ -0,0 +1 @@
Name[lt]=LXQt nustatymai

View File

@ -0,0 +1 @@
Name[pl]=Ustawienia LXQt

View File

@ -0,0 +1,2 @@
[Desktop Entry]
Name=Definições do LXQt

View File

@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=LXQt settings
Icon=preferences-system
#TRANSLATIONS_DIR=translations
# Translations
Name[ru]=Настройки LXQt
Name[ru_RU]=Настройки LXQt

View File

@ -87,6 +87,7 @@ ConfigPanelWidget::ConfigPanelWidget(LXQtPanel *panel, QWidget *parent) :
mBackgroundColor = mOldBackgroundColor;
mOldBackgroundImage = mPanel->backgroundImage();
mOldOpacity = mPanel->opacity();
mOldReserveSpace = mPanel->reserveSpace();
// reset configurations from file
reset();
@ -112,6 +113,8 @@ ConfigPanelWidget::ConfigPanelWidget(LXQtPanel *panel, QWidget *parent) :
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); });
}
@ -144,6 +147,7 @@ void ConfigPanelWidget::reset()
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());

View File

@ -96,6 +96,7 @@ private:
QColor mOldBackgroundColor;
QString mOldBackgroundImage;
int mOldOpacity;
bool mOldReserveSpace;
};
#endif

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>397</height>
<width>382</width>
<height>517</height>
</rect>
</property>
<property name="sizePolicy">
@ -324,6 +324,16 @@
</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>

View File

@ -72,6 +72,7 @@
#define CFG_KEY_BACKGROUNDCOLOR "background-color"
#define CFG_KEY_BACKGROUNDIMAGE "background-image"
#define CFG_KEY_OPACITY "opacity"
#define CFG_KEY_RESERVESPACE "reserve-space"
#define CFG_KEY_PLUGINS "plugins"
#define CFG_KEY_HIDABLE "hidable"
#define CFG_KEY_ANIMATION "animation-duration"
@ -134,6 +135,7 @@ LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidg
mHidable(false),
mHidden(false),
mAnimationTime(0),
mReserveSpace(true),
mAnimation(nullptr),
mLockPanel(false)
{
@ -263,6 +265,7 @@ void LXQtPanel::readSettings()
setFontColor(color, true);
setOpacity(mSettings->value(CFG_KEY_OPACITY, 100).toInt(), true);
mReserveSpace = mSettings->value(CFG_KEY_RESERVESPACE, true).toBool();
color = mSettings->value(CFG_KEY_BACKGROUNDCOLOR, "").value<QColor>();
if (color.isValid())
setBackgroundColor(color, true);
@ -310,6 +313,7 @@ void LXQtPanel::saveSettings(bool later)
mSettings->setValue(CFG_KEY_BACKGROUNDCOLOR, mBackgroundColor.isValid() ? mBackgroundColor : QColor());
mSettings->setValue(CFG_KEY_BACKGROUNDIMAGE, QFileInfo(mBackgroundImage).exists() ? mBackgroundImage : QString());
mSettings->setValue(CFG_KEY_OPACITY, mOpacity);
mSettings->setValue(CFG_KEY_RESERVESPACE, mReserveSpace);
mSettings->setValue(CFG_KEY_HIDABLE, mHidable);
mSettings->setValue(CFG_KEY_ANIMATION, mAnimationTime);
@ -388,7 +392,10 @@ void LXQtPanel::loadPlugins()
connect(mPlugins.data(), &PanelPluginsModel::pluginRemoved, this, &LXQtPanel::pluginRemoved);
for (auto const & plugin : mPlugins->plugins())
{
mLayout->addPlugin(plugin);
connect(plugin, &Plugin::dragLeft, [this] { mShowDelayTimer.stop(); hidePanel(); });
}
}
/************************************************
@ -582,51 +589,62 @@ void LXQtPanel::updateWmStrut()
if(wid == 0 || !isVisible())
return;
const QRect wholeScreen = QApplication::desktop()->geometry();
const QRect rect = geometry();
// NOTE: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
// Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor."
// So, we use the geometry of the whole screen to calculate the strut rather than using the geometry of individual monitors.
// Though the spec only mention Xinerama and did not mention XRandR, the rule should still be applied.
// At least openbox is implemented like this.
switch (mPosition)
if (mReserveSpace)
{
case LXQtPanel::PositionTop:
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ 0, 0, 0,
/* Top */ rect.top() + getReserveDimension(), rect.left(), rect.right(),
/* Bottom */ 0, 0, 0
);
break;
const QRect wholeScreen = QApplication::desktop()->geometry();
const QRect rect = geometry();
// NOTE: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
// Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor."
// So, we use the geometry of the whole screen to calculate the strut rather than using the geometry of individual monitors.
// Though the spec only mention Xinerama and did not mention XRandR, the rule should still be applied.
// At least openbox is implemented like this.
switch (mPosition)
{
case LXQtPanel::PositionTop:
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ 0, 0, 0,
/* Top */ rect.top() + getReserveDimension(), rect.left(), rect.right(),
/* Bottom */ 0, 0, 0
);
break;
case LXQtPanel::PositionBottom:
case LXQtPanel::PositionBottom:
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right()
);
break;
case LXQtPanel::PositionLeft:
KWindowSystem::setExtendedStrut(wid,
/* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(),
/* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
);
break;
case LXQtPanel::PositionRight:
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(),
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
);
break;
}
} else
{
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right()
);
break;
case LXQtPanel::PositionLeft:
KWindowSystem::setExtendedStrut(wid,
/* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(),
/* Right */ 0, 0, 0,
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
);
break;
case LXQtPanel::PositionRight:
KWindowSystem::setExtendedStrut(wid,
/* Left */ 0, 0, 0,
/* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(),
/* Top */ 0, 0, 0,
/* Bottom */ 0, 0, 0
);
break;
}
}
@ -947,6 +965,23 @@ void LXQtPanel::setOpacity(int opacity, bool save)
}
/************************************************
*
************************************************/
void LXQtPanel::setReserveSpace(bool reserveSpace, bool save)
{
if (mReserveSpace == reserveSpace)
return;
mReserveSpace = reserveSpace;
if (save)
saveSettings(true);
updateWmStrut();
}
/************************************************
************************************************/
@ -1161,7 +1196,13 @@ QRect LXQtPanel::calculatePopupWindowPos(const ILXQtPanelPlugin *plugin, const Q
{
Plugin *panel_plugin = findPlugin(plugin);
if (nullptr == panel_plugin)
{
qWarning() << Q_FUNC_INFO << "Wrong logic? Unable to find Plugin* for" << plugin << "known plugins follow...";
for (auto const & plug : mPlugins->plugins())
qWarning() << plug->iPlugin() << plug;
return QRect();
}
return calculatePopupWindowPos(panel_plugin->mapToGlobal(QPoint(0, 0)), windowSize);
}

View File

@ -218,6 +218,7 @@ public:
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(); }
@ -294,6 +295,7 @@ public slots:
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()
@ -637,6 +639,14 @@ private:
* 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

View File

@ -79,10 +79,14 @@ LXQtPanelApplication::LXQtPanelApplication(int& argc, char** argv)
Q_D(LXQtPanelApplication);
QCoreApplication::setApplicationName(QLatin1String("lxqt-panel"));
QCoreApplication::setApplicationVersion(LXQT_VERSION);
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.setApplicationDescription(QLatin1String("LXQt Panel"));
parser.addHelpOption();
parser.addVersionOption();

View File

@ -701,7 +701,10 @@ void LXQtPanelLayout::setGeometryHoriz(const QRect &geometry)
}
else
{
const int height = qMin(qMin(info.geometry.height(), geometry.height()), bh + (0 < remain-- ? 1 : 0));
int height = bh + (0 < remain-- ? 1 : 0);
if (!info.item->expandingDirections().testFlag(Qt::Orientation::Vertical))
height = qMin(info.geometry.height(), height);
height = qMin(geometry.height(), height);
rect.setHeight(height);
rect.setWidth(qMin(info.geometry.width(), geometry.width()));
if (height < bh)
@ -746,7 +749,10 @@ void LXQtPanelLayout::setGeometryHoriz(const QRect &geometry)
}
else
{
const int height = qMin(qMin(info.geometry.height(), geometry.height()), bh + (0 < remain-- ? 1 : 0));
int height = bh + (0 < remain-- ? 1 : 0);
if (!info.item->expandingDirections().testFlag(Qt::Orientation::Vertical))
height = qMin(info.geometry.height(), height);
height = qMin(geometry.height(), height);
rect.setHeight(height);
rect.setWidth(qMin(info.geometry.width(), geometry.width()));
if (height < bh)
@ -834,7 +840,10 @@ void LXQtPanelLayout::setGeometryVert(const QRect &geometry)
else
{
rect.setHeight(qMin(info.geometry.height(), geometry.height()));
const int width = qMin(qMin(info.geometry.width(), geometry.width()), bw + (0 < remain-- ? 1 : 0));
int width = bw + (0 < remain-- ? 1 : 0);
if (!info.item->expandingDirections().testFlag(Qt::Orientation::Horizontal))
width = qMin(info.geometry.width(), width);
width = qMin(geometry.width(), width);
rect.setWidth(width);
if (width < bw)
rect.moveCenter(QPoint(baseLines[c] + base_center, 0));
@ -879,7 +888,10 @@ void LXQtPanelLayout::setGeometryVert(const QRect &geometry)
else
{
rect.setHeight(qMin(info.geometry.height(), geometry.height()));
const int width = qMin(qMin(info.geometry.width(), geometry.width()), bw + (0 < remain-- ? 1 : 0));
int width = bw + (0 < remain-- ? 1 : 0);
if (!info.item->expandingDirections().testFlag(Qt::Orientation::Horizontal))
width = qMin(info.geometry.width(), width);
width = qMin(geometry.width(), width);
rect.setWidth(width);
if (width < bw)
rect.moveCenter(QPoint(baseLines[c] + base_center, 0));

View File

@ -37,6 +37,7 @@
int main(int argc, char *argv[])
{
LXQtPanelApplication app(argc, argv);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
return app.exec();
}

View File

@ -155,11 +155,12 @@ Plugin::Plugin(const LXQt::PluginInfo &desktopFile, LXQt::Settings *settings, co
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);
saveSettings();
}
@ -267,6 +268,7 @@ bool Plugin::loadLib(ILXQtPanelPluginLibrary const * pluginLib)
if (mPluginWidget)
{
mPluginWidget->setObjectName(mPlugin->themeId());
watchWidgets(mPluginWidget);
}
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
return true;
@ -300,6 +302,34 @@ bool Plugin::loadModule(const QString &libraryName)
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);
}
}
/************************************************
@ -422,6 +452,28 @@ bool Plugin::isExpandable() const
}
/************************************************
************************************************/
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;
}
/************************************************
************************************************/

View File

@ -81,6 +81,8 @@ public:
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; }
@ -93,6 +95,11 @@ public slots:
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);
@ -104,6 +111,8 @@ 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;

View File

@ -24,8 +24,8 @@ type=tray
[mount]
type=mount
[clock]
type=clock
[worldclock]
type=worldclock
[volume]
device=0

View File

@ -44,6 +44,32 @@
#include <QPainter>
#include <QDebug>
#include <LXQt/Notification>
static void notifyAboutDeprecation(PluginSettings * settings)
{
// this is called only from LXQtClock c-tor...so just from main thread, no locking needed
// Note: we get/store the "dont_show" in section of particular instance of clock => this is not 100% valid
// for al possible changes of panel configuration, but we can live with this
static bool notification_done = settings->value(QLatin1String("dont_show_deprecation"), false).toBool();
if (!notification_done)
{
LXQt::Notification * notification = new LXQt::Notification{LXQtClock::tr("Date&Time (clock) plugin is deprecated")};
notification->setBody(LXQtClock::tr("The <strong>clock</strong> plugin is deprecated and will be removed in future version of LXQt. Consider"
" replacing it with <strong>worldclock</strong>.<br/>"));
notification->setActions({LXQtClock::tr("don't show this again")});
notification->setTimeout(5000);
QObject::connect(notification, &LXQt::Notification::actionActivated, settings, [notification, settings] (int actionNumber) -> void
{
if (actionNumber == 0)
settings->setValue(QLatin1String("dont_show_deprecation"), true);
notification->close();
});
QObject::connect(notification, &LXQt::Notification::notificationClosed, notification, &QObject::deleteLater);
notification->update();
notification_done = true;
}
}
/**
* @file lxqtclock.cpp
@ -82,6 +108,8 @@ LXQtClock::LXQtClock(const ILXQtPanelPluginStartupInfo &startupInfo):
mTextStyle{new DownscaleFontStyle},
mCurrentCharCount(0)
{
QTimer::singleShot(0, this, [this] { notifyAboutDeprecation(settings()); });
mMainWidget = new QWidget();
mRotatedWidget = new LXQt::RotatedWidget(*(new QWidget()), mMainWidget);
mContent = mRotatedWidget->content();

View File

@ -8,5 +8,5 @@ Comment=Displays the current time. Comes with a calendar.
# Translations
Comment[pl]=Zegar oraz kalendarz
Comment[pl]=Wyświetla obecny czas. Zawiera kalendarz.
Name[pl]=Zegar

View File

@ -1,12 +0,0 @@
[Desktop Entry]
Type=Service
ServiceTypes=LXQtPanel/Plugin
Name=Date & time
Comment=Displays the current time. Comes with a calendar.
#TRANSLATIONS_DIR=../translations
# Translations
Comment[pl_PL]=Zegar i kalendarz
Name[pl_PL]=Zegar

View File

@ -6,5 +6,5 @@ Comment=Get the color under the cursor. For web developers.
# Translations
Comment[pl_PL]=Pobierz kolor spod kursora. Dla webdeveloperów.
Name[pl_PL]=Wybieracz kolorów
Comment[lt]=Gauti po žymekliu esančią spalvą. Saityno plėtotojams.
Name[lt]=Spalvos parinkiklis

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Type=Service
ServiceTypes=LXQtPanel/Plugin
Name=Color picker
Comment=Get the color under the cursor. For web developers.
# Translations
Comment[pl]=Sprawdź kolor wskazany kursorem. Przeznaczony dla web developerów.
Name[pl]=Wybieracz kolorów

View File

@ -9,5 +9,5 @@ Comment=Displays the current CPU load.
# Translations
Comment[pl_PL]=Monitor obciążenia CPU
Name[pl_PL]=Obciążenie CPU
Comment[pl]=Wyświetla obecne obciążenie CPU
Name[pl]=Obciążenie CPU

View File

@ -9,4 +9,4 @@ Icon=user-desktop
# Translations
Name[da]=Skrivebordsskifter
Comment[da]=Giver mulighed for nemt at skifte imellem virtuelle skriveborde.
Comment[da]=Giver mulighed for nemt at skifte mellem virtuelle skriveborde.

View File

@ -8,5 +8,5 @@ Comment=Allows easy switching between virtual desktops.
# Translations
Comment[lt]=Leidžia judėti tarp virtualių darbalaukių
Name[lt]=Darbalaukių perjungimas
Comment[lt]=Leidžia lengvai perjunginėti virtualius darbalaukius
Name[lt]=Darbalaukių perjungiklis

View File

@ -8,5 +8,5 @@ Comment=Allows easy switching between virtual desktops.
# Translations
Comment[pl]=Pozwala przełączać się pomiędzy writualnymi pulpitami
Comment[pl]=Pozwala na proste przełączanie pomiędzy wirtualnymi pulpitami
Name[pl]=Obszary robocze

View File

@ -1,12 +0,0 @@
[Desktop Entry]
Type=Service
ServiceTypes=LXQtPanel/Plugin
Name=Desktop switcher
Comment=Allows easy switching between virtual desktops.
#TRANSLATIONS_DIR=../translations
# Translations
Comment[pl_PL]=Zezwól na przełączanie między pulpitami
Name[pl_PL]=Zmień pulpit

View File

@ -46,7 +46,8 @@ DirectoryMenu::DirectoryMenu(const ILXQtPanelPluginStartupInfo &startupInfo) :
mOpenDirectorySignalMapper = new QSignalMapper(this);
mMenuSignalMapper = new QSignalMapper(this);
mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
mButton.setAutoRaise(true);
mButton.setIcon(XdgIcon::fromTheme("folder"));
connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu()));

View File

@ -1,2 +1,2 @@
Name[it]=Menù cartella
Name[it]=Menu cartella
Comment[it]=Mostra il contenuto di una cartella

View File

@ -0,0 +1,2 @@
Name[lt]=Katalogų meniu
Comment[lt]=Rodo meniu, kuriame rodomas katalogų turinys

View File

@ -0,0 +1,2 @@
Name[pl]=Menu katalogów
Comment[pl]=Wyświetla menu z zawartością katalogów

View File

@ -0,0 +1,2 @@
Name[lt]=Skydelio DOM medis
Comment[lt]=Rodyti LXQt skydelio DOM medį.

View File

@ -0,0 +1,2 @@
Name[pl]=Drzewo DOM panelu
Comment[pl]=Wyświetla drzewo DOM panelu LXQt.

View File

@ -33,8 +33,15 @@
#include <xkbcommon/xkbcommon-x11.h>
#include <xcb/xcb.h>
// Note: We need to override "explicit" as this is a C++ keyword. But it is
// used as variable name in xkb.h. This is causing a failure in C++ compile
// time.
// Similar bug here: https://bugs.freedesktop.org/show_bug.cgi?id=74080
#define explicit _explicit
#include <xcb/xkb.h>
#undef explicit
#include "../kbdinfo.h"
#include "../controls.h"

View File

@ -0,0 +1,2 @@
Name[lt]=Klaviatūros būsenos indikatorius
Comment[lt]=Klaviatūros būsenos ir išdėstymų perjungimo įskiepis.

View File

@ -0,0 +1,2 @@
Name[pl]=Wskaźnik stanu klawiatury
Comment[pl]=Wskaźnik i przełącznik stanu klawiatury.

View File

@ -61,6 +61,7 @@ LXQtMainMenu::LXQtMainMenu(const ILXQtPanelPluginStartupInfo &startupInfo):
mMakeDirtyAction{new QAction{this}},
mFilterMenu(true),
mFilterShow(true),
mFilterClear(false),
mFilterShowHideMenu(true),
mHeavyMenuChanges(false)
{
@ -127,6 +128,7 @@ LXQtMainMenu::~LXQtMainMenu()
{
mMenu->removeAction(mSearchEditAction);
mMenu->removeAction(mSearchViewAction);
delete mMenu;
}
#ifdef HAVE_MENU_CACHE
if(mMenuCache)
@ -163,6 +165,10 @@ void LXQtMainMenu::showMenu()
mMenu->popup(calculatePopupWindowPos(mMenu->sizeHint()).topLeft());
if (mFilterMenu || mFilterShow)
{
if (mFilterClear && !mSearchEdit->text().isEmpty())
{
mSearchEdit->setText(QString{});
}
//Note: part of the workadound for https://bugreports.qt.io/browse/QTBUG-52021
mSearchEdit->setReadOnly(false);
//the setReadOnly also changes the cursor, override it back to normal
@ -213,8 +219,11 @@ void LXQtMainMenu::settingsChanged()
menu_cache_unref(mMenuCache);
}
mMenuCache = menu_cache_lookup(mMenuFile.toLocal8Bit());
if (menu_cache_get_root_dir(mMenuCache))
if (MenuCacheDir * root = menu_cache_dup_root_dir(mMenuCache))
{
menu_cache_item_unref(MENU_CACHE_ITEM(root));
buildMenu();
}
mMenuCacheNotify = menu_cache_add_reload_notify(mMenuCache, (MenuCacheReloadNotify)menuCacheReloadNotify, this);
#else
mXdgMenu.setEnvironments(QStringList() << "X-LXQT" << "LXQt");
@ -240,6 +249,7 @@ void LXQtMainMenu::settingsChanged()
mSearchEdit->setText(QString{});
mFilterMenu = settings()->value("filterMenu", true).toBool();
mFilterShow = settings()->value("filterShow", true).toBool();
mFilterClear = settings()->value("filterClear", false).toBool();
mFilterShowHideMenu = settings()->value("filterShowHideMenu", true).toBool();
if (mMenu)
{
@ -287,6 +297,18 @@ static void showHideMenuEntries(QMenu * menu, bool show)
}
}
static void setTranslucentMenus(QMenu * menu)
{
menu->setAttribute(Qt::WA_TranslucentBackground);
for (auto const & action : menu->actions())
{
if (QMenu * sub_menu = action->menu())
{
setTranslucentMenus(sub_menu);
}
}
}
/************************************************
************************************************/
@ -326,6 +348,16 @@ void LXQtMainMenu::setSearchFocus(QAction *action)
}
}
static void menuInstallEventFilter(QMenu * menu, QObject * watcher)
{
for (auto const & action : const_cast<QList<QAction *> const &&>(menu->actions()))
{
if (action->menu())
menuInstallEventFilter(action->menu(), watcher); // recursion
}
menu->installEventFilter(watcher);
}
/************************************************
************************************************/
@ -343,6 +375,7 @@ void LXQtMainMenu::buildMenu()
mMenu = new XdgMenuWidget(mXdgMenu, "", &mButton);
#endif
mMenu->setObjectName("TopLevelMainMenu");
setTranslucentMenus(mMenu);
// Note: the QWidget::ensurePolished() workarounds problem with transparent
// QLineEdit (mSearchEditAction) in menu with Breeze style
// https://bugs.kde.org/show_bug.cgi?id=368048
@ -351,13 +384,7 @@ void LXQtMainMenu::buildMenu()
mMenu->addSeparator();
Q_FOREACH(QAction* action, mMenu->actions())
{
if (action->menu())
action->menu()->installEventFilter(this);
}
mMenu->installEventFilter(this);
menuInstallEventFilter(mMenu, this);
connect(mMenu, &QMenu::aboutToHide, &mHideTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(mMenu, &QMenu::aboutToShow, &mHideTimer, &QTimer::stop);
@ -470,19 +497,21 @@ bool LXQtMainMenu::eventFilter(QObject *obj, QEvent *event)
mMenu->hide(); // close the app menu
return true;
}
else // go to the menu item starts with the pressed key
else // go to the menu item which starts with the pressed key if there is an active action.
{
QString key = keyEvent->text();
if(key.isEmpty())
return false;
QAction* action = menu->activeAction();
QList<QAction*> actions = menu->actions();
QList<QAction*>::iterator it = qFind(actions.begin(), actions.end(), action);
it = std::find_if(it + 1, actions.end(), MatchAction(key));
if(it == actions.end())
it = std::find_if(actions.begin(), it, MatchAction(key));
if(it != actions.end())
menu->setActiveAction(*it);
if(action !=0) {
QList<QAction*> actions = menu->actions();
QList<QAction*>::iterator it = qFind(actions.begin(), actions.end(), action);
it = std::find_if(it + 1, actions.end(), MatchAction(key));
if(it == actions.end())
it = std::find_if(actions.begin(), it, MatchAction(key));
if(it != actions.end())
menu->setActiveAction(*it);
}
}
}

View File

@ -97,6 +97,7 @@ private:
QAction * mMakeDirtyAction;
bool mFilterMenu; //!< searching should perform hiding nonmatching items in menu
bool mFilterShow; //!< searching should list matching items in top menu
bool mFilterClear; //!< search field should be cleared upon showing the menu
bool mFilterShowHideMenu; //!< while searching all (original) menu entries should be hidden
bool mHeavyMenuChanges; //!< flag for filtering some mMenu events while heavy changes are performed

View File

@ -77,10 +77,12 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(PluginSettings *settings, G
connect(ui->filterMenuCB, &QCheckBox::toggled, [this] (bool enabled)
{
ui->filterClearCB->setEnabled(enabled || ui->filterShowCB->isChecked());
this->settings().setValue("filterMenu", enabled);
});
connect(ui->filterShowCB, &QCheckBox::toggled, [this] (bool enabled)
{
ui->filterClearCB->setEnabled(enabled || ui->filterMenuCB->isChecked());
this->settings().setValue("filterShow", enabled);
});
connect(ui->filterShowMaxItemsSB, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this] (int value)
@ -95,6 +97,10 @@ LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(PluginSettings *settings, G
{
this->settings().setValue("filterShowHideMenu", enabled);
});
connect(ui->filterClearCB, &QCheckBox::toggled, [this] (bool enabled)
{
this->settings().setValue("filterClear", enabled);
});
}
LXQtMainMenuConfiguration::~LXQtMainMenuConfiguration()
@ -124,7 +130,8 @@ void LXQtMainMenuConfiguration::loadSettings()
systemFont.fromString(lxqtSettings.value("font", this->font()).toString());
lxqtSettings.endGroup();
ui->customFontSizeSB->setValue(settings().value("customFontSize", systemFont.pointSize()).toInt());
ui->filterMenuCB->setChecked(settings().value("filterMenu", true).toBool());
const bool filter_menu = settings().value("filterMenu", true).toBool();
ui->filterMenuCB->setChecked(filter_menu);
const bool filter_show = settings().value("filterShow", true).toBool();
ui->filterShowCB->setChecked(filter_show);
ui->filterShowMaxItemsL->setEnabled(filter_show);
@ -135,6 +142,8 @@ void LXQtMainMenuConfiguration::loadSettings()
ui->filterShowMaxWidthSB->setValue(settings().value("filterShowMaxWidth", 300).toInt());
ui->filterShowHideMenuCB->setEnabled(filter_show);
ui->filterShowHideMenuCB->setChecked(settings().value("filterShowHideMenu", true).toBool());
ui->filterClearCB->setChecked(settings().value("filterClear", false).toBool());
ui->filterClearCB->setEnabled(filter_menu || filter_show);
}

View File

@ -150,19 +150,6 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="searchGB">
<property name="title">
@ -224,9 +211,29 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="filterClearCB">
<property name="text">
<string>Clear search upon showing menu</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttons">
<property name="orientation">

View File

@ -8,5 +8,5 @@ Comment=A menu of all your applications.
# Translations
Comment[pl]=Główne menu
Comment[pl]=Menu pozwalające na uruchomienie i wyszukiwanie wszystkich aplikacji.
Name[pl]=Menu

View File

@ -1,12 +0,0 @@
[Desktop Entry]
Type=Service
ServiceTypes=LXQtPanel/Plugin
Name=Application menu
Comment=A menu of all your applications.
#TRANSLATIONS_DIR=../translations
# Translations
Comment[pl_PL]=Menu aplikacji
Name[pl_PL]=Menu

View File

@ -35,8 +35,8 @@
#include <QDebug>
XdgCachedMenuAction::XdgCachedMenuAction(MenuCacheItem* item, QObject* parent):
QAction(parent),
item_(menu_cache_item_ref(item))
QAction{parent}
, iconName_{QString::fromUtf8(menu_cache_item_get_icon(item))}
{
QString title = QString::fromUtf8(menu_cache_item_get_name(item));
title = title.replace('&', QLatin1String("&&")); // & is reserved for mnemonics
@ -47,19 +47,18 @@ XdgCachedMenuAction::XdgCachedMenuAction(MenuCacheItem* item, QObject* parent):
QString comment = QString::fromUtf8(menu_cache_item_get_comment(item));
setToolTip(comment);
}
}
XdgCachedMenuAction::~XdgCachedMenuAction()
{
if(item_)
menu_cache_item_unref(item_);
if (char * file_path = menu_cache_item_get_file_path(item))
{
filePath_ = QString::fromUtf8(file_path);
g_free(file_path);
}
}
void XdgCachedMenuAction::updateIcon()
{
if(icon().isNull())
{
QIcon icon = XdgIcon::fromTheme(menu_cache_item_get_icon(item_));
QIcon icon = XdgIcon::fromTheme(iconName_, QIcon::fromTheme("unknown"));
setIcon(icon);
}
}
@ -72,7 +71,7 @@ XdgCachedMenu::XdgCachedMenu(QWidget* parent): QMenu(parent)
XdgCachedMenu::XdgCachedMenu(MenuCache* menuCache, QWidget* parent): QMenu(parent)
{
// qDebug() << "CREATE MENU FROM CACHE" << menuCache;
MenuCacheDir* dir = menu_cache_get_root_dir(menuCache);
MenuCacheDir* dir = menu_cache_dup_root_dir(menuCache);
// get current desktop name or fallback to LXQt
const QByteArray xdgDesktop = qgetenv("XDG_CURRENT_DESKTOP");
@ -80,6 +79,7 @@ XdgCachedMenu::XdgCachedMenu(MenuCache* menuCache, QWidget* parent): QMenu(paren
menu_cache_desktop_ = menu_cache_get_desktop_env_flag(menuCache, desktop.constData());
addMenuItems(this, dir);
menu_cache_item_unref(MENU_CACHE_ITEM(dir));
connect(this, SIGNAL(aboutToShow()), SLOT(onAboutToShow()));
}
@ -89,7 +89,8 @@ XdgCachedMenu::~XdgCachedMenu()
void XdgCachedMenu::addMenuItems(QMenu* menu, MenuCacheDir* dir)
{
for(GSList* l = menu_cache_dir_get_children(dir); l; l = l->next)
GSList* list = menu_cache_dir_list_children(dir);
for(GSList * l = list; l; l = l->next)
{
MenuCacheItem* item = (MenuCacheItem*)l->data;
MenuCacheType type = menu_cache_item_get_type(item);
@ -122,16 +123,17 @@ void XdgCachedMenu::addMenuItems(QMenu* menu, MenuCacheDir* dir)
addMenuItems(submenu, MENU_CACHE_DIR(item));
}
}
menu_cache_item_unref(item);
}
if (list)
g_slist_free(list);
}
void XdgCachedMenu::onItemTrigerred()
{
XdgCachedMenuAction* action = static_cast<XdgCachedMenuAction*>(sender());
XdgDesktopFile df;
char* desktop_file = menu_cache_item_get_file_path(action->item());
df.load(desktop_file);
g_free(desktop_file);
df.load(action->filePath());
df.startDetached();
}
@ -176,9 +178,7 @@ void XdgCachedMenu::handleMouseMoveEvent(QMouseEvent *event)
return;
QList<QUrl> urls;
char* desktop_file = menu_cache_item_get_file_path(a->item());
urls << QUrl(QString("file://%1").arg(desktop_file));
g_free(desktop_file);
urls << QUrl(QString("file://%1").arg(a->filePath()));
QMimeData *mimeData = new QMimeData();
mimeData->setUrls(urls);

View File

@ -56,16 +56,13 @@ class XdgCachedMenuAction: public QAction
Q_OBJECT
public:
explicit XdgCachedMenuAction(MenuCacheItem* item, QObject* parent = 0);
virtual ~XdgCachedMenuAction();
MenuCacheItem* item() const {
return item_;
}
inline const QString & filePath() const { return filePath_; }
void updateIcon();
private:
MenuCacheItem* item_;
QString iconName_;
QString filePath_;
};

View File

@ -80,18 +80,14 @@ QString DeviceAction::actionIdToString(DeviceAction::ActionId id)
return ACT_INFO;
}
void DeviceAction::onDeviceAdded(QString const & udi)
void DeviceAction::onDeviceAdded(Solid::Device device)
{
Solid::Device device(udi);
if (device.is<Solid::StorageAccess>())
doDeviceAdded(device);
doDeviceAdded(device);
}
void DeviceAction::onDeviceRemoved(QString const & udi)
void DeviceAction::onDeviceRemoved(Solid::Device device)
{
Solid::Device device(udi);
if (device.is<Solid::StorageAccess>())
doDeviceRemoved(device);
doDeviceRemoved(device);
}
DeviceAction::ActionId DeviceAction::stringToActionId(const QString &string, ActionId defaultValue)

View File

@ -54,8 +54,8 @@ public:
static QString actionIdToString(ActionId id);
public slots:
void onDeviceAdded(QString const & udi);
void onDeviceRemoved(QString const & udi);
void onDeviceAdded(Solid::Device device);
void onDeviceRemoved(Solid::Device device);
protected:
explicit DeviceAction(LXQtMountPlugin *plugin, QObject *parent = 0);

View File

@ -41,6 +41,8 @@ LXQtMountPlugin::LXQtMountPlugin(const ILXQtPanelPluginStartupInfo &startupInfo)
connect(mButton, &QToolButton::clicked, mPopup, &Popup::showHide);
connect(mPopup, &Popup::visibilityChanged, mButton, &QToolButton::setDown);
// Note: postpone creation of the mDeviceAction to not fire it in startup time
QTimer::singleShot(0, this, &LXQtMountPlugin::settingsChanged);
}
LXQtMountPlugin::~LXQtMountPlugin()
@ -74,11 +76,8 @@ void LXQtMountPlugin::settingsChanged()
delete mDeviceAction;
mDeviceAction = DeviceAction::create(actionId, this);
connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceAdded,
mDeviceAction, &DeviceAction::onDeviceAdded);
connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceRemoved,
mDeviceAction, &DeviceAction::onDeviceRemoved);
connect(mPopup, &Popup::deviceAdded, mDeviceAction, &DeviceAction::onDeviceAdded);
connect(mPopup, &Popup::deviceRemoved, mDeviceAction, &DeviceAction::onDeviceRemoved);
}
}

View File

@ -131,6 +131,8 @@ void Popup::onDeviceRemoved(QString const & udi)
--mDisplayCount;
if (mDisplayCount == 0)
mPlaceholder->show();
emit deviceRemoved(Solid::Device{udi});
}
}
@ -163,6 +165,8 @@ void Popup::addItem(Solid::Device device)
if (isVisible())
realign();
emit deviceAdded(device);
}
void Popup::realign()

Some files were not shown because too many files have changed in this diff Show More