diff options
author | David Edmundson <david@davidedmundson.co.uk> | 2011-11-10 01:59:37 +0000 |
---|---|---|
committer | David Edmundson <david@davidedmundson.co.uk> | 2011-11-10 01:59:37 +0000 |
commit | c022466de7aeee9a2d1893e5d356b1fcf3300d62 (patch) | |
tree | 94dc7ee77b6d26e0b7f0c962bf1ad28fba5b55e9 /liblightdm-qt | |
parent | be5dc4aad74502baefdd84b7d2866bd0d877faf3 (diff) | |
download | lightdm-c022466de7aeee9a2d1893e5d356b1fcf3300d62.tar.gz |
Fix Qt headers.
Fix moc loading to match other other code
Create system class rather than using namespace methods.
Diffstat (limited to 'liblightdm-qt')
-rw-r--r-- | liblightdm-qt/Makefile.am | 24 | ||||
-rw-r--r-- | liblightdm-qt/QLightDM/Greeter | 90 | ||||
-rw-r--r-- | liblightdm-qt/QLightDM/Language | 37 | ||||
-rw-r--r-- | liblightdm-qt/QLightDM/Power | 29 | ||||
-rw-r--r-- | liblightdm-qt/QLightDM/Session | 40 | ||||
-rw-r--r-- | liblightdm-qt/QLightDM/System | 22 | ||||
-rw-r--r-- | liblightdm-qt/QLightDM/User | 93 | ||||
-rw-r--r-- | liblightdm-qt/greeter.cpp | 11 | ||||
-rw-r--r-- | liblightdm-qt/language.cpp | 2 | ||||
-rw-r--r-- | liblightdm-qt/power.cpp | 5 | ||||
-rw-r--r-- | liblightdm-qt/session.cpp | 4 | ||||
-rw-r--r-- | liblightdm-qt/system.cpp | 6 | ||||
-rw-r--r-- | liblightdm-qt/user.cpp | 6 |
13 files changed, 41 insertions, 328 deletions
diff --git a/liblightdm-qt/Makefile.am b/liblightdm-qt/Makefile.am index dbd8c3a5..dc4a405a 100644 --- a/liblightdm-qt/Makefile.am +++ b/liblightdm-qt/Makefile.am @@ -1,16 +1,10 @@ lib_LTLIBRARIES = liblightdm-qt-1.la -# Generate metadata for QObjects -MOC_FILES = \ - greeter_moc.cpp \ - session_moc.cpp \ - user_moc.cpp - -greeter_moc.cpp: QLightDM/Greeter +greeter_moc.cpp: QLightDM/greeter.h $(MOC) $< -o $@ -session_moc.cpp: QLightDM/Session +session_moc.cpp: QLightDM/session.h $(MOC) $< -o $@ -user_moc.cpp: QLightDM/User +user_moc.cpp: QLightDM/user.h $(MOC) $< -o $@ liblightdm_qt_1_la_LIBADD = $(LIBLIGHTDM_QT_LIBS) @@ -23,7 +17,14 @@ liblightdm_qt_1include_HEADERS = \ QLightDM/Power \ QLightDM/Session \ QLightDM/System \ - QLightDM/User + QLightDM/User \ + QLightDM/greeter.h \ + QLightDM/language.h \ + QLightDM/power.h \ + QLightDM/session.h \ + QLightDM/system.h \ + QLightDM/user.h + liblightdm_qt_1includedir=$(includedir)/lightdm-qt-1/QLightDM liblightdm_qt_1_la_SOURCES = \ @@ -33,14 +34,13 @@ liblightdm_qt_1_la_SOURCES = \ session.cpp \ system.cpp \ user.cpp \ - $(MOC_FILES) \ $(liblightdm_qt_1include_HEADERS) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = liblightdm-qt-1.pc CLEANFILES = \ - $(MOC_FILES) + *_moc.cpp DISTCLEANFILES = \ Makefile.in \ diff --git a/liblightdm-qt/QLightDM/Greeter b/liblightdm-qt/QLightDM/Greeter index 5e892fd8..bcfa4a96 100644 --- a/liblightdm-qt/QLightDM/Greeter +++ b/liblightdm-qt/QLightDM/Greeter @@ -1,89 +1 @@ -/* - * Copyright (C) 2010-2011 David Edmundson. - * Copyright (C) 2010-2011 Robert Ancell - * Author: David Edmundson <kde@davidedmundson.co.uk> - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 3 of the License, or (at your option) any - * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the - * license. - */ - -#ifndef QLIGHTDM_GREETER_H -#define QLIGHTDM_GREETER_H - -#include <QtCore/QObject> -#include <QtCore/QVariant> -#include "QLightDM/User" -#include "QLightDM/Language" - -class GreeterPrivate; - -namespace QLightDM -{ - typedef enum - { - PROMPT_TYPE_QUESTION, - PROMPT_TYPE_SECRET - } PromptType; - - typedef enum - { - MESSAGE_TYPE_INFO, - MESSAGE_TYPE_ERROR - } MessageType; - - class Q_DECL_EXPORT Greeter : public QObject - { - Q_OBJECT - public: - explicit Greeter(QObject* parent=0); - virtual ~Greeter(); - - QString timedLoginUser() const; - int timedLoginDelay() const; - - QString getHint(QString name) const; - QString defaultSessionHint() const; - bool hideUsersHint() const; - bool hasGuestAccountHint() const; - QString selectUserHint() const; - bool selectGuestHint() const; - QString autologinUserHint() const; - bool autologinGuestHint() const; - int autologinTimeoutHint() const; - - bool inAuthentication() const; - bool isAuthenticated() const; - QString authenticationUser() const; - - public slots: - bool connectSync(); - void authenticate(const QString &username=QString()); - void authenticateAsGuest(); - void respond(const QString &response); - void cancelAuthentication(); - void setLanguage (QString language); - bool startSessionSync(const QString &session=QString()); - - signals: - void showMessage(QString text, QLightDM::MessageType type); - void showPrompt(QString text, QLightDM::PromptType type); - void authenticationComplete(); - void autologinTimerExpired(); - - private slots: - void onRead(int fd); - - private: - GreeterPrivate *d; - void writeInt(int value); - void writeString(QString value); - void writeHeader(int id, int length); - void flush(); - char *readMessage(int *length, bool block); - }; -}; - -#endif // QLIGHTDM_GREETER_H +#include "QLightDM/greeter.h"
\ No newline at end of file diff --git a/liblightdm-qt/QLightDM/Language b/liblightdm-qt/QLightDM/Language index 5ba16c8b..68d5513f 100644 --- a/liblightdm-qt/QLightDM/Language +++ b/liblightdm-qt/QLightDM/Language @@ -1,36 +1 @@ -/* - * Copyright (C) 2010-2011 David Edmundson. - * Author: David Edmundson <kde@davidedmundson.co.uk> - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 3 of the License, or (at your option) any - * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the - * license. - */ - -#ifndef QLIGHTDM_LANGUAGE_H -#define QLIGHTDM_LANGUAGE_H - -#include <QString> - -class LanguagePrivate; - -namespace QLightDM { - class Language - { - public: - Language(QString &code, QString &name, QString &territory); - ~Language(); - Language(const Language& other); - Language &operator=(const Language& other); - - QString code() const; - QString name() const; - QString territory() const; - private: - LanguagePrivate* d; - }; -}; - -#endif // QLIGHTDM_LANGUAGE_H +#include "QLightDM/language.h"
\ No newline at end of file diff --git a/liblightdm-qt/QLightDM/Power b/liblightdm-qt/QLightDM/Power index e3a0a12b..446eb11f 100644 --- a/liblightdm-qt/QLightDM/Power +++ b/liblightdm-qt/QLightDM/Power @@ -1,28 +1 @@ -/* - * Copyright (C) 2010-2011 David Edmundson. - * Copyright (C) 2010-2011 Robert Ancell - * Author: David Edmundson <kde@davidedmundson.co.uk> - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 3 of the License, or (at your option) any - * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the - * license. - */ - -#ifndef QLIGHTDM_POWER_H -#define QLIGHTDM_POWER_H - -namespace QLightDM -{ - bool canSuspend(); - bool canHibernate(); - bool canShutdown(); - bool canRestart(); - void suspend(); - void hibernate(); - void shutdown(); - void restart(); -}; - -#endif // QLIGHTDM_POWER_H +#include "QLightDM/power.h"
\ No newline at end of file diff --git a/liblightdm-qt/QLightDM/Session b/liblightdm-qt/QLightDM/Session index 83310bbc..9566e0b8 100644 --- a/liblightdm-qt/QLightDM/Session +++ b/liblightdm-qt/QLightDM/Session @@ -1,39 +1 @@ -/* - * Copyright (C) 2010-2011 David Edmundson. - * Author: David Edmundson <kde@davidedmundson.co.uk> - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 3 of the License, or (at your option) any - * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the - * license. - */ - -#ifndef QLIGHTDM_SESSION_H -#define QLIGHTDM_SESSION_H - -#include <QtCore/QAbstractListModel> - -class SessionsModelPrivate; - -namespace QLightDM { - class Q_DECL_EXPORT SessionsModel : public QAbstractListModel - { - Q_OBJECT - public: - explicit SessionsModel(QObject *parent = 0); - virtual ~SessionsModel(); - - enum SessionModelRoles {IdRole = Qt::UserRole}; - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; - - private: - SessionsModelPrivate *d; - void buildList(); //maybe make this a public slot, which apps can call only if they give a care about the session. - }; - - SessionsModel *sessions(); -}; - -#endif // QLIGHTDM_SESSION_H +#include "QLightDM/session.h"
\ No newline at end of file diff --git a/liblightdm-qt/QLightDM/System b/liblightdm-qt/QLightDM/System index 7958be09..3f9275fc 100644 --- a/liblightdm-qt/QLightDM/System +++ b/liblightdm-qt/QLightDM/System @@ -1,21 +1 @@ -/* - * Copyright (C) 2010-2011 David Edmundson. - * Copyright (C) 2010-2011 Robert Ancell - * Author: David Edmundson <kde@davidedmundson.co.uk> - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 3 of the License, or (at your option) any - * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the - * license. - */ - -#ifndef QLIGHTDM_SYSTEM_H -#define QLIGHTDM_SYSTEM_H - -namespace QLightDM -{ - QString hostname(); -}; - -#endif // QLIGHTDM_SYSTEM_H +#include "QLightDM/system.h"
\ No newline at end of file diff --git a/liblightdm-qt/QLightDM/User b/liblightdm-qt/QLightDM/User index 08841fc1..968058f5 100644 --- a/liblightdm-qt/QLightDM/User +++ b/liblightdm-qt/QLightDM/User @@ -1,92 +1 @@ -/* - * Copyright (C) 2010-2011 David Edmundson. - * Author: David Edmundson <kde@davidedmundson.co.uk> - * - * This library is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation; either version 3 of the License, or (at your option) any - * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the - * license. - */ - -#ifndef QLIGHTDM_USER_H -#define QLIGHTDM_USER_H - -#include <QtCore/QString> -#include <QtCore/QSharedDataPointer> -#include <QAbstractListModel> - -class UserPrivate; -class UsersModelPrivate; - -namespace QLightDM -{ - //public facing User class - /** Class storing user information. - This is an implicitly shared class. */ - - class Q_DECL_EXPORT User - { - public: - explicit User(); - User(const QString &name, const QString &realName, const QString &homeDirectory, const QString &image, bool isLoggedIn); - User(const User& other); - ~User(); - User &operator=(const User& other); - - bool update(const QString &realName, const QString &homeDirectory, const QString &image, bool isLoggedIn); - - /** The name to display (the real name if available, otherwise use the username */ - QString displayName() const; - - /** The username of the user*/ - QString name() const; - /** The user's real name, use this for displaying*/ - QString realName() const; - - /** Returns the home directory of this user*/ - QString homeDirectory() const; - - /** Returns the path to an avatar of this user*/ - QString image() const; - - /** Returns true if this user is already logged in on another session*/ - bool isLoggedIn() const; - - // LdmUser &operator=(const LdmUser user); - private: - QSharedDataPointer<UserPrivate> d; - }; - - class Q_DECL_EXPORT UsersModel : public QAbstractListModel - { - Q_OBJECT - public: - explicit UsersModel(QObject *parent = 0); - ~UsersModel(); - - enum UserModelRoles {NameRole = Qt::UserRole, - RealNameRole, - LoggedInRole}; - - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - - signals: - - public slots: - - private slots: - /** Updates the model with new changes in the password file*/ - void loadUsers(); - - private: - /** Returns a list of all users in the password file*/ - QList<User> getUsers(); - UsersModelPrivate *d; - }; - - UsersModel *users(); -} - -#endif // QLIGHTDM_USER_H +#include "QLightDM/user.h"
\ No newline at end of file diff --git a/liblightdm-qt/greeter.cpp b/liblightdm-qt/greeter.cpp index bc8ec28a..9c062336 100644 --- a/liblightdm-qt/greeter.cpp +++ b/liblightdm-qt/greeter.cpp @@ -10,11 +10,11 @@ * license. */ -#include "config.h" -#include "QLightDM/Greeter" +#include "QLightDM/greeter.h" + +#include "config.h" -#include <security/pam_appl.h> #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QVariant> @@ -27,6 +27,9 @@ #include <QtDBus/QDBusInterface> #include <QtDBus/QDBusReply> +#include <security/pam_appl.h> + + /* Messages from the greeter to the server */ typedef enum { @@ -489,3 +492,5 @@ int Greeter::autologinTimeoutHint() const { return d->hints.value ("autologin-timeout", "0").toInt (); } + +#include "greeter_moc.cpp"
\ No newline at end of file diff --git a/liblightdm-qt/language.cpp b/liblightdm-qt/language.cpp index 8c087a80..c8668c9d 100644 --- a/liblightdm-qt/language.cpp +++ b/liblightdm-qt/language.cpp @@ -9,7 +9,7 @@ * license. */ -#include "QLightDM/Language" +#include "QLightDM/language.h" using namespace QLightDM; diff --git a/liblightdm-qt/power.cpp b/liblightdm-qt/power.cpp index 8656c247..2f75fbb3 100644 --- a/liblightdm-qt/power.cpp +++ b/liblightdm-qt/power.cpp @@ -10,14 +10,15 @@ * license. */ -#include "config.h" -#include "QLightDM/Power" +#include "QLightDM/power.h" #include <QtCore/QVariant> #include <QtDBus/QDBusInterface> #include <QtDBus/QDBusReply> +#include "config.h" + using namespace QLightDM; static QDBusInterface* powerManagementInterface = NULL; diff --git a/liblightdm-qt/session.cpp b/liblightdm-qt/session.cpp index 7134d937..b2274ec8 100644 --- a/liblightdm-qt/session.cpp +++ b/liblightdm-qt/session.cpp @@ -9,7 +9,7 @@ * license. */ -#include "QLightDM/Session" +#include "QLightDM/session.h" #include <QtCore/QList> #include <QtCore/QDir> @@ -111,3 +111,5 @@ void SessionsModel::buildList() d->items.append(items); endInsertRows(); } + +#include "session_moc.cpp" diff --git a/liblightdm-qt/system.cpp b/liblightdm-qt/system.cpp index 8c11e6eb..2461aaad 100644 --- a/liblightdm-qt/system.cpp +++ b/liblightdm-qt/system.cpp @@ -10,11 +10,13 @@ * license. */ +#include "QLightDM/system.h" + #include <QtNetwork/QHostInfo> -#include "QLightDM/System" +using namespace QLightDM; -QString QLightDM::hostname() +QString System::hostname() { return QHostInfo::localHostName(); } diff --git a/liblightdm-qt/user.cpp b/liblightdm-qt/user.cpp index 1f5cd5f4..aa7d67e9 100644 --- a/liblightdm-qt/user.cpp +++ b/liblightdm-qt/user.cpp @@ -9,10 +9,11 @@ * license. */ -#include "QLightDM/User" +#include "QLightDM/user.h" #include <pwd.h> #include <errno.h> + #include <QtCore/QSharedData> #include <QtCore/QString> #include <QtCore/QFileSystemWatcher> @@ -20,7 +21,6 @@ #include <QtCore/QDir> #include <QtCore/QSettings> #include <QtCore/QDebug> - #include <QtGui/QPixmap> using namespace QLightDM; @@ -301,3 +301,5 @@ void UsersModel::loadUsers() endInsertRows(); } } + +#include "user_moc.cpp"
\ No newline at end of file |