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
24 #include <QHBoxLayout>
25 #include <QVBoxLayout>
26 #include <QPushButton>
29 #include <QApplication>
36 #include "preferences.h"
38 // ---- RecordConfirmationDialog ----
40 RecordConfirmationDialog::RecordConfirmationDialog(const QString
&sn
, const QString
&displayName
) :
43 setWindowTitle(PROGRAM_NAME
);
44 setAttribute(Qt::WA_DeleteOnClose
);
46 QHBoxLayout
*bighbox
= new QHBoxLayout(this);
47 bighbox
->setSizeConstraint(QLayout::SetFixedSize
);
50 int iconSize
= QApplication::style()->pixelMetric(QStyle::PM_MessageBoxIconSize
);
51 QIcon icon
= QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion
);
52 QLabel
*iconLabel
= new QLabel
;
53 iconLabel
->setPixmap(icon
.pixmap(iconSize
, iconSize
));
54 bighbox
->addWidget(iconLabel
, 0, Qt::AlignTop
);
56 bighbox
->addSpacing(10);
58 QVBoxLayout
*vbox
= new QVBoxLayout
;
59 bighbox
->addLayout(vbox
);
61 QLabel
*label
= new QLabel(QString(PROGRAM_NAME
" has started recording the call with <b>%1</b> (%2).<br>"
62 "Do you wish to continue recording or shall it stop and delete the file?").arg(skypeName
, displayName
));
63 vbox
->addWidget(label
);
67 remember
= new QCheckBox(QString("&Automatically perform this action on the next call with %1").arg(skypeName
));
68 remember
->setEnabled(false);
69 widgets
.append(remember
);
70 vbox
->addWidget(remember
);
72 QHBoxLayout
*hbox
= new QHBoxLayout
;
74 QPushButton
*button
= new QPushButton("&Continue recording");
75 button
->setEnabled(false);
76 button
->setDefault(true);
77 widgets
.append(button
);
78 connect(button
, SIGNAL(clicked()), this, SLOT(yesClicked()));
79 hbox
->addWidget(button
);
81 button
= new QPushButton("&Stop recording and delete");
82 button
->setEnabled(false);
83 widgets
.append(button
);
84 connect(button
, SIGNAL(clicked()), this, SLOT(noClicked()));
85 hbox
->addWidget(button
);
87 vbox
->addLayout(hbox
);
89 connect(this, SIGNAL(rejected()), this, SIGNAL(no()));
90 QTimer::singleShot(1000, this, SLOT(enableWidgets()));
97 void RecordConfirmationDialog::yesClicked() {
99 if (remember
->isChecked())
100 preferences
.setPerCallerPreference(skypeName
, 2);
104 void RecordConfirmationDialog::noClicked() {
106 if (remember
->isChecked())
107 preferences
.setPerCallerPreference(skypeName
, 0);
111 void RecordConfirmationDialog::enableWidgets() {
112 for (int i
= 0; i
< widgets
.size(); i
++)
113 widgets
.at(i
)->setEnabled(true);