From b94655474228fc255edc354cac540190cbca74da Mon Sep 17 00:00:00 2001 From: jlh Date: Tue, 13 May 2008 20:43:00 +0200 Subject: [PATCH] Add a real about dialog It includes the copyright, the website URL, a notice about the GPL, the git commit and the build date. It doesn't include the full build time, since that would require version.cpp to be recompiled even if nothing changed but time. One such rebuild per day is ok. --- CMakeLists.txt | 6 ++--- about.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ recorder.h => about.h | 52 ++++--------------------------------- recorder.cpp | 8 ++++-- recorder.h | 3 +++ 5 files changed, 89 insertions(+), 52 deletions(-) create mode 100644 about.cpp copy recorder.h => about.h (51%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bc3ddd..0712825 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,9 @@ SET(CMAKE_CXX_FLAGS "-Wall -W -pipe -fno-rtti -fno-exceptions") SET(CMAKE_CXX_FLAGS_DEBUG "-ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "-O2") -SET(SOURCES call.cpp callgui.cpp common.cpp mp3writer.cpp preferences.cpp - recorder.cpp skype.cpp trayicon.cpp version.cpp wavewriter.cpp - writer.cpp) +SET(SOURCES about.cpp call.cpp callgui.cpp common.cpp mp3writer.cpp + preferences.cpp recorder.cpp skype.cpp trayicon.cpp version.cpp + wavewriter.cpp writer.cpp) SET(MOC_HEADERS call.h callgui.h preferences.h recorder.h skype.h smartwidgets.h trayicon.h) SET(RESOURCES resources.qrc) diff --git a/about.cpp b/about.cpp new file mode 100644 index 0000000..73dfe51 --- /dev/null +++ b/about.cpp @@ -0,0 +1,72 @@ +/* + Skype Call Recorder + Copyright (C) 2008 jlh (jlh at gmx dot ch) + + 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, version 3 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 + + The GNU General Public License version 2 is included with the source of + this program under the file name COPYING. You can also get a copy on + http://www.fsf.org/ +*/ + +#include +#include +#include + +#include "about.h" +#include "common.h" + +AboutDialog::AboutDialog() { + setWindowTitle(PROGRAM_NAME " - About"); + setAttribute(Qt::WA_DeleteOnClose); + + QVBoxLayout *vbox = new QVBoxLayout(this); + vbox->setSizeConstraint(QLayout::SetFixedSize); + + QString str = + "

Skype Call Recorder

" + + "

Copyright © 2008 jlh (jlh@gmx.ch)
" + "Website: http://atdot.ch/scr/

" + "
" + "

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, version 3 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.

" + "
" + "

Git commit: %1
" + "Build date: %2

"; + str = str.arg(recorderCommit, recorderDate); + QLabel *label = new QLabel(str); + label->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse); + label->setFont(QFont("Arial", 9)); + label->setTextFormat(Qt::RichText); + label->setOpenExternalLinks(true); + vbox->addWidget(label); + + QPushButton *button = new QPushButton("&Close"); + connect(button, SIGNAL(clicked()), this, SLOT(close())); + vbox->addWidget(button); + + show(); +} + diff --git a/recorder.h b/about.h similarity index 51% copy from recorder.h copy to about.h index 4f43b04..43cc582 100644 --- a/recorder.h +++ b/about.h @@ -21,56 +21,14 @@ http://www.fsf.org/ */ -#ifndef RECORDER_H -#define RECORDER_H +#ifndef ABOUT_H +#define ABOUT_H -#include -#include +#include -class TrayIcon; -class QTextEdit; -class QString; -class PreferencesDialog; -class Skype; -class CallHandler; - -class Recorder : public QApplication { - Q_OBJECT +class AboutDialog : public QDialog { public: - Recorder(int, char **); - virtual ~Recorder(); - - void debugMessage(const QString &); - -public slots: - void about(); - void openPreferences(); - void closePreferences(); - void browseCalls(); - void quitConfirmation(); - void skypeNotify(const QString &); - void skypeConnected(bool); - void skypeConnectionFailed(const QString &); - void savePreferences(); - -private: - void loadPreferences(); - void setupGUI(); - void setupSkype(); - void setupCallHandler(); - - QString getConfigFile() const; - -private: - Skype *skype; - CallHandler *callHandler; - PreferencesDialog *preferencesDialog; - TrayIcon *trayIcon; - -private: - // disabled - Recorder(const Recorder &); - Recorder &operator=(const Recorder &); + AboutDialog(); }; #endif diff --git a/recorder.cpp b/recorder.cpp index 4a55ed1..a8cb74d 100644 --- a/recorder.cpp +++ b/recorder.cpp @@ -31,6 +31,7 @@ #include "recorder.h" #include "common.h" +#include "about.h" #include "trayicon.h" #include "preferences.h" #include "skype.h" @@ -126,8 +127,11 @@ void Recorder::savePreferences() { } void Recorder::about() { - QMessageBox::information(NULL, PROGRAM_NAME " - About", - "This is a place holder for a future about dialog."); + if (!aboutDialog) + aboutDialog = new AboutDialog; + + aboutDialog->raise(); + aboutDialog->activateWindow(); } void Recorder::openPreferences() { diff --git a/recorder.h b/recorder.h index 4f43b04..a907be1 100644 --- a/recorder.h +++ b/recorder.h @@ -26,6 +26,7 @@ #include #include +#include class TrayIcon; class QTextEdit; @@ -33,6 +34,7 @@ class QString; class PreferencesDialog; class Skype; class CallHandler; +class AboutDialog; class Recorder : public QApplication { Q_OBJECT @@ -66,6 +68,7 @@ private: CallHandler *callHandler; PreferencesDialog *preferencesDialog; TrayIcon *trayIcon; + QPointer aboutDialog; private: // disabled -- 2.11.4.GIT