From: Joel Holdsworth Date: Thu, 20 Dec 2012 20:27:54 +0000 (+0000) Subject: Moved pv::About into the pv::dialogs::About namespace X-Git-Tag: pulseview-0.1.0~188 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=acda14b82957d9a848a5083df6f9b98d05c29fba;hp=238404062db14998f3b0ca93ae03a47543d219b8 Moved pv::About into the pv::dialogs::About namespace --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 52c5b566..e1893b6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,6 @@ configure_file ( set(pulseview_SOURCES main.cpp - pv/about.cpp pv/analogdata.cpp pv/analogdatasnapshot.cpp pv/datasnapshot.cpp @@ -90,6 +89,7 @@ set(pulseview_SOURCES pv/samplingbar.cpp pv/signaldata.cpp pv/sigsession.cpp + pv/dialogs/about.cpp pv/view/analogsignal.cpp pv/view/cursor.cpp pv/view/header.cpp @@ -102,10 +102,10 @@ set(pulseview_SOURCES ) set(pulseview_HEADERS - pv/about.h pv/mainwindow.h pv/samplingbar.h pv/sigsession.h + pv/dialogs/about.h pv/view/cursor.h pv/view/header.h pv/view/ruler.h @@ -115,7 +115,7 @@ set(pulseview_HEADERS ) set(pulseview_FORMS - pv/about.ui + pv/dialogs/about.ui ) set(pulseview_RESOURCES diff --git a/pv/about.cpp b/pv/about.cpp deleted file mode 100644 index 48c1f59e..00000000 --- a/pv/about.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of the PulseView project. - * - * Copyright (C) 2012 Joel Holdsworth - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -extern "C" { -#include -} - -#include - -#include "about.h" -#include - -extern "C" { -/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ -#define __STDC_FORMAT_MACROS -#include -#include -} - -namespace pv { - -About::About(QWidget *parent) : - QDialog(parent), - ui(new Ui::About) -{ - GSList *l; - struct sr_dev_driver **drivers; - struct sr_input_format **inputs; - struct sr_output_format **outputs; - struct srd_decoder *dec; - QString s; - - ui->setupUi(this); - - /* Setup the version field */ - ui->versionInfo->setText(tr("%1 %2
%3
%4") - .arg(QApplication::applicationName()) - .arg(QApplication::applicationVersion()) - .arg(tr("GNU GPL, version 2 or later")) - .arg(QApplication::organizationDomain())); - - s.append(""); - - /* Set up the supported field */ - s.append(""); - drivers = sr_driver_list(); - for (int i = 0; drivers[i]; ++i) { - s.append(QString("") - .arg(QString(drivers[i]->name)) - .arg(QString(drivers[i]->longname))); - } - - s.append(""); - inputs = sr_input_list(); - for (int i = 0; inputs[i]; ++i) { - s.append(QString("") - .arg(QString(inputs[i]->id)) - .arg(QString(inputs[i]->description))); - } - - s.append(""); - outputs = sr_output_list(); - for (int i = 0; outputs[i]; ++i) { - s.append(QString("") - .arg(QString(outputs[i]->id)) - .arg(QString(outputs[i]->description))); - } - - s.append(""); - for (l = srd_decoder_list(); l; l = l->next) { - dec = (struct srd_decoder *)l->data; - s.append(QString("") - .arg(QString(dec->id)) - .arg(QString(dec->longname))); - } - - s.append("
" + - tr("Supported hardware drivers:") + - "
%1%2
" + - tr("Supported input formats:") + - "
%1%2
" + - tr("Supported output formats:") + - "
%1%2
" + - tr("Supported protocol decoders:") + - "
%1%2
"); - - supportedDoc.reset(new QTextDocument(this)); - supportedDoc->setHtml(s); - ui->supportList->setDocument(supportedDoc.get()); -} - -About::~About() -{ - delete ui; -} - -} // namespace pv diff --git a/pv/about.h b/pv/about.h deleted file mode 100644 index 5b845cb4..00000000 --- a/pv/about.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the PulseView project. - * - * Copyright (C) 2012 Joel Holdsworth - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PULSEVIEW_PV_ABOUT_H -#define PULSEVIEW_PV_ABOUT_H - -#include - -#include - -class QTextDocument; - -namespace Ui { -class About; -} - -namespace pv { - -class About : public QDialog -{ - Q_OBJECT - -public: - explicit About(QWidget *parent = 0); - ~About(); - -private: - Ui::About *ui; - std::auto_ptr supportedDoc; -}; - -} // namespace pv - -#endif // PULSEVIEW_PV_ABOUT_H diff --git a/pv/about.ui b/pv/about.ui deleted file mode 100644 index 10163f9a..00000000 --- a/pv/about.ui +++ /dev/null @@ -1,96 +0,0 @@ - - - About - - - Qt::WindowModal - - - - 0 - 0 - 600 - 400 - - - - About - - - - - - - - - - - - - - :/icons/sigrok-logo-notext.png - - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - - - buttonBox - accepted() - About - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - About - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/pv/dialogs/about.cpp b/pv/dialogs/about.cpp new file mode 100644 index 00000000..a7778549 --- /dev/null +++ b/pv/dialogs/about.cpp @@ -0,0 +1,116 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +extern "C" { +#include +} + +#include + +#include "about.h" +#include + +extern "C" { +/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ +#define __STDC_FORMAT_MACROS +#include +#include +} + +namespace pv { +namespace dialogs { + +About::About(QWidget *parent) : + QDialog(parent), + ui(new Ui::About) +{ + GSList *l; + struct sr_dev_driver **drivers; + struct sr_input_format **inputs; + struct sr_output_format **outputs; + struct srd_decoder *dec; + QString s; + + ui->setupUi(this); + + /* Setup the version field */ + ui->versionInfo->setText(tr("%1 %2
%3
%4") + .arg(QApplication::applicationName()) + .arg(QApplication::applicationVersion()) + .arg(tr("GNU GPL, version 2 or later")) + .arg(QApplication::organizationDomain())); + + s.append(""); + + /* Set up the supported field */ + s.append(""); + drivers = sr_driver_list(); + for (int i = 0; drivers[i]; ++i) { + s.append(QString("") + .arg(QString(drivers[i]->name)) + .arg(QString(drivers[i]->longname))); + } + + s.append(""); + inputs = sr_input_list(); + for (int i = 0; inputs[i]; ++i) { + s.append(QString("") + .arg(QString(inputs[i]->id)) + .arg(QString(inputs[i]->description))); + } + + s.append(""); + outputs = sr_output_list(); + for (int i = 0; outputs[i]; ++i) { + s.append(QString("") + .arg(QString(outputs[i]->id)) + .arg(QString(outputs[i]->description))); + } + + s.append(""); + for (l = srd_decoder_list(); l; l = l->next) { + dec = (struct srd_decoder *)l->data; + s.append(QString("") + .arg(QString(dec->id)) + .arg(QString(dec->longname))); + } + + s.append("
" + + tr("Supported hardware drivers:") + + "
%1%2
" + + tr("Supported input formats:") + + "
%1%2
" + + tr("Supported output formats:") + + "
%1%2
" + + tr("Supported protocol decoders:") + + "
%1%2
"); + + supportedDoc.reset(new QTextDocument(this)); + supportedDoc->setHtml(s); + ui->supportList->setDocument(supportedDoc.get()); +} + +About::~About() +{ + delete ui; +} + +} // namespace dialogs +} // namespace pv diff --git a/pv/dialogs/about.h b/pv/dialogs/about.h new file mode 100644 index 00000000..cc153add --- /dev/null +++ b/pv/dialogs/about.h @@ -0,0 +1,53 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PULSEVIEW_PV_ABOUT_H +#define PULSEVIEW_PV_ABOUT_H + +#include + +#include + +class QTextDocument; + +namespace Ui { +class About; +} + +namespace pv { +namespace dialogs { + +class About : public QDialog +{ + Q_OBJECT + +public: + explicit About(QWidget *parent = 0); + ~About(); + +private: + Ui::About *ui; + std::auto_ptr supportedDoc; +}; + +} // namespace dialogs +} // namespace pv + +#endif // PULSEVIEW_PV_ABOUT_H diff --git a/pv/dialogs/about.ui b/pv/dialogs/about.ui new file mode 100644 index 00000000..10163f9a --- /dev/null +++ b/pv/dialogs/about.ui @@ -0,0 +1,96 @@ + + + About + + + Qt::WindowModal + + + + 0 + 0 + 600 + 400 + + + + About + + + + + + + + + + + + + + :/icons/sigrok-logo-notext.png + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + About + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + About + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 3f338a12..d8083b5f 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -32,9 +32,9 @@ extern "C" { #include #include -#include "about.h" #include "mainwindow.h" #include "samplingbar.h" +#include "dialogs/about.h" #include "pv/view/view.h" extern "C" { @@ -183,7 +183,7 @@ void MainWindow::on_actionViewShowCursors_triggered() void MainWindow::on_actionAbout_triggered() { - About dlg(this); + dialogs::About dlg(this); dlg.exec(); }