comparison bellaciao.cpp @ 2:fee291c8d42a

settings: profiles management first draft
author Goffi <goffi@goffi.org>
date Mon, 08 Aug 2011 10:30:23 +0200
parents 22b44846b04b
children 220e5619bf87
comparison
equal deleted inserted replaced
1:2e015f69f756 2:fee291c8d42a
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #include "bellaciao.h" 19 #include "bellaciao.h"
20 #include "parameters.h" 20 #include "settings.h"
21 21
22 Bellaciao::Bellaciao() 22 Bellaciao::Bellaciao()
23 :QMainWindow(0) 23 :QMainWindow(0)
24 { 24 {
25 m_bridge = Bridge::getBridge(); 25 m_bridge = Bridge::getBridge();
26 26
27 //Ui 27 //Ui
28 setupUi(this); 28 setupUi(this);
29 const QString & media_dir = m_bridge->getConfig("", "media_dir");
30 setWindowIcon(QIcon(media_dir+"/icons/apps/32/sat.png"));
29 m_contactList = new ContactList(this); 31 m_contactList = new ContactList(this);
32
30 33
31 //Signals & Slots 34 //Signals & Slots
32 connect(actionParameters, SIGNAL(triggered()), this, SLOT(showParameters())); 35 connect(actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
36 connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
33 37
34 38
35 addDockWidget(Qt::LeftDockWidgetArea, m_contactList); 39 addDockWidget(Qt::LeftDockWidgetArea, m_contactList);
36 40
37 41
38 setWindowTitle("Bellaciao"); 42 setWindowTitle("Bellaciao");
39 QList<MenuT> menus = m_bridge->getMenus(); 43 QList<MenuT> menus = m_bridge->getMenus();
40 foreach(const MenuT &menu, menus) 44 foreach(const MenuT &menu, menus)
41 qDebug() << menu.name; 45 qDebug() << menu.name;
42 StringDict waiting=m_bridge->getWaitingSub("jabberfr");
43 46
44 QList<ContactT> contacts = m_bridge->getContacts("jabberfr"); 47 QList<ContactT> contacts = m_bridge->getContacts("jabberfr");
45 48
46 foreach(const ContactT &contact, contacts) 49 foreach(const ContactT &contact, contacts)
47 m_contactList->addContact(contact.jid); 50 m_contactList->addContact(contact.jid);
48 //qDebug() << contact.jid << contact.attributes << contact.groups; 51 //qDebug() << contact.jid << contact.attributes << contact.groups;
49 52
50 53
51 } 54 }
52 55
53 void Bellaciao::disconnect() 56 void Bellaciao::quit()
54 { 57 {
55 if ( QMessageBox::question ( 58 if ( QMessageBox::question (
56 this, 59 this,
57 tr("Disconnect?"), 60 tr("Quit?"),
58 tr("Do you really want to disconnect ?"), 61 tr("Do you really want to quit ?"),
59 QMessageBox::Yes | QMessageBox::No, 62 QMessageBox::Yes | QMessageBox::No,
60 QMessageBox::No 63 QMessageBox::No
61 ) == QMessageBox::Yes 64 ) == QMessageBox::Yes
62 ) 65 )
63 { 66 {
64 m_bridge->disconnect("jabberfr"); 67 qApp->quit();
65 } 68 }
66 } 69 }
67 70
68 void Bellaciao::showParameters() 71 void Bellaciao::showSettings()
69 { 72 {
70 qDebug("Show parameters"); 73 qDebug("Show settings");
71 ParametersWin *params = new ParametersWin(); 74 Settings::getDialog()->show();
72 params->show(); 75 Settings::getDialog()->raise();
73 } 76 }
74 77
75 void Bellaciao::on_actionToggle_fullscreen_triggered() 78 void Bellaciao::on_actionToggle_fullscreen_triggered()
76 { 79 {
77 if (isFullScreen()) 80 if (isFullScreen())