Merge branch 'master' into sebas/hidpi
This commit is contained in:
commit
a2baa1c7c7
@ -24,6 +24,7 @@ set(corebindings_SRCS
|
||||
dialog.cpp
|
||||
tooltip.cpp
|
||||
tooltipdialog.cpp
|
||||
formats.cpp
|
||||
serviceoperationstatus.cpp
|
||||
dataenginebindings.cpp
|
||||
iconitem.cpp
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "theme.h"
|
||||
#include "dialog.h"
|
||||
#include "iconitem.h"
|
||||
#include "formats.h"
|
||||
#include "serviceoperationstatus.h"
|
||||
|
||||
#include "tooltip.h"
|
||||
@ -97,6 +98,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
|
||||
qRegisterMetaType<Plasma::Service*>("Service");
|
||||
qmlRegisterInterface<Plasma::ServiceJob>("ServiceJob");
|
||||
qRegisterMetaType<Plasma::ServiceJob*>("ServiceJob");
|
||||
qmlRegisterType<Formats>(uri, 2, 0, "Formats");
|
||||
qmlRegisterType<ServiceOperationStatus>(uri, 2, 0, "ServiceOperationStatus");
|
||||
qmlRegisterType<QAbstractItemModel>();
|
||||
#if 0
|
||||
|
@ -191,13 +191,16 @@ void DialogProxy::updateVisibility(bool visible)
|
||||
raise();
|
||||
KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
|
||||
if (m_type != Normal) {
|
||||
KWindowSystem::setType(winId(), (NET::WindowType)m_type);
|
||||
} else {
|
||||
setFlags(Qt::FramelessWindowHint|flags());
|
||||
}
|
||||
if (m_type == Dock) {
|
||||
KWindowSystem::setOnAllDesktops(winId(), true);
|
||||
} else {
|
||||
KWindowSystem::setOnAllDesktops(winId(), false);
|
||||
}
|
||||
setFlags(Qt::FramelessWindowHint|flags());
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,6 +354,11 @@ void DialogProxy::syncMainItemToSize()
|
||||
m_frameSvgItem->setWidth(width());
|
||||
m_frameSvgItem->setHeight(height());
|
||||
KWindowEffects::enableBlurBehind(winId(), true, m_frameSvgItem->frameSvg()->mask());
|
||||
if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) {
|
||||
KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7, m_frameSvgItem->frameSvg()->mask());
|
||||
} else {
|
||||
KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7, m_frameSvgItem->frameSvg()->mask());
|
||||
}
|
||||
|
||||
if (m_mainItem) {
|
||||
m_mainItem.data()->setX(m_frameSvgItem->margins()->left());
|
||||
@ -394,7 +402,11 @@ void DialogProxy::setType(WindowType type)
|
||||
}
|
||||
|
||||
m_type = type;
|
||||
if (m_type != Normal) {
|
||||
KWindowSystem::setType(winId(), (NET::WindowType)type);
|
||||
} else {
|
||||
setFlags(Qt::FramelessWindowHint|flags());
|
||||
}
|
||||
|
||||
if (type == Dock) {
|
||||
KWindowSystem::setOnAllDesktops(winId(), true);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QPoint>
|
||||
|
||||
#include <Plasma/Plasma>
|
||||
#include <Plasma/Theme>
|
||||
|
||||
#include <netwm_def.h>
|
||||
|
||||
@ -175,6 +176,7 @@ private:
|
||||
WindowType m_type;
|
||||
bool m_hideOnWindowDeactivate;
|
||||
bool m_outputOnly;
|
||||
Plasma::Theme m_theme;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
57
src/declarativeimports/core/formats.cpp
Normal file
57
src/declarativeimports/core/formats.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2014 Bhushan Shah <bhush94@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License or (at your option) version 3 or any later version
|
||||
* accepted by the membership of KDE e.V. (or its successor approved
|
||||
* by the membership of KDE e.V.), which shall act as a proxy
|
||||
* defined in Section 14 of version 3 of the license.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "formats.h"
|
||||
|
||||
Formats::Formats(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_format()
|
||||
{
|
||||
}
|
||||
|
||||
QString Formats::formatByteSize(double size, int precision) const
|
||||
{
|
||||
return m_format.formatByteSize(size, precision);
|
||||
}
|
||||
|
||||
QString Formats::formatDuration(quint64 msecs) const
|
||||
{
|
||||
return m_format.formatDuration(msecs);
|
||||
}
|
||||
|
||||
QString Formats::formatDecimalDuration(quint64 msecs, int decimalPlaces) const
|
||||
{
|
||||
return m_format.formatDecimalDuration(msecs, decimalPlaces);
|
||||
}
|
||||
|
||||
QString Formats::formatSpelloutDuration(quint64 msecs) const
|
||||
{
|
||||
return m_format.formatSpelloutDuration(msecs);
|
||||
}
|
||||
|
||||
QString Formats::formatRelativeDate(const QDate &date, QLocale::FormatType format) const
|
||||
{
|
||||
return m_format.formatRelativeDate(date, format);
|
||||
}
|
||||
|
||||
QString Formats::formatRelativeDateTime(const QDateTime &dateTime, QLocale::FormatType format) const
|
||||
{
|
||||
return m_format.formatRelativeDateTime(dateTime, format);
|
||||
}
|
103
src/declarativeimports/core/formats.h
Normal file
103
src/declarativeimports/core/formats.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2014 Bhushan Shah <bhush94@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License or (at your option) version 3 or any later version
|
||||
* accepted by the membership of KDE e.V. (or its successor approved
|
||||
* by the membership of KDE e.V.), which shall act as a proxy
|
||||
* defined in Section 14 of version 3 of the license.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#ifndef FORMATS_H
|
||||
#define FORMATS_H
|
||||
|
||||
#include <KFormat>
|
||||
|
||||
class Formats : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit Formats (QObject* parent = 0);
|
||||
|
||||
/**
|
||||
* Converts size from bytes to the appropriate string representation
|
||||
*/
|
||||
Q_INVOKABLE QString formatByteSize(double size, int precision = 1) const;
|
||||
|
||||
/**
|
||||
* Given a number of milliseconds, converts that to a string containing
|
||||
* the localized equivalent, e.g. 1:23:45
|
||||
*/
|
||||
Q_INVOKABLE QString formatDuration(quint64 msecs) const;
|
||||
|
||||
/**
|
||||
* Given a number of milliseconds, converts that to a string containing
|
||||
* the localized equivalent to the requested decimal places.
|
||||
*
|
||||
* e.g. given formatDuration(60000), returns "1.0 minutes"
|
||||
*/
|
||||
Q_INVOKABLE QString formatDecimalDuration(quint64 msecs, int decimalPlaces = 2) const;
|
||||
|
||||
/**
|
||||
* Given a number of milliseconds, converts that to a spell-out string containing
|
||||
* the localized equivalent.
|
||||
*
|
||||
* e.g. given formatSpelloutDuration(60001) returns "1 minute"
|
||||
* given formatSpelloutDuration(62005) returns "1 minute and 2 seconds"
|
||||
* given formatSpelloutDuration(90060000) returns "1 day and 1 hour"
|
||||
*
|
||||
* Units not interesting to the user, for example seconds or minutes when the first
|
||||
* unit is day, are not returned because they are irrelevant. The same applies for
|
||||
* seconds when the first unit is hour.
|
||||
*
|
||||
*/
|
||||
Q_INVOKABLE QString formatSpelloutDuration(quint64 msecs) const;
|
||||
|
||||
/**
|
||||
* Returns a string formatted to a relative date style.
|
||||
*
|
||||
* If the date falls within one week before or after the current date
|
||||
* then a relative date string will be returned, such as:
|
||||
* * Yesterday
|
||||
* * Today
|
||||
* * Tomorrow
|
||||
* * Last Tuesday
|
||||
* * Next Wednesday
|
||||
*
|
||||
* If the date falls outside this period then the format is used
|
||||
*/
|
||||
Q_INVOKABLE QString formatRelativeDate(const QDate &date, QLocale::FormatType format) const;
|
||||
|
||||
/**
|
||||
* Returns a string formatted to a relative datetime style.
|
||||
*
|
||||
* If the dateTime falls within one week before or after the current date
|
||||
* then a relative date string will be returned, such as:
|
||||
* * Yesterday, 3:00pm
|
||||
* * Today, 3:00pm
|
||||
* * Tomorrow, 3:00pm
|
||||
* * Last Tuesday, 3:00pm
|
||||
* * Next Wednesday, 3:00pm
|
||||
*
|
||||
* If the datetime falls outside this period then the format is used
|
||||
*/
|
||||
Q_INVOKABLE QString formatRelativeDateTime(const QDateTime &dateTime, QLocale::FormatType format) const;
|
||||
|
||||
private:
|
||||
|
||||
KFormat m_format;
|
||||
};
|
||||
|
||||
#endif
|
@ -60,6 +60,9 @@ void LookAndFeelPackage::initPackage(Plasma::Package *package)
|
||||
package->addDirectoryDefinition("desktopswitcher", "desktopswitcher", i18n("Virtual Desktop Switcher"));
|
||||
package->addFileDefinition("desktopswitchermainscript", "desktopswitcher/DesktopSwitcher.qml", i18n("Main Script for Virtual Desktop Switcher"));
|
||||
|
||||
package->addDirectoryDefinition("osd", "osd", i18n("On-Screen Display Notifications"));
|
||||
package->addFileDefinition("osdmainscript", "osd/Osd.qml", i18n("Main Script for On-Screen Display Notifications"));
|
||||
|
||||
package->addDirectoryDefinition("splash", "splash", i18n("Splash Screen"));
|
||||
package->addFileDefinition("splashmainscript", "splash/Splash.qml", i18n("Main Script for Splash Screen"));
|
||||
|
||||
|
@ -46,6 +46,11 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa
|
||||
setFlags(Qt::FramelessWindowHint);
|
||||
|
||||
KWindowEffects::enableBlurBehind(winId(), true);
|
||||
if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) {
|
||||
KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7);
|
||||
} else {
|
||||
KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7);
|
||||
}
|
||||
|
||||
engine()->rootContext()->setContextProperty("panel", panelView);
|
||||
engine()->rootContext()->setContextProperty("configDialog", this);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QJSValue>
|
||||
#include <QQmlListProperty>
|
||||
#include <QStandardItemModel>
|
||||
#include <Plasma/Theme>
|
||||
|
||||
class AppletInterface;
|
||||
class ConfigPropertyMap;
|
||||
@ -55,6 +56,7 @@ protected Q_SLOTS:
|
||||
private:
|
||||
Plasma::Containment *m_containment;
|
||||
PanelView *m_panelView;
|
||||
Plasma::Theme m_theme;
|
||||
};
|
||||
|
||||
#endif // multiple inclusion guard
|
||||
|
@ -57,6 +57,11 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent)
|
||||
|
||||
//TODO: how to take the shape from the framesvg?
|
||||
KWindowEffects::enableBlurBehind(winId(), true);
|
||||
if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) {
|
||||
KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7);
|
||||
} else {
|
||||
KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7);
|
||||
}
|
||||
|
||||
//Screen management
|
||||
connect(this, &QWindow::screenChanged,
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <plasmaquickview.h>
|
||||
#include "panelconfigview.h"
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <Plasma/Theme>
|
||||
|
||||
class ShellCorona;
|
||||
|
||||
@ -108,6 +109,7 @@ private:
|
||||
ShellCorona *m_corona;
|
||||
QTimer *m_strutsTimer;
|
||||
VisibilityMode m_visibilityMode;
|
||||
Plasma::Theme m_theme;
|
||||
|
||||
static const int STRUTSTIMERDELAY = 200;
|
||||
};
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "scripting/desktopscriptengine.h"
|
||||
#include "widgetexplorer/widgetexplorer.h"
|
||||
#include "configview.h"
|
||||
#include "shellpluginloader.h"
|
||||
|
||||
static const int s_configSyncDelay = 10000; // 10 seconds
|
||||
|
||||
@ -78,6 +79,7 @@ public:
|
||||
QHash<QString, QHash<int, Plasma::Containment *> > desktopContainments;
|
||||
QAction *addPanelAction;
|
||||
QMenu *addPanelsMenu;
|
||||
Plasma::Package lookNFeelPackage;
|
||||
|
||||
QTimer waitingPanelsTimer;
|
||||
QTimer appConfigSyncTimer;
|
||||
@ -645,6 +647,17 @@ void ShellCorona::insertContainment(const QString &activity, int screenNum, Plas
|
||||
});
|
||||
}
|
||||
|
||||
Plasma::Package ShellCorona::lookAndFeelPackage() const
|
||||
{
|
||||
if (!d->lookNFeelPackage.isValid()) {
|
||||
d->lookNFeelPackage = ShellPluginLoader::self()->loadPackage("Plasma/LookAndFeel");
|
||||
//TODO: make loading from config once we have some UI for setting the package
|
||||
d->lookNFeelPackage.setPath("org.kde.lookandfeel");
|
||||
}
|
||||
|
||||
return d->lookNFeelPackage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Desktop corona handler
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include "plasma/corona.h"
|
||||
|
||||
#include <Plasma/Package>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
class Applet;
|
||||
@ -64,6 +66,8 @@ public:
|
||||
|
||||
KActivities::Controller *activityController();
|
||||
|
||||
Plasma::Package lookAndFeelPackage() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Request saving applicationConfig on disk, it's event compressed, not immediate
|
||||
|
Loading…
Reference in New Issue
Block a user