diff --git a/cmake/BuildPlugin.cmake b/cmake/BuildPlugin.cmake index a354255..c8e3374 100644 --- a/cmake/BuildPlugin.cmake +++ b/cmake/BuildPlugin.cmake @@ -25,6 +25,8 @@ MACRO (BUILD_LXQT_PLUGIN NAME) SOURCES ${${PROJECT_NAME}_DESKTOP_FILES_IN} ) + + lxqt_plugin_translation_loader(QM_LOADER ${NAME} "lxqt-panel") #************************************************ file (GLOB CONFIG_FILES resources/*.conf) @@ -42,7 +44,7 @@ MACRO (BUILD_LXQT_PLUGIN NAME) endif() list(FIND STATIC_PLUGINS ${NAME} IS_STATIC) - set(SRC ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${${PROJECT_NAME}_QM_FILES} ${RESOURCES} ${UIS} ${DESKTOP_FILES}) + 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 diff --git a/debian/changelog b/debian/changelog index b45c826..a953efe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ -lxqt-panel (0.9.0+20150925-1) experimental; urgency=medium +lxqt-panel (0.9.0+20151024-1) experimental; urgency=medium [ Alf Gaida ] - * Cherry-picked upstream version 0.9.0+20150925. + * Cherry-picked upstream version 0.9.0+20151024. * Cleaned up debian/.gitignore * Switched to experimental because of LXQt namespace change * Added minimum version for liblxqt0-dev (>= 0.9.0+20150911) @@ -21,4 +21,4 @@ lxqt-panel (0.9.0+20150925-1) experimental; urgency=medium * Sorting build-depends. * Removing whitespaces at EOL and EOF. - -- Alf Gaida Sat, 26 Sep 2015 03:39:36 +0200 + -- Alf Gaida Sun, 25 Oct 2015 02:27:12 +0200 diff --git a/panel/config/addplugindialog.cpp b/panel/config/addplugindialog.cpp index 08573cf..0c75a64 100644 --- a/panel/config/addplugindialog.cpp +++ b/panel/config/addplugindialog.cpp @@ -97,10 +97,11 @@ void AddPluginDialog::filter() { const LXQt::PluginInfo &plugin = mPlugins.at(i); - QString s = QStringLiteral("%1 %2 %3 %4").arg(plugin.name(), + QString s = QStringLiteral("%1 %2 %3 %4 %5").arg(plugin.name(), plugin.comment(), plugin.value("Name").toString(), - plugin.value("Comment").toString()); + plugin.value("Comment").toString(), + plugin.id()); if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive)) continue; @@ -110,10 +111,10 @@ void AddPluginDialog::filter() { item->setFlags(item->flags() & ~Qt::ItemIsEnabled); item->setBackground(palette().brush(QPalette::Disabled, QPalette::Text)); - item->setText(QStringLiteral("%1
%2
%3") - .arg(plugin.name(), plugin.comment(), tr("(only one instance can run at a time)"))); + item->setText(QStringLiteral("%1 (%2)
%3
%4") + .arg(plugin.name(), plugin.id(), plugin.comment(), tr("(only one instance can run at a time)"))); } else - item->setText(QStringLiteral("%1
%2").arg(plugin.name(), plugin.comment())); + item->setText(QStringLiteral("%1 (%2)
%3").arg(plugin.name(), plugin.id(), plugin.comment())); item->setIcon(plugin.icon(fallIco)); item->setData(INDEX_ROLE, i); } diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index 950243e..d373689 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -35,7 +35,6 @@ #include "popupmenu.h" #include "plugin.h" #include "panelpluginsmodel.h" -#include #include #include @@ -112,8 +111,9 @@ QString LXQtPanel::positionToStr(ILXQtPanel::Position position) /************************************************ ************************************************/ -LXQtPanel::LXQtPanel(const QString &configGroup, QWidget *parent) : +LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidget *parent) : QFrame(parent), + mSettings(settings), mConfigGroup(configGroup), mPlugins{nullptr}, mPanelSize(0), @@ -123,6 +123,7 @@ LXQtPanel::LXQtPanel(const QString &configGroup, QWidget *parent) : mAlignment(AlignmentLeft), mPosition(ILXQtPanel::PositionBottom), mScreenNum(0), //whatever (avoid conditional on uninitialized value) + mActualScreenNum(0), mHidable(false), mHidden(false) { @@ -174,8 +175,6 @@ LXQtPanel::LXQtPanel(const QString &configGroup, QWidget *parent) : connect(LXQt::Settings::globalSettings(), SIGNAL(settingsChanged()), this, SLOT(update())); connect(lxqtApp, SIGNAL(themeChanged()), this, SLOT(realign())); - LXQtPanelApplication *app = reinterpret_cast(qApp); - mSettings = app->settings(); readSettings(); // the old position might be on a visible screen ensureVisible(); @@ -213,7 +212,8 @@ void LXQtPanel::readSettings() mSettings->value(CFG_KEY_PERCENT, true).toBool(), false); - setPosition(mSettings->value(CFG_KEY_SCREENNUM, QApplication::desktop()->primaryScreen()).toInt(), + mScreenNum = mSettings->value(CFG_KEY_SCREENNUM, QApplication::desktop()->primaryScreen()).toInt(); + setPosition(mScreenNum, strToPosition(mSettings->value(CFG_KEY_POSITION).toString(), PositionBottom), false); @@ -283,6 +283,8 @@ void LXQtPanel::ensureVisible() { if (!canPlacedOn(mScreenNum, mPosition)) setPosition(findAvailableScreen(mPosition), mPosition, true); + else + mActualScreenNum = mScreenNum; // the screen size might be changed, let's update the reserved screen space. updateWmStrut(); @@ -352,7 +354,7 @@ int LXQtPanel::getReserveDimension() void LXQtPanel::setPanelGeometry() { - const QRect currentScreen = QApplication::desktop()->screenGeometry(mScreenNum); + const QRect currentScreen = QApplication::desktop()->screenGeometry(mActualScreenNum); QRect rect; if (isHorizontal()) @@ -731,7 +733,7 @@ void LXQtPanel::setPosition(int screen, ILXQtPanel::Position position, bool save mPosition == position) return; - mScreenNum = screen; + mActualScreenNum = screen; mPosition = position; mLayout->setPosition(mPosition); diff --git a/panel/lxqtpanel.h b/panel/lxqtpanel.h index b939dfc..8ff4b8c 100644 --- a/panel/lxqtpanel.h +++ b/panel/lxqtpanel.h @@ -33,6 +33,7 @@ #include #include #include +#include #include "ilxqtpanel.h" #include "lxqtpanelglobals.h" @@ -59,6 +60,8 @@ class LXQT_PANEL_API LXQtPanel : public QFrame, public ILXQtPanel // for configuration dialog friend class ConfigPanelWidget; friend class ConfigPluginsWidget; + friend class ConfigPanelDialog; + friend class PanelPluginsModel; public: enum Alignment { @@ -67,7 +70,7 @@ public: AlignmentRight = 1 }; - LXQtPanel(const QString &configGroup, QWidget *parent = 0); + LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidget *parent = 0); virtual ~LXQtPanel(); QString name() { return mConfigGroup; } @@ -104,8 +107,6 @@ public: int opacity() const { return mOpacity; }; bool hidable() const { return mHidable; } - LXQt::Settings *settings() const { return mSettings; } - bool isPluginSingletonAndRunnig(QString const & pluginId) const; public slots: @@ -142,6 +143,7 @@ protected: public slots: void showConfigDialog(); + private slots: void showAddPluginDialog(); void realign(); @@ -173,7 +175,8 @@ private: Alignment mAlignment; ILXQtPanel::Position mPosition; - int mScreenNum; + int mScreenNum; //!< configured screen (user preference) + int mActualScreenNum; //!< panel currently shown at (if the configured screen is not available) QTimer mDelaySave; bool mHidable; bool mHidden; @@ -187,6 +190,9 @@ private: QPointer mConfigDialog; void updateStyleSheet(); + + // settings should be kept private for security + LXQt::Settings *settings() const { return mSettings; } }; diff --git a/panel/lxqtpanelapplication.cpp b/panel/lxqtpanelapplication.cpp index 261670f..8afc80e 100644 --- a/panel/lxqtpanelapplication.cpp +++ b/panel/lxqtpanelapplication.cpp @@ -107,11 +107,11 @@ void LXQtPanelApplication::addNewPanel() LXQtPanel* LXQtPanelApplication::addPanel(const QString& name) { - LXQtPanel *panel = new LXQtPanel(name); + LXQtPanel *panel = new LXQtPanel(name, mSettings); mPanels << panel; - connect(panel, SIGNAL(deletedByUser(LXQtPanel*)), - this, SLOT(removePanel(LXQtPanel*))); - //reemit signals + + // reemit signals + connect(panel, &LXQtPanel::deletedByUser, this, &LXQtPanelApplication::removePanel); connect(panel, &LXQtPanel::pluginAdded, this, &LXQtPanelApplication::pluginAdded); connect(panel, &LXQtPanel::pluginRemoved, this, &LXQtPanelApplication::pluginRemoved); diff --git a/panel/lxqtpanelapplication.h b/panel/lxqtpanelapplication.h index 62b1eae..a3fdcbd 100644 --- a/panel/lxqtpanelapplication.h +++ b/panel/lxqtpanelapplication.h @@ -47,7 +47,6 @@ public: ~LXQtPanelApplication(); int count() { return mPanels.count(); } - LXQt::Settings *settings() { return mSettings; } bool isPluginSingletonAndRunnig(QString const & pluginId) const; public slots: diff --git a/panel/panelpluginsmodel.cpp b/panel/panelpluginsmodel.cpp index 3d78dd7..1aa89b1 100644 --- a/panel/panelpluginsmodel.cpp +++ b/panel/panelpluginsmodel.cpp @@ -96,7 +96,7 @@ QStringList PanelPluginsModel::pluginNames() const QStringList names; for (auto const & p : mPlugins) names.append(p.first); - return std::move(names); + return names; } QList PanelPluginsModel::plugins() const @@ -105,7 +105,7 @@ QList PanelPluginsModel::plugins() const for (auto const & p : mPlugins) if (!p.second.isNull()) plugins.append(p.second.data()); - return std::move(plugins); + return plugins; } Plugin* PanelPluginsModel::pluginByName(QString name) const @@ -246,9 +246,19 @@ QString PanelPluginsModel::findNewPluginSettingsGroup(const QString &pluginType) groups.sort(); // Generate new section name - for (int i = 2; true; ++i) - if (!groups.contains(QStringLiteral("%1%2").arg(pluginType).arg(i))) - return QStringLiteral("%1%2").arg(pluginType).arg(i); + QString pluginName = QStringLiteral("%1").arg(pluginType); + + if (!groups.contains(pluginName)) + return pluginName; + else + { + for (int i = 2; true; ++i) + { + pluginName = QStringLiteral("%1%2").arg(pluginType).arg(i); + if (!groups.contains(pluginName)) + return pluginName; + } + } } void PanelPluginsModel::onActivatedIndex(QModelIndex const & index) diff --git a/panel/plugin.cpp b/panel/plugin.cpp index 51eccd2..86be4dc 100644 --- a/panel/plugin.cpp +++ b/panel/plugin.cpp @@ -50,15 +50,25 @@ // 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); @@ -119,9 +129,6 @@ Plugin::Plugin(const LXQt::PluginInfo &desktopFile, const QString &settingsFile, return; } - // Load plugin translations - LXQt::Translator::translatePlugin(desktopFile.id(), QLatin1String("lxqt-panel")); - setObjectName(mPlugin->themeId() + "Plugin"); // plugin handle for easy context menu @@ -185,50 +192,52 @@ namespace { //helper types for static plugins storage & binary search typedef std::unique_ptr plugin_ptr_t; - typedef std::pair plugin_pair_t; + typedef std::tuple plugin_tuple_t; //NOTE: Please keep the plugins sorted by name while adding new plugins. - static plugin_pair_t const static_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) - { QStringLiteral("clock"), plugin_ptr_t{new LXQtClockPluginLibrary} },// clock + std::make_tuple(QStringLiteral("clock"), plugin_ptr_t{new LXQtClockPluginLibrary}, loadPluginTranslation_clock_helper),// clock #endif #if defined(WITH_DESKTOPSWITCH_PLUGIN) - { QStringLiteral("desktopswitch"), plugin_ptr_t{new DesktopSwitchPluginLibrary} },// desktopswitch + std::make_tuple(QStringLiteral("desktopswitch"), plugin_ptr_t{new DesktopSwitchPluginLibrary}, loadPluginTranslation_desktopswitch_helper),// desktopswitch #endif #if defined(WITH_MAINMENU_PLUGIN) - { QStringLiteral("mainmenu"), plugin_ptr_t{new LXQtMainMenuPluginLibrary} },// mainmenu + std::make_tuple(QStringLiteral("mainmenu"), plugin_ptr_t{new LXQtMainMenuPluginLibrary}, loadPluginTranslation_mainmenu_helper),// mainmenu #endif #if defined(WITH_QUICKLAUNCH_PLUGIN) - { QStringLiteral("quicklaunch"), plugin_ptr_t{new LXQtQuickLaunchPluginLibrary} },// quicklaunch + std::make_tuple(QStringLiteral("quicklaunch"), plugin_ptr_t{new LXQtQuickLaunchPluginLibrary}, loadPluginTranslation_quicklaunch_helper),// quicklaunch #endif #if defined(WITH_SHOWDESKTOP_PLUGIN) - { QStringLiteral("showdesktop"), plugin_ptr_t{new ShowDesktopLibrary} },// showdesktop + std::make_tuple(QStringLiteral("showdesktop"), plugin_ptr_t{new ShowDesktopLibrary}, loadPluginTranslation_showdesktop_helper),// showdesktop #endif #if defined(WITH_SPACER_PLUGIN) - { QStringLiteral("spacer"), plugin_ptr_t{new SpacerPluginLibrary} },// spacer + std::make_tuple(QStringLiteral("spacer"), plugin_ptr_t{new SpacerPluginLibrary}, loadPluginTranslation_spacer_helper),// spacer #endif #if defined(WITH_STATUSNOTIFIER_PLUGIN) - { QStringLiteral("statusnotifier"), plugin_ptr_t{new StatusNotifierLibrary} },// statusnotifier + std::make_tuple(QStringLiteral("statusnotifier"), plugin_ptr_t{new StatusNotifierLibrary}, loadPluginTranslation_statusnotifier_helper),// statusnotifier #endif #if defined(WITH_TASKBAR_PLUGIN) - { QStringLiteral("taskbar"), plugin_ptr_t{new LXQtTaskBarPluginLibrary} },// taskbar + std::make_tuple(QStringLiteral("taskbar"), plugin_ptr_t{new LXQtTaskBarPluginLibrary}, loadPluginTranslation_taskbar_helper),// taskbar #endif #if defined(WITH_TRAY_PLUGIN) - { QStringLiteral("tray"), plugin_ptr_t{new LXQtTrayPluginLibrary} },// tray + std::make_tuple(QStringLiteral("tray"), plugin_ptr_t{new LXQtTrayPluginLibrary}, loadPluginTranslation_tray_helper),// tray #endif #if defined(WITH_WORLDCLOCK_PLUGIN) - { QStringLiteral("worldclock"), plugin_ptr_t{new LXQtWorldClockLibrary} },// worldclock + std::make_tuple(QStringLiteral("worldclock"), plugin_ptr_t{new LXQtWorldClockLibrary}, loadPluginTranslation_worldclock_helper),// worldclock #endif }; - static constexpr plugin_pair_t const * const plugins_begin = static_plugins; - static constexpr plugin_pair_t const * const plugins_end = static_plugins + sizeof (static_plugins) / sizeof (static_plugins[0]); + 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_pair_t const & p1, plugin_pair_t const & p2) -> bool { return p1.first < p2.first; })); + , [] (plugin_tuple_t const & p1, plugin_tuple_t const & p2) -> bool { return std::get<0>(p1) < std::get<0>(p2); })); } }; static assert_helper h; @@ -237,10 +246,10 @@ namespace ILXQtPanelPluginLibrary const * Plugin::findStaticPlugin(const QString &libraryName) { // find a static plugin library by name -> binary search - plugin_pair_t const * plugin = std::lower_bound(plugins_begin, plugins_end, libraryName - , [] (plugin_pair_t const & plugin, QString const & name) -> bool { return plugin.first < name; }); - if (plugins_end != plugin && libraryName == plugin->first) - return plugin->second.get(); + 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; } diff --git a/plugin-clock/calendarpopup.cpp b/plugin-clock/calendarpopup.cpp index 6866302..0203ecf 100644 --- a/plugin-clock/calendarpopup.cpp +++ b/plugin-clock/calendarpopup.cpp @@ -30,7 +30,7 @@ #include CalendarPopup::CalendarPopup(QWidget *parent): - QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint) + QDialog(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint) { setLayout(new QHBoxLayout(this)); layout()->setMargin(1); @@ -51,14 +51,6 @@ void CalendarPopup::show() QDialog::show(); } -bool CalendarPopup::event(QEvent *event) -{ - if (event->type() == QEvent::WindowDeactivate) - hide(); - - return QDialog::event(event); -} - void CalendarPopup::setFirstDayOfWeek(Qt::DayOfWeek wday) { cal->setFirstDayOfWeek(wday); diff --git a/plugin-clock/calendarpopup.h b/plugin-clock/calendarpopup.h index cf52392..a40b89b 100644 --- a/plugin-clock/calendarpopup.h +++ b/plugin-clock/calendarpopup.h @@ -42,9 +42,6 @@ public: void show(); -protected: - virtual bool event(QEvent* ); - private: QCalendarWidget *cal; }; diff --git a/plugin-kbindicator/src/content.cpp b/plugin-kbindicator/src/content.cpp index dfaaf88..12bf29a 100644 --- a/plugin-kbindicator/src/content.cpp +++ b/plugin-kbindicator/src/content.cpp @@ -40,20 +40,23 @@ Content::Content(bool layoutEnabled): box->setSpacing(0); setLayout(box); - m_capsLock = new QLabel("C"); + m_capsLock = new QLabel(tr("C", "Label for CapsLock indicator")); m_capsLock->setObjectName("CapsLockLabel"); m_capsLock->setAlignment(Qt::AlignCenter); + m_capsLock->setToolTip(tr("CapsLock", "Tooltip for CapsLock indicator")); m_capsLock->installEventFilter(this); layout()->addWidget(m_capsLock); - m_numLock = new QLabel("N"); + m_numLock = new QLabel(tr("N", "Label for NumLock indicator")); m_numLock->setObjectName("NumLockLabel"); + m_numLock->setToolTip(tr("NumLock", "Tooltip for NumLock indicator")); m_numLock->setAlignment(Qt::AlignCenter); m_numLock->installEventFilter(this); layout()->addWidget(m_numLock); - m_scrollLock = new QLabel("S"); + m_scrollLock = new QLabel(tr("S", "Label for ScrollLock indicator")); m_scrollLock->setObjectName("ScrollLockLabel"); + m_scrollLock->setToolTip(tr("ScrollLock", "Tooltip for ScrollLock indicator")); m_scrollLock->setAlignment(Qt::AlignCenter); m_scrollLock->installEventFilter(this); layout()->addWidget(m_scrollLock); diff --git a/plugin-kbindicator/translations/kbindicator.ts b/plugin-kbindicator/translations/kbindicator.ts index 26dc157..140fdbd 100644 --- a/plugin-kbindicator/translations/kbindicator.ts +++ b/plugin-kbindicator/translations/kbindicator.ts @@ -4,12 +4,48 @@ Content - + + C + Label for CapsLock indicator + + + + + CapsLock + Tooltip for CapsLock indicator + + + + + N + Label for NumLock indicator + + + + + NumLock + Tooltip for NumLock indicator + + + + + S + Label for ScrollLock indicator + + + + + ScrollLock + Tooltip for ScrollLock indicator + + + + Layout - + Variant @@ -18,12 +54,12 @@ KbdStateConfig - Dialog + Keyboard indicator settings - Leds + LEDs @@ -73,7 +109,7 @@ - Configure layouts + Configure layouts... diff --git a/plugin-kbindicator/translations/kbindicator_de.ts b/plugin-kbindicator/translations/kbindicator_de.ts index e0060a8..a4dd6f7 100644 --- a/plugin-kbindicator/translations/kbindicator_de.ts +++ b/plugin-kbindicator/translations/kbindicator_de.ts @@ -4,12 +4,51 @@ Content - + + C + Label for CapsLock indicator + This capital letter is printed on my keyboard. + A + + + + CapsLock + Tooltip for CapsLock indicator + Großbuchstaben + + + + N + Label for NumLock indicator + This digit is printed on my keyboard. + 1 + + + + NumLock + Tooltip for NumLock indicator + Ziffern + + + + S + Label for ScrollLock indicator + From the word "Rollen". + R + + + + ScrollLock + Tooltip for ScrollLock indicator + Rollen + + + Layout Layout - + Variant Variante @@ -18,13 +57,13 @@ KbdStateConfig - Dialog - Tastatur + Keyboard state settings + Tastaturstatus - Einstellungen - Leds - LEDs + Lock Indicators + Schalteranzeigen @@ -42,39 +81,34 @@ Rollen-Taste anzeigen - - Show keyboard layout + + Keyboard Layout Indicator Tastatur-Layout anzeigen - - Show flags instead labels - Flaggen statt Kennung anzeigen + + Switching policy + Umschaltrichtlinie - - Layout mode: - Layout-Modus: + + Configure layouts + Layout konfigurieren - + Global Global - + Window Fenster - + Application Anwendung - - - Configure layouts - Layout konfigurieren... - diff --git a/plugin-mount/popup.cpp b/plugin-mount/popup.cpp index 7f498e9..1c3e7c1 100644 --- a/plugin-mount/popup.cpp +++ b/plugin-mount/popup.cpp @@ -53,7 +53,7 @@ static bool hasRemovableParent(Solid::Device device) } Popup::Popup(ILXQtPanelPlugin * plugin, QWidget* parent): - QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint), + QDialog(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint), mPlugin(plugin), mPlaceholder(nullptr), mDisplayCount(0) diff --git a/plugin-statusnotifier/CMakeLists.txt b/plugin-statusnotifier/CMakeLists.txt index 9a2b26d..a3ed684 100644 --- a/plugin-statusnotifier/CMakeLists.txt +++ b/plugin-statusnotifier/CMakeLists.txt @@ -1,7 +1,7 @@ set(PLUGIN "statusnotifier") -find_package(dbusmenu-qt5 REQUIRED QUIET) +find_package(dbusmenu-qt5 REQUIRED) set(HEADERS statusnotifier.h @@ -30,7 +30,6 @@ qt5_add_dbus_adaptor(SOURCES ) set(LIBRARIES - lxqt dbusmenu-qt5 ) diff --git a/plugin-sysstat/lxqtsysstatconfiguration.cpp b/plugin-sysstat/lxqtsysstatconfiguration.cpp index f8cf23f..8075adc 100644 --- a/plugin-sysstat/lxqtsysstatconfiguration.cpp +++ b/plugin-sysstat/lxqtsysstatconfiguration.cpp @@ -53,6 +53,7 @@ namespace { const char * loc; loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu"); + loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu0"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu1"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu2"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu3"); @@ -62,6 +63,7 @@ namespace loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu7"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu8"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu9"); + loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu10"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu11"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu12"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu13"); @@ -75,7 +77,6 @@ namespace loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu21"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu22"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu23"); - loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "cpu24"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "memory"); loc = QT_TRANSLATE_NOOP("LXQtSysStatConfiguration", "swap"); static_cast(t);//avoid unused variable warning diff --git a/plugin-sysstat/translations/sysstat.ts b/plugin-sysstat/translations/sysstat.ts index 2cccbab..5f5dc25 100644 --- a/plugin-sysstat/translations/sysstat.ts +++ b/plugin-sysstat/translations/sysstat.ts @@ -1,6 +1,6 @@ - + LXQtSysStatColours @@ -113,11 +113,41 @@ LXQtSysStatConfiguration + + + System Statistics Settings + + Graph + + + &Minimal size + + + + + Update &interval + + + + + &Title + + + + + &Grid lines + + + + + <html><head/><body><p>Minimal width if the panel is horizontal.</p><p>Minimal height is the panel is vertical.</p></body></html> + + px @@ -134,103 +164,241 @@ - - System Statistics Settings + + Use &frequency - - &Minimal size + + Ma&ximum - - Update &interval + + XXX KBs - - &Title + + Lo&garithmic scale - - &Grid lines + + steps - - <html><head/><body><p>Minimal width if the panel is horizontal.</p><p>Minimal height is the panel is vertical.</p></body></html> + + &Source - - Use &frequency + + T&ype - - Ma&ximum + + Colours - - Lo&garithmic scale + + Use t&heme colours + + + + + Use c&ustom colours - + + Custom colour ... + + + + CPU - + Memory - + Network - - &Source + + cpu - - T&ype + + cpu0 - - Colours + + cpu1 - - Use t&heme colours + + cpu2 - - Use c&ustom colours + + cpu3 - - Custom colour ... + + cpu4 - - XXX KBs + + cpu5 - - steps + + cpu6 + + + + + cpu7 + + + + + cpu8 + + + + + cpu9 + + + + + cpu10 + + + + + cpu11 + + + + + cpu12 + + + + + cpu13 + + + + + cpu14 + + + + + cpu15 + + + + + cpu16 + + + + + cpu17 + + + + + cpu18 + + + + + cpu19 + + + + + cpu20 + + + + + cpu21 + + + + + cpu22 + + + + + cpu23 + + + + + memory + + + + + swap + + + + + LXQtSysStatContent + + + system: %1%<br>user: %2%<br>nice: %3%<br>other: %4%<br>freq: %5% + CPU tooltip information + + + + + system: %1%<br>user: %2%<br>nice: %3%<br>other: %4%<br>freq: n/a + CPU tooltip information + + + + + apps: %1%<br>buffers: %2%<br>cached: %3% + Memory tooltip information + + + + + used: %1% + Swap tooltip information + + + + + min: %1%<br>max: %2% + Network tooltip information diff --git a/plugin-sysstat/translations/sysstat_de.ts b/plugin-sysstat/translations/sysstat_de.ts index 14c1e90..32baedb 100644 --- a/plugin-sysstat/translations/sysstat_de.ts +++ b/plugin-sysstat/translations/sysstat_de.ts @@ -189,49 +189,217 @@ Schritte - - CPU - Prozessor - - - - Memory - Speicher - - - - Network - Netzwerk - - - + &Source &Quelle - + T&ype T&yp - + Colours Farben - + Use t&heme colours Farben des Farbsc&hemas - + Use c&ustom colours &Eigene Farben - + Custom colour ... auswählen... + + + CPU + Prozessor + + + + Memory + Speicher + + + + Network + Netzwerk + + + + cpu + CPU + + + + cpu0 + CPU0 + + + + cpu1 + CPU1 + + + + cpu2 + CPU2 + + + + cpu3 + CPU3 + + + + cpu4 + CPU4 + + + + cpu5 + CPU5 + + + + cpu6 + CPU6 + + + + cpu7 + CPU7 + + + + cpu8 + CPU8 + + + + cpu9 + CPU9 + + + + cpu10 + CPU10 + + + + cpu11 + CPU11 + + + + cpu12 + CPU12 + + + + cpu13 + CPU13 + + + + cpu14 + CPU14 + + + + cpu15 + CPU15 + + + + cpu16 + CPU16 + + + + cpu17 + CPU17 + + + + cpu18 + CPU18 + + + + cpu19 + CPU19 + + + + cpu20 + CPU20 + + + + cpu21 + CPU21 + + + + cpu22 + CPU22 + + + + cpu23 + CPU23 + + + + memory + Speicher + + + + swap + Ausgelagert + + + + LXQtSysStatContent + + + system: %1%<br>user: %2%<br>nice: %3%<br>other: %4%<br>freq: %5% + CPU tooltip information + System: %1%<br>Nutzer: %2%<br>Priorität: %3%<br>Andere: %4%<br>Freq: %5% + + + + system: %1%<br>user: %2%<br>nice: %3%<br>other: %4%<br>freq: n/a + CPU tooltip information + System: %1%<br>Nutzer: %2%<br>Priorität: %3%<br>Andere: %4%<br>Freq: n/a + + + + apps: %1%<br>buffers: %2%<br>cached: %3% + Memory tooltip information + Anwendungen: %1%<br>Puffer: %2%<br>Cache: %3% + + + + used: %1% + Swap tooltip information + Benutzt: %1% + + + + min: %1%<br>max: %2% + Network tooltip information + Min: %1%<br>Max: %2% + diff --git a/plugin-taskbar/lxqtgrouppopup.cpp b/plugin-taskbar/lxqtgrouppopup.cpp index 69950a2..e7db7fc 100644 --- a/plugin-taskbar/lxqtgrouppopup.cpp +++ b/plugin-taskbar/lxqtgrouppopup.cpp @@ -67,12 +67,11 @@ LXQtGroupPopup::~LXQtGroupPopup() void LXQtGroupPopup::dropEvent(QDropEvent *event) { qlonglong temp; - WId window; QDataStream stream(event->mimeData()->data(LXQtTaskButton::mimeDataFormat())); stream >> temp; - window = (WId) temp; + WId window = (WId) temp; - LXQtTaskButton *button; + LXQtTaskButton *button = nullptr; int oldIndex(0); // get current position of the button being dragged for (int i = 0; i < layout()->count(); i++) @@ -86,6 +85,9 @@ void LXQtGroupPopup::dropEvent(QDropEvent *event) } } + if (button == nullptr) + return; + int newIndex = -1; // find the new position to place it in for (int i = 0; i < oldIndex && newIndex == -1; i++) @@ -109,6 +111,7 @@ void LXQtGroupPopup::dropEvent(QDropEvent *event) l->takeAt(oldIndex); l->insertWidget(newIndex, button); l->invalidate(); + } void LXQtGroupPopup::dragEnterEvent(QDragEnterEvent *event) diff --git a/plugin-taskbar/lxqttaskbar.cpp b/plugin-taskbar/lxqttaskbar.cpp index 2410be3..f7c024b 100644 --- a/plugin-taskbar/lxqttaskbar.cpp +++ b/plugin-taskbar/lxqttaskbar.cpp @@ -140,8 +140,10 @@ bool LXQtTaskBar::acceptWindow(WId window) const void LXQtTaskBar::dragEnterEvent(QDragEnterEvent* event) { if (event->mimeData()->hasFormat(LXQtTaskGroup::mimeDataFormat())) + { event->acceptProposedAction(); - else + buttonMove(nullptr, LXQtTaskGroup::mimeDataData(event->mimeData()), event->pos()); + } else event->ignore(); QWidget::dragEnterEvent(event); } @@ -149,56 +151,70 @@ void LXQtTaskBar::dragEnterEvent(QDragEnterEvent* event) /************************************************ ************************************************/ -void LXQtTaskBar::dropEvent(QDropEvent* event) +void LXQtTaskBar::dragMoveEvent(QDragMoveEvent * event) { - if (!event->mimeData()->hasFormat(LXQtTaskGroup::mimeDataFormat())) - { - event->ignore(); - return; - } + //we don't get any dragMoveEvents if dragEnter wasn't accepted + buttonMove(nullptr, LXQtTaskGroup::mimeDataData(event->mimeData()), event->pos()); + QWidget::dragMoveEvent(event); +} - QString data; - QDataStream stream(event->mimeData()->data(LXQtTaskGroup::mimeDataFormat())); - stream >> data; +/************************************************ - LXQtTaskGroup *group = mGroupsHash.value(data, NULL); - if (!group) + ************************************************/ +void LXQtTaskBar::buttonMove(LXQtTaskGroup * dst, QString const & srcWindow, QPoint const & pos) +{ + LXQtTaskGroup *src_group = mGroupsHash.value(srcWindow, nullptr); + if (!src_group) { qDebug() << "Dropped invalid"; return; } - int droppedIndex = mLayout->indexOf(group); - int newPos = -1; + const int src_index = mLayout->indexOf(src_group); const int size = mLayout->count(); - if (mPlugin->panel()->isHorizontal()) + Q_ASSERT(0 < size); + //dst is nullptr in case the drop occured on empty space in taskbar + int dst_index; + if (nullptr == dst) { - for (int i = 0; i < droppedIndex && newPos == -1; i++) - if (mLayout->itemAt(i)->widget()->x() + mLayout->itemAt(i)->widget()->width() / 2 > event->pos().x()) - newPos = i; + //moving based on taskbar (not signaled by button) + QRect occupied = mLayout->occupiedGeometry(); + QRect last_empty_row{occupied}; + if (mPlugin->panel()->isHorizontal()) + { + last_empty_row.setTopLeft(mLayout->itemAt(size - 1)->geometry().topRight()); + } else + { + last_empty_row.setTopLeft(mLayout->itemAt(size - 1)->geometry().bottomLeft()); + } - for (int i = size - 1; i > droppedIndex && newPos == -1; i--) - if (mLayout->itemAt(i)->widget()->x() + mLayout->itemAt(i)->widget()->width() / 2 < event->pos().x()) - newPos = i; - } - else - { - for (int i = 0; i < droppedIndex && newPos == -1; i++) - if (mLayout->itemAt(i)->widget()->y() + mLayout->itemAt(i)->widget()->height() / 2 > event->pos().y()) - newPos = i; + if (occupied.contains(pos) && !last_empty_row.contains(pos)) + return; - for (int i = size - 1; i > droppedIndex && newPos == -1; i--) - if (mLayout->itemAt(i)->widget()->y() + mLayout->itemAt(i)->widget()->height() / 2 < event->pos().y()) - newPos = i; + dst_index = size; + } else + { + //moving based on signal from child button + dst_index = mLayout->indexOf(dst); + if (mPlugin->panel()->isHorizontal()) + { + if (dst->rect().center().x() < pos.x()) + ++dst_index; + } else + { + if (dst->rect().center().y() < pos.y()) + ++dst_index; + } } - if (newPos == -1 || droppedIndex == newPos) - return; + //moving lower index to higher one => consider as the QList::move => insert(to, takeAt(from)) + if (src_index < dst_index) + --dst_index; - mLayout->moveItem(droppedIndex, newPos); - mLayout->invalidate(); + if (dst_index == src_index) + return; - QWidget::dropEvent(event); + mLayout->moveItem(src_index, dst_index, true); } /************************************************ @@ -229,6 +245,9 @@ void LXQtTaskBar::addWindow(WId window, QString const & groupId) connect(group, SIGNAL(visibilityChanged(bool)), this, SLOT(refreshPlaceholderVisibility())); connect(group, &LXQtTaskGroup::popupShown, this, &LXQtTaskBar::groupPopupShown); connect(group, SIGNAL(windowDisowned(WId)), this, SLOT(refreshTaskList())); + connect(group, &LXQtTaskButton::dragging, this, [this] (QString const & mimeWindow, QPoint const & pos) { + buttonMove(qobject_cast(sender()), mimeWindow, pos); + }); mLayout->addWidget(group); mGroupsHash.insert(groupId, group); diff --git a/plugin-taskbar/lxqttaskbar.h b/plugin-taskbar/lxqttaskbar.h index a2ffefc..43635c8 100644 --- a/plugin-taskbar/lxqttaskbar.h +++ b/plugin-taskbar/lxqttaskbar.h @@ -82,7 +82,7 @@ public slots: protected: virtual void dragEnterEvent(QDragEnterEvent * event); - virtual void dropEvent(QDropEvent * event); + virtual void dragMoveEvent(QDragMoveEvent * event); private slots: void refreshIconGeometry(); @@ -95,6 +95,7 @@ private slots: private: void addWindow(WId window, QString const & groupId); + void buttonMove(LXQtTaskGroup * dst, QString const & srcWindow, QPoint const & pos); private: QHash mGroupsHash; diff --git a/plugin-taskbar/lxqttaskbutton.cpp b/plugin-taskbar/lxqttaskbutton.cpp index ef835a0..36c35e9 100644 --- a/plugin-taskbar/lxqttaskbutton.cpp +++ b/plugin-taskbar/lxqttaskbutton.cpp @@ -70,6 +70,17 @@ void LeftAlignedTextStyle::drawItemText(QPainter * painter, const QRect & rect, } +/************************************************ + +************************************************/ +QString LXQtTaskButton::mimeDataData(QMimeData const * mime) +{ + QString data; + QDataStream stream(mime->data(mimeDataFormat())); + stream >> data; + return data; +} + /************************************************ ************************************************/ @@ -157,31 +168,44 @@ void LXQtTaskButton::refreshIconGeometry(QRect const & geom) ************************************************/ void LXQtTaskButton::dragEnterEvent(QDragEnterEvent *event) { + // It must be here otherwise dragLeaveEvent and dragMoveEvent won't be called + // on the other hand drop and dragmove events of parent widget won't be called + event->acceptProposedAction(); if (event->mimeData()->hasFormat(mimeDataFormat())) { - event->ignore(); - return; + emit dragging(mimeDataData(event->mimeData()), event->pos()); + setAttribute(Qt::WA_UnderMouse, false); + } else + { + mDNDTimer->start(); } - mDNDTimer->start(); - - // It must be here otherwise dragLeaveEvent and dragMoveEvent won't be called - // on the other hand drop and dragmove events of parent widget won't be called - event->accept(); QToolButton::dragEnterEvent(event); } +void LXQtTaskButton::dragMoveEvent(QDragMoveEvent * event) +{ + if (event->mimeData()->hasFormat(mimeDataFormat())) + { + emit dragging(mimeDataData(event->mimeData()), event->pos()); + setAttribute(Qt::WA_UnderMouse, false); + } +} + void LXQtTaskButton::dragLeaveEvent(QDragLeaveEvent *event) { mDNDTimer->stop(); - event->ignore(); QToolButton::dragLeaveEvent(event); } void LXQtTaskButton::dropEvent(QDropEvent *event) { mDNDTimer->stop(); - event->ignore(); + if (event->mimeData()->hasFormat(mimeDataFormat())) + { + emit dropped(mimeDataData(event->mimeData()), event->pos()); + setAttribute(Qt::WA_UnderMouse, false); + } QToolButton::dropEvent(event); } @@ -241,12 +265,8 @@ void LXQtTaskButton::mouseMoveEvent(QMouseEvent* event) QDrag *drag = new QDrag(this); drag->setMimeData(mimeData()); - - //fixme when vertical panel, pixmap is empty - QPixmap pixmap = grab(); - drag->setPixmap(pixmap); - drag->setHotSpot(QPoint(mapTo(this, event->pos()))); - + QIcon ico = icon(); + drag->setPixmap(ico.pixmap(ico.actualSize({32, 32}))); sDraggging = true; drag->exec(); diff --git a/plugin-taskbar/lxqttaskbutton.h b/plugin-taskbar/lxqttaskbutton.h index 3aaffbc..d083199 100644 --- a/plugin-taskbar/lxqttaskbutton.h +++ b/plugin-taskbar/lxqttaskbutton.h @@ -85,6 +85,7 @@ public: void refreshIconGeometry(QRect const & geom); static QString mimeDataFormat() { return QLatin1String("lxqt/lxqttaskbutton"); } + static QString mimeDataData(QMimeData const * mime); /*! \return true if this buttom received DragEnter event (and no DragLeave event yet) * */ bool hasDragAndDropHover() const; @@ -104,6 +105,7 @@ public slots: protected: virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dragMoveEvent(QDragMoveEvent * event); virtual void dragLeaveEvent(QDragLeaveEvent *event); virtual void dropEvent(QDropEvent *event); void mousePressEvent(QMouseEvent *event); @@ -134,8 +136,8 @@ private slots: void activateWithDraggable(); signals: - void dropped(QDropEvent * event); - void dragging(bool executing = false); + void dropped(QString const & mimeWindow, QPoint const & pos); + void dragging(QString const & mimeWindow, QPoint const & pos); }; typedef QHash LXQtTaskButtonHash; diff --git a/plugin-taskbar/lxqttaskgroup.cpp b/plugin-taskbar/lxqttaskgroup.cpp index 081bf77..aee94d0 100644 --- a/plugin-taskbar/lxqttaskgroup.cpp +++ b/plugin-taskbar/lxqttaskgroup.cpp @@ -550,13 +550,12 @@ void LXQtTaskGroup::enterEvent(QEvent *event) ************************************************/ void LXQtTaskGroup::dragEnterEvent(QDragEnterEvent *event) { - sDraggging = true; // only show the popup if we aren't dragging a taskgroup if (!event->mimeData()->hasFormat(mimeDataFormat())) { setPopupVisible(true); - LXQtTaskButton::dragEnterEvent(event); } + LXQtTaskButton::dragEnterEvent(event); } /************************************************ @@ -568,8 +567,6 @@ void LXQtTaskGroup::dragLeaveEvent(QDragLeaveEvent *event) // do not close the popup if (!sDraggging) setPopupVisible(false); - else - sDraggging = false; LXQtTaskButton::dragLeaveEvent(event); } diff --git a/plugin-taskbar/lxqttaskgroup.h b/plugin-taskbar/lxqttaskgroup.h index 8097453..f95cfbd 100644 --- a/plugin-taskbar/lxqttaskgroup.h +++ b/plugin-taskbar/lxqttaskgroup.h @@ -73,8 +73,6 @@ public: void setPopupVisible(bool visible = true, bool fast = false); - static QString mimeDataFormat() { return QLatin1String("lxqt/lxqttaskgroup"); } - protected: QMimeData * mimeData(); diff --git a/plugin-worldclock/lxqtworldclock.cpp b/plugin-worldclock/lxqtworldclock.cpp index 05f8a3c..7386049 100644 --- a/plugin-worldclock/lxqtworldclock.cpp +++ b/plugin-worldclock/lxqtworldclock.cpp @@ -542,7 +542,7 @@ void ActiveLabel::mouseReleaseEvent(QMouseEvent* event) } LXQtWorldClockPopup::LXQtWorldClockPopup(QWidget *parent) : - QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint) + QDialog(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::Popup | Qt::X11BypassWindowManagerHint) { setLayout(new QHBoxLayout(this)); layout()->setMargin(1); @@ -556,7 +556,7 @@ void LXQtWorldClockPopup::show() bool LXQtWorldClockPopup::event(QEvent *event) { - if (event->type() == QEvent::WindowDeactivate) + if (event->type() == QEvent::Close) emit deactivated(); return QDialog::event(event);