Skip to content
Browse files

Merge remote-tracking branch 'origin/master' into new-panel-api

Conflicts:
	razorqt-panel/plugin-kbindicator/razorkbindicator.cpp
  • Loading branch information...
2 parents 6ab4ed1 + c9f1219 commit 928ff656d716ac2ad807cbb787e1dc0298f51a55 @SokoloffA SokoloffA committed
View
9 libraries/qtxdg/qiconfix/qiconloader.cpp
@@ -351,22 +351,23 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
const QString pixmaps(QLatin1String("/usr/share/pixmaps"));
QDir currentDir(pixmaps);
+ QIconDirInfo dirInfo(pixmaps);
if (currentDir.exists(iconName + pngext)) {
PixmapEntry *iconEntry = new PixmapEntry;
- iconEntry->dir = pixmaps;
+ iconEntry->dir = dirInfo;
iconEntry->filename = currentDir.filePath(iconName + pngext);
- // Notice we ensure that pixmap entries allways come before
+ // Notice we ensure that pixmap entries always come before
// scalable to preserve search order afterwards
entries.prepend(iconEntry);
} else if (m_supportsSvg &&
currentDir.exists(iconName + svgext)) {
ScalableEntry *iconEntry = new ScalableEntry;
- iconEntry->dir = pixmaps;
+ iconEntry->dir = dirInfo;
iconEntry->filename = currentDir.filePath(iconName + svgext);
entries.append(iconEntry);
} else if (currentDir.exists(iconName + xpmext)) {
PixmapEntry *iconEntry = new PixmapEntry;
- iconEntry->dir = pixmaps;
+ iconEntry->dir = dirInfo;
iconEntry->filename = currentDir.filePath(iconName + xpmext);
// Notice we ensure that pixmap entries always come before
// scalable to preserve search order afterwards
View
11 razorqt-lightdm-greeter/logindata.cpp
@@ -27,7 +27,8 @@ LoginData::LoginData(QLightDM::Greeter *greeter) :
m_StatefilePath = XdgDirs::cacheHome(true) + "/" + DATA_DIR + "/state";
}
-LoginData::~LoginData() {
+LoginData::~LoginData()
+{
}
int LoginData::numberOfUsers()
@@ -42,7 +43,6 @@ int LoginData::numberOfSessions()
QString LoginData::userFullName(int user_index)
{
-
return data(user_index, m_UsersModel, Qt::DisplayRole);
}
@@ -63,7 +63,8 @@ QString LoginData::sessionName(int session_index)
int LoginData::userSession(QString user_name)
{
- for (int i = 0; i < numberOfUsers(); i++) {
+ for (int i = 0; i < numberOfUsers(); i++)
+ {
if (userName(i) == user_name)
{
return userSession(i);
@@ -141,7 +142,7 @@ QString LoginData::data(int index, QAbstractListModel& model, int role)
{
if (0 <= index && index < model.rowCount(QModelIndex()))
{
- QModelIndex modelIndex = m_UsersModel.index(index, 0);
+ QModelIndex modelIndex = model.index(index, 0);
return model.data(modelIndex, role).toString();
}
else
@@ -157,4 +158,4 @@ Msg::Msg()
void Msg::show(const QString msg)
{
QMessageBox::information(NULL, "", msg);
-}
+}
View
8 razorqt-lightdm-greeter/logindata.h
@@ -19,8 +19,8 @@
#define LAST_USER_KEY "last-user"
#define CONFIG_FILE "/etc/lightdm/lightdm-razor-greeter.conf"
-class LoginData : public QObject {
-
+class LoginData : public QObject
+{
Q_OBJECT
public:
@@ -43,7 +43,7 @@ class LoginData : public QObject {
QString getLastUser();
void setLastUser(QString user);
-
+
private:
QString data(int index, QAbstractListModel& model, int role);
QLightDM::Greeter *m_Greeter;
@@ -59,5 +59,5 @@ class Msg
static void show(const QString msg);
};
-#endif /* STATE_H */
+#endif /* LOGIN_DATA_H */
View
14 razorqt-lightdm-greeter/loginform.cpp
@@ -63,9 +63,9 @@ LoginForm::LoginForm(QWidget *parent) :
}
LoginForm::~LoginForm()
- {
+{
delete ui;
- }
+}
void LoginForm::setFocus(Qt::FocusReason reason)
{
@@ -89,7 +89,7 @@ void LoginForm::setupAppearence()
setStyleSheet(razorTheme.qss("razor-lightdm-greeter/razor-lightdm-greeter"));
QPixmap icon(QString(SHARE_DIR) + "/graphics/rqt-2.svg");
ui->iconLabel->setPixmap(icon.scaled(ui->iconLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
-
+
ui->hostnameLabel->setText(m_Greeter.hostname());
}
@@ -138,7 +138,7 @@ void LoginForm::initializeControls()
if (m_Greeter.showManualLoginHint())
{
ui->userCombo->setCurrentIndex(m_otherUserComboIndex);
-}
+ }
else
{
ui->userCombo->setCurrentIndex(m_LoginData.suggestedUser());
@@ -150,9 +150,9 @@ void LoginForm::initializeControls()
ui->otherUserInput->clear();
QStringList completions;
for (int i = 0; i < m_LoginData.numberOfUsers(); i++)
-{
+ {
completions << m_LoginData.userName(i);
-}
+ }
QCompleter *completer = new QCompleter(completions, ui->otherUserInput);
completer->setCompletionMode(QCompleter::InlineCompletion);
ui->otherUserInput->setCompleter(completer);
@@ -162,7 +162,7 @@ void LoginForm::initializeControls()
}
void LoginForm::setSessionCombo(int session_index)
- {
+{
if (0 <= session_index && session_index < ui->sessionCombo->count())
{
ui->sessionCombo->setCurrentIndex(session_index);
View
6 razorqt-lightdm-greeter/loginform.h
@@ -44,7 +44,7 @@ class LoginForm : public QWidget
public:
explicit LoginForm(QWidget *parent = 0);
~LoginForm();
-
+
virtual void setFocus(Qt::FocusReason reason);
public slots:
@@ -54,9 +54,9 @@ public slots:
void clearAll();
void leaveClicked();
void razorPowerFinished();
-
+
void onPrompt(QString prompt, QLightDM::Greeter::PromptType promptType);
-
+
void authenticationComplete();
private:
View
3 razorqt-panel/plugin-kbindicator/CMakeLists.txt
@@ -5,19 +5,16 @@ set(PLUGIN "panelkbindicator")
set(HEADERS
razorkbindicator.h
- razorkbindicatoreventfilter.h
razorkbindicatorconfiguration.h
)
set(SOURCES
razorkbindicator.cpp
- razorkbindicatoreventfilter.cpp
razorkbindicatorconfiguration.cpp
)
set(MOCS
razorkbindicator.h
- razorkbindicatoreventfilter.h
razorkbindicatorconfiguration.h
)
View
64 razorqt-panel/plugin-kbindicator/razorkbindicator.cpp
@@ -27,43 +27,52 @@
#include "razorkbindicator.h"
-#include <QtGui/QLabel>
-
-#include "razorkbindicatoreventfilter.h"
+#include <X11/XKBlib.h>
+#include <QtGui/QLabel>
+#include <QtGui/QX11Info>
Q_EXPORT_PLUGIN2(panelkbindicator, RazorKbIndicatorLibrary)
-
RazorKbIndicator::RazorKbIndicator(const IRazorPanelPluginStartupInfo &startupInfo):
QObject(),
IRazorPanelPlugin(startupInfo),
- content(new QLabel()),
- eventFilter(RazorKbIndicatorEventFilter::instance())
+ mContent(new QLabel())
{
- connect(eventFilter, SIGNAL(indicatorsChanged(uint,uint)), this, SLOT(setIndicators(uint,uint)));
- content->setAlignment(Qt::AlignCenter);
+ connect(this, SIGNAL(indicatorsChanged(uint,uint)), this, SLOT(setIndicators(uint,uint)));
+ mContent->setAlignment(Qt::AlignCenter);
+
+ int code;
+ int major = XkbMajorVersion;
+ int minor = XkbMinorVersion;
+ int XkbErrorBase;
+
+ mDisplay = QX11Info::display();
+
+ if (XkbLibraryVersion(&major, &minor))
+ if (XkbQueryExtension(mDisplay, &code, &mXkbEventBase, &XkbErrorBase, &major, &minor))
+ if (XkbUseExtension(mDisplay, &major, &minor))
+ XkbSelectEvents(mDisplay, XkbUseCoreKbd, XkbIndicatorStateNotifyMask, XkbIndicatorStateNotifyMask);
settingsChanged();
- content->setEnabled(eventFilter->getLockStatus(bit));
realign();
}
RazorKbIndicator::~RazorKbIndicator()
{
- delete content;
+ delete mContent;
}
QWidget *RazorKbIndicator::widget()
{
- return content;
+ return mContent;
}
void RazorKbIndicator::settingsChanged()
{
- bit = settings()->value("bit", 0).toInt();
- content->setText(settings()->value("text", QString("C")).toString());
- content->setEnabled(eventFilter->getLockStatus(bit));
+ mBit = settings()->value("bit", 0).toInt();
+ mContent->setText(settings()->value("text", QString("C")).toString());
+ mContent->setEnabled(getLockStatus(mBit));
}
QDialog *RazorKbIndicator::configureDialog()
@@ -73,11 +82,32 @@ QDialog *RazorKbIndicator::configureDialog()
void RazorKbIndicator::realign()
{
- content->setMinimumSize(panel()->lineSize(), panel()->lineSize());
+ mContent->setMinimumSize(panel()->lineSize(), panel()->lineSize());
}
void RazorKbIndicator::setIndicators(unsigned int changed, unsigned int state)
{
- if (changed & (1 << bit))
- content->setEnabled(state & (1 << bit));
+ if (changed & (1 << mBit))
+ mContent->setEnabled(state & (1 << mBit));
+}
+
+bool RazorKbIndicator::getLockStatus(int bit)
+{
+ bool state = false;
+ if (mDisplay)
+ {
+ unsigned n;
+ XkbGetIndicatorState(mDisplay, XkbUseCoreKbd, &n);
+ state = (n & (1 << bit));
+ }
+ return state;
+}
+
+void RazorKbIndicator::x11EventFilter(XEvent* event)
+{
+ XkbEvent* xkbEvent = reinterpret_cast<XkbEvent*>(event);
+
+ if (xkbEvent->type == mXkbEventBase + XkbEventCode)
+ if (xkbEvent->any.xkb_type == XkbIndicatorStateNotify)
+ emit indicatorsChanged(xkbEvent->indicators.changed, xkbEvent->indicators.state);
}
View
15 razorqt-panel/plugin-kbindicator/razorkbindicator.h
@@ -33,7 +33,6 @@
class QLabel;
-class RazorKbIndicatorEventFilter;
class RazorKbIndicator : public QObject, public IRazorPanelPlugin
{
@@ -50,17 +49,25 @@ class RazorKbIndicator : public QObject, public IRazorPanelPlugin
QDialog *configureDialog();
virtual void realign();
+signals:
+ void indicatorsChanged(unsigned int, unsigned int);
+
protected slots:
virtual void settingsChanged();
void setIndicators(unsigned int, unsigned int);
+protected:
+ bool getLockStatus(int mBit);
+ virtual void x11EventFilter(XEvent* event);
+
private:
- QLabel *content;
+ QLabel *mContent;
- int bit;
+ int mBit;
- RazorKbIndicatorEventFilter *eventFilter;
+ Display *mDisplay;
+ int mXkbEventBase;
};
View
104 razorqt-panel/plugin-kbindicator/razorkbindicatoreventfilter.cpp
@@ -1,104 +0,0 @@
-/* BEGIN_COMMON_COPYRIGHT_HEADER
- * (c)LGPL2+
- *
- * Razor - a lightweight, Qt based, desktop toolset
- * http://razor-qt.org
- *
- * Copyright: 2012 Razor team
- * Authors:
- * Kuzma Shapran <kuzma.shapran@gmail.com>
- *
- * This program or library is free software; you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * END_COMMON_COPYRIGHT_HEADER */
-
-#include "razorkbindicatoreventfilter.h"
-
-#include <X11/XKBlib.h>
-
-
-static RazorKbIndicatorEventFilter *filterObject = NULL;
-
-
-bool X11_eventFilter(void *message)
-{
- return filterObject ? filterObject->X11_eventFilter(message) : false;
-}
-
-RazorKbIndicatorEventFilter* RazorKbIndicatorEventFilter::instance()
-{
- if (!filterObject)
- new RazorKbIndicatorEventFilter();
- return filterObject;
-}
-
-RazorKbIndicatorEventFilter::RazorKbIndicatorEventFilter(QObject *parent):
- QObject(parent),
- oldEventFilter(0)
-{
- if (!filterObject)
- {
- filterObject = this;
-
- display = QX11Info::display();
-
- if (initXkbExtension())
- if (XkbSelectEvents(display, XkbUseCoreKbd, XkbIndicatorStateNotifyMask, XkbIndicatorStateNotifyMask))
- oldEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(::X11_eventFilter);
- }
-}
-
-bool RazorKbIndicatorEventFilter::initXkbExtension()
-{
- int code;
- int major = XkbMajorVersion;
- int minor = XkbMinorVersion;
- int XkbErrorBase;
-
- if (!XkbLibraryVersion(&major, &minor))
- return false;
- if (!XkbQueryExtension(display, &code, &XkbEventBase, &XkbErrorBase, &major, &minor))
- return false;
- if (!XkbUseExtension(display, &major, &minor))
- return false;
- return true;
-}
-
-bool RazorKbIndicatorEventFilter::X11_eventFilter(void *message)
-{
- XkbEvent* event = static_cast<XkbEvent*>(message);
-
- if (event->type == XkbEventBase + XkbEventCode)
- if (event->any.xkb_type == XkbIndicatorStateNotify)
- emit indicatorsChanged(event->indicators.changed, event->indicators.state);
-
- if (oldEventFilter)
- return oldEventFilter(message);
-
- return false;
-}
-
-bool RazorKbIndicatorEventFilter::getLockStatus(int bit)
-{
- bool state = false;
- if (display)
- {
- unsigned n;
- XkbGetIndicatorState(display, XkbUseCoreKbd, &n);
- state = (n & (1 << bit));
- }
- return state;
-}
View
61 razorqt-panel/plugin-kbindicator/razorkbindicatoreventfilter.h
@@ -1,61 +0,0 @@
-/* BEGIN_COMMON_COPYRIGHT_HEADER
- * (c)LGPL2+
- *
- * Razor - a lightweight, Qt based, desktop toolset
- * http://razor-qt.org
- *
- * Copyright: 2012 Razor team
- * Authors:
- * Kuzma Shapran <kuzma.shapran@gmail.com>
- *
- * This program or library is free software; you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * END_COMMON_COPYRIGHT_HEADER */
-
-#ifndef RAZORPANELKBINDICATOREVENTFILTER_H
-#define RAZORPANELKBINDICATOREVENTFILTER_H
-
-#include <QtCore/QAbstractEventDispatcher>
-
-#include <QtGui/QX11Info>
-
-
-class RazorKbIndicatorEventFilter : public QObject
-{
- Q_OBJECT
-public:
- RazorKbIndicatorEventFilter(QObject *parent = NULL);
-
- bool getLockStatus(int bit);
-
- static RazorKbIndicatorEventFilter* instance();
-
-signals:
- void indicatorsChanged(unsigned int, unsigned int);
-
-private:
- friend bool X11_eventFilter(void*);
-
- Display *display;
- int XkbEventBase;
- QAbstractEventDispatcher::EventFilter oldEventFilter;
-
- bool initXkbExtension();
- bool X11_eventFilter(void *message);
-};
-
-
-#endif // RAZORPANELKBINDICATOREVENTFILTER_H
View
2 razorqt-panel/plugin-taskbar/razortaskbutton.cpp
@@ -76,7 +76,7 @@ RazorTaskButton::RazorTaskButton(const Window window, QWidget *parent) :
XGetWindowAttributes(QX11Info::display(), mWindow, &oldAttr);
XSetWindowAttributes newAttr;
- newAttr.event_mask = oldAttr.all_event_masks | PropertyChangeMask;
+ newAttr.event_mask = oldAttr.your_event_mask | PropertyChangeMask;
XChangeWindowAttributes(QX11Info::display(), mWindow, CWEventMask, &newAttr);
setStyle(&mStyle);

0 comments on commit 928ff65

Please sign in to comment.
Something went wrong with that request. Please try again.