[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 3 |
|
---|
| 4 | This program is free software; you can redistribute it and/or modify
|
---|
| 5 | it under the terms of the GNU General Public License as published by
|
---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
---|
| 7 | (at your option) any later version.
|
---|
| 8 |
|
---|
| 9 | This program is distributed in the hope that it will be useful,
|
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 12 | GNU General Public License for more details.
|
---|
| 13 |
|
---|
| 14 | You should have received a copy of the GNU General Public License
|
---|
| 15 | along with this program; if not, write to the Free Software
|
---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | #include "errordialog.h"
|
---|
| 20 | #include "images.h"
|
---|
| 21 |
|
---|
[181] | 22 | #if QT_VERSION >= 0x050000
|
---|
| 23 | #include "myscroller.h"
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
[112] | 26 | ErrorDialog::ErrorDialog( QWidget* parent, Qt::WindowFlags f )
|
---|
| 27 | : QDialog(parent, f)
|
---|
| 28 | {
|
---|
| 29 | setupUi(this);
|
---|
| 30 |
|
---|
[181] | 31 | #if QT_VERSION >= 0x050000
|
---|
| 32 | MyScroller::setScroller(log->viewport());
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | text->setOpenExternalLinks(true);
|
---|
| 36 |
|
---|
[112] | 37 | icon->setText("");
|
---|
[156] | 38 | icon->setPixmap( Images::icon("crash") );
|
---|
[112] | 39 |
|
---|
[176] | 40 | intro_label->setText("<html><head/><body><p align=\"left\"><span style=\"font-size:14pt; font-weight:600;\">" + tr("Oops, something went wrong") +"</span></p></body></html>");
|
---|
[156] | 41 |
|
---|
[112] | 42 | text->setText("");
|
---|
| 43 | toggleLog(false);
|
---|
| 44 |
|
---|
| 45 | connect( viewlog_button, SIGNAL(toggled(bool)),
|
---|
| 46 | this, SLOT(toggleLog(bool)) );
|
---|
| 47 |
|
---|
| 48 | layout()->setSizeConstraint(QLayout::SetFixedSize);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | ErrorDialog::~ErrorDialog() {
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | void ErrorDialog::setText(QString error) {
|
---|
| 55 | text->setText(error);
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | void ErrorDialog::setLog(QString log_text) {
|
---|
| 59 | log->setPlainText("");
|
---|
| 60 | log->append(log_text); // To move cursor to the end
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | void ErrorDialog::toggleLog(bool checked) {
|
---|
| 64 | log->setVisible(checked);
|
---|
| 65 |
|
---|
| 66 | if (checked)
|
---|
| 67 | viewlog_button->setText(tr("Hide log"));
|
---|
| 68 | else
|
---|
| 69 | viewlog_button->setText(tr("Show log"));
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | #include "moc_errordialog.cpp"
|
---|