blob: a19d9e2555ee5bbe71870443fb21411deadfe384 [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
2 * Copyright (C) 2011-2015 by Savoir-Faire Linux *
3 * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
19#include "mainbar.h"
20#include "ui_mainbar.h"
21
22#include "callmodel.h"
23#include "aboutdialog.h"
24
25MainBar::MainBar(QWidget *parent) :
26 NavWidget(END, parent),
27 ui(new Ui::MainBar),
28 menu_(new QMenu())
29{
30 ui->setupUi(this);
31
32 auto aboutAction = new QAction("About", this);
33 menu_->addAction(aboutAction);
34 connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
35
36 auto exitAction = new QAction("Exit", this);
37 menu_->addAction(exitAction);
38 connect(exitAction, SIGNAL(triggered()), this, SLOT(on_exitButton_clicked()));
39
40 ui->logoToolButton->setMenu(menu_);
41 ui->logoToolButton->setPopupMode(QToolButton::InstantPopup);
42}
43
44MainBar::~MainBar()
45{
46 delete ui;
47}
48
49void
50MainBar::on_confButton_clicked()
51{
52 emit NavigationRequested(ScreenEnum::ConfScreen);
53}
54
55void
56MainBar::on_callLineEdit_returnPressed()
57{
58 callAction();
59}
60
61void
62MainBar::on_callButton_clicked()
63{
64 callAction();
65}
66
67void
68MainBar::callAction() {
69 if (ui->callLineEdit->text().isEmpty())
70 return;
71 auto outCall = CallModel::instance()->dialingCall(ui->callLineEdit->text());
72 outCall->setDialNumber(ui->callLineEdit->text());
73 outCall->performAction(Call::Action::ACCEPT);
74}
75
76void
77MainBar::showAboutDialog() {
78 AboutDialog *aboutDialog = new AboutDialog();
79
80 aboutDialog->exec();
81
82 delete aboutDialog;
83}
84
85void
86MainBar::on_exitButton_clicked()
87{
88 QCoreApplication::exit();
89}
90
91void
92MainBar::on_minimizeButton_clicked()
93{
94 emit minimize();
95}
96
97void
98MainBar::atExit() {
99
100}