aboutdialog.cpp
author jhilmer
Tue, 16 Aug 2005 17:27:34 +0000
changeset 153 47cd4ae30000
parent 150 85eab6b8120b
child 155 7f06b2e3afb5
permissions -rw-r--r--
Fixed link handling in aboutdialog
     1 /* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
     2 
     3 #include <qmime.h>
     4 #include <qprocess.h>
     5 
     6 #include "aboutdialog.h"
     7 #include "version.h"
     8 #include "settings.h"
     9 #include "mainwindow.h"
    10 
    11 extern Main *mainWindow;
    12 extern Settings settings;
    13 
    14 AboutDialog::AboutDialog( QWidget *parent, const char *name)
    15     : QDialog( parent, name)
    16 {
    17  
    18     mainLayout=new QVBoxLayout( this, 10);
    19 
    20     tabs=new QTabWidget (this);
    21     credits=new AboutTextBrowser (this,"credits");
    22 
    23     credits->setText (
    24 	"<h3><img src=\"vym_logo\">VYM - View Your Mind </h3>"
    25 	"<p> A tool to put the things you have got in your mind into a map.</p>"
    26 	"<ul>"
    27 	"<li> (c) by Uwe Drechsel (<a href=\"mailto:vym@InSilmaril.de\">vym@InSilmaril.de</a>)</li>"
    28 	"<li> vym is released under the GPL (Gnu General Public License)"
    29 	", with one exception (see the file \"LICENSE\"which "
    30 	"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
    31 	"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
    32 	"http://www.InSilmaril.de/vym</a></li>"
    33 	"<li> Credits " 
    34 	"<ul>"
    35 	"<li>Jakob Hilmer for image drag and drop patch </li>"
    36 	"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
    37 	"<li>Clemens Kraus for stylesheets and script used for HTML-export "
    38 	"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
    39 	"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
    40 	"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
    41 	"<li>Ken Wimer and Olaf Hering for Mac support</li>"
    42 	"</ul>"
    43 	"</li>");
    44     credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
    45     tabs->addTab (credits,"Credits");
    46 
    47     license=new AboutTextBrowser (this,"license");
    48     license->setText ("License text...");
    49     credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
    50     tabs->addTab (license,"License");
    51 
    52     mainLayout->addWidget (tabs);
    53     tabs->showPage (credits);
    54 
    55     okbutton =new QPushButton (this,"okbutton");
    56     okbutton->setText (tr("Ok"));
    57     okbutton->setMaximumSize (QSize (50,30));
    58     okbutton->setAutoDefault (true);
    59     mainLayout->addWidget( okbutton); 
    60 
    61     connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    62 }
    63 
    64 AboutTextBrowser::AboutTextBrowser(QWidget *parent, const char *name)
    65     : QTextBrowser(parent, name)
    66 {
    67     
    68 }
    69 
    70 void AboutTextBrowser::setSource(const QString &name)
    71 {
    72     QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
    73     const QMimeSource *data = factory->data(name);
    74     if (data) {
    75 	QTextBrowser::setSource(name);
    76     } else {
    77 	QProcess *proc = new QProcess( this );
    78 	proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
    79 	proc->addArgument( name);
    80 	
    81 	if ( !proc->start() ) 
    82 	    if (mainWindow->settingsURL() ) 
    83 		setSource(name);
    84     }
    85 }