# HG changeset patch # User Goffi # Date 1312637822 -7200 # Node ID 22b44846b04beff559eb5f6e77462de3e55382d9 Initial commit diff -r 000000000000 -r 22b44846b04b .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,15 @@ +syntax: glob +bellaciao +moc_* +ui_* +dbus_bridge* +*.o +*.cpps +*.hs +*.os +Makefile* +.*.un~* +.*.swp +*.xmls +Session.vim +output/ diff -r 000000000000 -r 22b44846b04b bellaciao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bellaciao.cpp Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,82 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#include "bellaciao.h" +#include "parameters.h" + +Bellaciao::Bellaciao() + :QMainWindow(0) +{ + m_bridge = Bridge::getBridge(); + + //Ui + setupUi(this); + m_contactList = new ContactList(this); + + //Signals & Slots + connect(actionParameters, SIGNAL(triggered()), this, SLOT(showParameters())); + + + addDockWidget(Qt::LeftDockWidgetArea, m_contactList); + + + setWindowTitle("Bellaciao"); + QList menus = m_bridge->getMenus(); + foreach(const MenuT &menu, menus) + qDebug() << menu.name; + StringDict waiting=m_bridge->getWaitingSub("jabberfr"); + + QList contacts = m_bridge->getContacts("jabberfr"); + + foreach(const ContactT &contact, contacts) + m_contactList->addContact(contact.jid); + //qDebug() << contact.jid << contact.attributes << contact.groups; + + +} + +void Bellaciao::disconnect() +{ + if ( QMessageBox::question ( + this, + tr("Disconnect?"), + tr("Do you really want to disconnect ?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No + ) == QMessageBox::Yes + ) + { + m_bridge->disconnect("jabberfr"); + } +} + +void Bellaciao::showParameters() +{ + qDebug("Show parameters"); + ParametersWin *params = new ParametersWin(); + params->show(); +} + +void Bellaciao::on_actionToggle_fullscreen_triggered() +{ + if (isFullScreen()) + showNormal(); + else + showFullScreen(); + qDebug("on_actionToggle_fullscreen_triggered"); +} diff -r 000000000000 -r 22b44846b04b bellaciao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bellaciao.h Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,46 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#ifndef BELLACIAO_H +#define BELLACIAO_H + + +#include +#include "ui_main_win.h" +#include "contact_list.h" +#include "bridge.h" + +class Bellaciao : public QMainWindow, private Ui::MainWindow +{ + Q_OBJECT + + public: + Bellaciao(); + + + private slots: + void disconnect(); + void showParameters(); + void on_actionToggle_fullscreen_triggered(); + + private: + ContactList* m_contactList; + Bridge* m_bridge; +}; + +#endif diff -r 000000000000 -r 22b44846b04b bellaciao.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bellaciao.pro Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,14 @@ +###################################################################### +# Automatically generated by qmake (2.01a) mer. juil. 27 00:28:52 2011 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +QT += dbus + +# Input +HEADERS += bellaciao.h contact_list.h dbus_bridge.h dbus_types.h bridge.h parameters.h +SOURCES += main.cpp bellaciao.cpp contact_list.cpp dbus_bridge.cpp dbus_types.cpp bridge.cpp parameters.cpp +FORMS += main_win.ui parameters_win.ui diff -r 000000000000 -r 22b44846b04b bridge.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bridge.cpp Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,42 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#include "bridge.h" + +Bridge::Bridge(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : DBusBridgeFrontend(service, path, connection, parent) +{ + qDebug() << "Bridge initialisation"; +} + +Bridge* Bridge::_bridge_instance = 0; + +Bridge* Bridge::getBridge() +{ + if (_bridge_instance == 0) { + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType< QList >(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType< QList >(); + + _bridge_instance = new Bridge("org.goffi.SAT", "/org/goffi/SAT/bridge", QDBusConnection::sessionBus()); + } + + return _bridge_instance; +} diff -r 000000000000 -r 22b44846b04b bridge.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bridge.h Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,37 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#ifndef BRIDGE_H +#define BRIDGE_H + +#include "dbus_types.h" +#include "dbus_bridge.h" + + +class Bridge: public DBusBridgeFrontend +{ +public: + static Bridge* getBridge(); + +protected: + Bridge(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + +private: + static Bridge* _bridge_instance; +}; +#endif diff -r 000000000000 -r 22b44846b04b contact_list.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contact_list.cpp Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,38 @@ +/* +Mignonne: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#include "contact_list.h" + + +ContactList::ContactList(QWidget * parent): + QDockWidget(tr("Contacts"), parent) + + { + mainWidget = new QWidget(); + QVBoxLayout *layout = new QVBoxLayout; + listWidget = new QListWidget(); + layout->addWidget(listWidget); + mainWidget->setLayout(layout); + setWidget(mainWidget); + + } + +void ContactList::addContact(const QString& jid) +{ + new QListWidgetItem(jid, listWidget); +} diff -r 000000000000 -r 22b44846b04b contact_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contact_list.h Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,35 @@ +/* +Mignonne: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#ifndef CONTACTLIST_H +#define CONTACTLIST_H + +#include + +class ContactList : public QDockWidget { + Q_OBJECT + + public: + ContactList(QWidget* parent = 0); + void addContact(const QString& jid); + private: + QWidget* mainWidget; + QListWidget* listWidget; +}; + +#endif diff -r 000000000000 -r 22b44846b04b dbus_types.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbus_types.cpp Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,83 @@ +/* +Mignonne: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#include "dbus_types.h" + +QDBusArgument &operator<<(QDBusArgument &argument, const ContactT &contact) +{ + argument.beginStructure(); + argument << contact.jid << contact.attributes << contact.groups; + argument.endStructure(); + return argument; +} +const QDBusArgument &operator>>(const QDBusArgument &argument, ContactT &contact) +{ + argument.beginStructure(); + argument >> contact.jid >> contact.attributes >> contact.groups; + argument.endStructure(); + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const MessageT &message) +{ + argument.beginStructure(); + argument << message.from_jid << message.text; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, MessageT &message) +{ + argument.beginStructure(); + argument >> message.from_jid >> message.text; + argument.endStructure(); + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const MenuT &menu) +{ + argument.beginStructure(); + argument << menu.category << menu.name << menu.type; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, MenuT &menu) +{ + argument.beginStructure(); + argument >> menu.category >> menu.name >> menu.type; + argument.endStructure(); + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const PresenceInfoT &presence_info) +{ + argument.beginStructure(); + argument << presence_info.show << presence_info.priority << presence_info.statuses; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, PresenceInfoT &presence_info) +{ + argument.beginStructure(); + argument >> presence_info.show >> presence_info.priority >> presence_info.statuses; + argument.endStructure(); + return argument; +} + diff -r 000000000000 -r 22b44846b04b dbus_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbus_types.h Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,80 @@ +/* +Mignonne: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#ifndef DBUS_TYPES_H +#define DBUS_TYPES_H + +#include +#include +#include +#include +#include + +typedef QHash StringDict; + +struct ContactT { + QString jid; + StringDict attributes; + QList groups; +}; + +struct MessageT { + QString from_jid; + QString text; +}; + +typedef QMap HistoryT; + +struct MenuT { + QString category; + QString name; + QString type; +}; + +struct PresenceInfoT { + QString show; + int priority; + QHash statuses; +}; + +typedef QMap ResourcePresenceT; + +typedef QHash PresenceStatusT; + +typedef QHash ActionResultExtDataT; + +Q_DECLARE_METATYPE(StringDict); +Q_DECLARE_METATYPE(ContactT); +Q_DECLARE_METATYPE(QList); +Q_DECLARE_METATYPE(HistoryT); +Q_DECLARE_METATYPE(PresenceStatusT); +Q_DECLARE_METATYPE(MenuT); +Q_DECLARE_METATYPE(QList); +Q_DECLARE_METATYPE(ActionResultExtDataT); + +QDBusArgument &operator<<(QDBusArgument &argument, const ContactT &contact); +const QDBusArgument &operator>>(const QDBusArgument &argument, ContactT &contact); +QDBusArgument &operator<<(QDBusArgument &argument, const MenuT &menu); +const QDBusArgument &operator>>(const QDBusArgument &argument, MenuT &menu); +QDBusArgument &operator<<(QDBusArgument &argument, const MessageT &message); +const QDBusArgument &operator>>(const QDBusArgument &argument, MessageT &message); +QDBusArgument &operator<<(QDBusArgument &argument, const PresenceInfoT &presence_info); +const QDBusArgument &operator>>(const QDBusArgument &argument, PresenceInfoT &presence_info); + +#endif + diff -r 000000000000 -r 22b44846b04b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,31 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#include +#include "bellaciao.h" + + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Bellaciao window; + window.show(); + + return app.exec(); +} diff -r 000000000000 -r 22b44846b04b main_win.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main_win.ui Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,81 @@ + + + MainWindow + + + + 0 + 0 + 755 + 483 + + + + Bellaciao + + + + + + + 0 + + + + Tab 1 + + + + + Tab 2 + + + + + + + + + + 0 + 0 + 755 + 21 + + + + + General + + + + + + + + + + + + Parameters + + + + + open + + + + + Quit + + + + + Toggle &fullscreen + + + + + + diff -r 000000000000 -r 22b44846b04b org.goffi.sat.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.goffi.sat.xml Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 22b44846b04b parameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parameters.cpp Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,33 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#include "parameters.h" + +ParametersWin :: ParametersWin(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); + + //We fill the profiles list + m_bridge = Bridge::getBridge(); + const QList& profiles = m_bridge->getProfilesList(); + foreach(const QString& profile, profiles) + new QListWidgetItem(profile, profileList); + +} + diff -r 000000000000 -r 22b44846b04b parameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parameters.h Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,42 @@ +/* +Bellaciao: a Salut à Toi frontend +Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +#ifndef PARAMETERS_H +#define PARAMETERS_H + + +#include +#include "ui_parameters_win.h" +#include "bridge.h" + +class ParametersWin : public QWidget, private Ui::ParametersWin +{ + Q_OBJECT + + public: + ParametersWin(QWidget *parent = 0); + + private: + Bridge* m_bridge; + +}; + + + + +#endif diff -r 000000000000 -r 22b44846b04b parameters_win.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parameters_win.ui Sat Aug 06 15:37:02 2011 +0200 @@ -0,0 +1,165 @@ + + + ParametersWin + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + 0 + + + + Profiles + + + + + + + + + + + + + + + + + + jid + + + + + + + + + + Password + + + + + + + + + + + + + Custom Server + + + true + + + false + + + + QFormLayout::ExpandingFieldsGrow + + + + + Server + + + + + + + + + + Port + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + + + + New + + + false + + + false + + + + + + + Delete + + + + + + + Set as default + + + + + + + + + + + Contact list layout + + + + + + + + +