view bellaciao.cpp @ 1:2e015f69f756

added GPL 3 COPYING
author Goffi <goffi@goffi.org>
date Sat, 06 Aug 2011 15:38:00 +0200
parents 22b44846b04b
children fee291c8d42a
line wrap: on
line source

/*
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 <http://www.gnu.org/licenses/>.
*/

#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<MenuT> menus = m_bridge->getMenus();
    foreach(const MenuT &menu, menus)
        qDebug() << menu.name;
    StringDict waiting=m_bridge->getWaitingSub("jabberfr");

    QList<ContactT> 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");
}