Implement setPerCallerPreference()
[skype-call-recorder.git] / callgui.cpp
blob5b779b27ffc950051dfb0c0eedc2dc5eb2b90863
1 /*
2 Skype Call Recorder
3 Copyright (C) 2008 jlh (jlh at gmx dot ch)
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2 of the License, version 3 of
8 the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 The GNU General Public License version 2 is included with the source of
20 this program under the file name COPYING. You can also get a copy on
21 http://www.fsf.org/
24 #include <QHBoxLayout>
25 #include <QVBoxLayout>
26 #include <QPushButton>
27 #include <QCheckBox>
28 #include <QLabel>
29 #include <QApplication>
30 #include <QStyle>
31 #include <QIcon>
32 #include <QTimer>
34 #include "callgui.h"
35 #include "common.h"
37 // ---- RecordConfirmationDialog ----
39 RecordConfirmationDialog::RecordConfirmationDialog(const QString &skypeName, const QString &displayName) {
40 setWindowTitle(PROGRAM_NAME);
41 setAttribute(Qt::WA_DeleteOnClose);
43 QHBoxLayout *bighbox = new QHBoxLayout(this);
44 bighbox->setSizeConstraint(QLayout::SetFixedSize);
46 // get standard icon
47 int iconSize = QApplication::style()->pixelMetric(QStyle::PM_MessageBoxIconSize);
48 QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion);
49 QLabel *iconLabel = new QLabel;
50 iconLabel->setPixmap(icon.pixmap(iconSize, iconSize));
51 bighbox->addWidget(iconLabel, 0, Qt::AlignTop);
53 bighbox->addSpacing(10);
55 QVBoxLayout *vbox = new QVBoxLayout;
56 bighbox->addLayout(vbox);
58 QLabel *label = new QLabel(QString(PROGRAM_NAME " has started recording the call with <b>%1</b> (%2).<br>"
59 "Do you wish to continue recording or shall it stop and delete the file?").arg(skypeName, displayName));
60 vbox->addWidget(label);
62 vbox->addSpacing(10);
64 QCheckBox *check = new QCheckBox(QString("&Automatically perform this action on the next call with %1").arg(skypeName));
65 check->setEnabled(false);
66 //widgets.append(check);
67 vbox->addWidget(check);
69 QHBoxLayout *hbox = new QHBoxLayout;
71 QPushButton *button = new QPushButton("&Continue recording");
72 button->setEnabled(false);
73 button->setDefault(true);
74 widgets.append(button);
75 connect(button, SIGNAL(clicked()), this, SLOT(yesClicked()));
76 hbox->addWidget(button);
78 button = new QPushButton("&Stop recording and delete");
79 button->setEnabled(false);
80 widgets.append(button);
81 connect(button, SIGNAL(clicked()), this, SLOT(noClicked()));
82 hbox->addWidget(button);
84 vbox->addLayout(hbox);
86 connect(this, SIGNAL(rejected()), this, SIGNAL(no()));
87 QTimer::singleShot(1000, this, SLOT(enableWidgets()));
89 show();
90 raise();
91 activateWindow();
94 void RecordConfirmationDialog::yesClicked() {
95 emit yes();
96 // TODO update preferences depending on checkbox
97 accept();
100 void RecordConfirmationDialog::noClicked() {
101 emit no();
102 // TODO update preferences depending on checkbox
103 accept();
106 void RecordConfirmationDialog::enableWidgets() {
107 for (int i = 0; i < widgets.size(); i++)
108 widgets.at(i)->setEnabled(true);