• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
PluginAboutDialog.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <bastianholst@gmx.de>
9 //
10 
11 // Self
12 #include "PluginAboutDialog.h"
13 
14 // Marble
15 #include "MarbleDirs.h"
16 #include "ui_MarbleAboutDialog.h"
17 
18 // Qt
19 #include <QTextStream>
20 
21 namespace Marble
22 {
23 
24 // The index of the "Data" tab.
25 int dataTabIndex = 2;
26 
27 class PluginAboutDialogPrivate
28 {
29  public:
30  PluginAboutDialogPrivate()
31  {
32  }
33  ~PluginAboutDialogPrivate()
34  {
35  }
36 
37  Ui::MarbleAboutDialog u_dialog;
38 };
39 
40 PluginAboutDialog::PluginAboutDialog( QWidget *parent )
41  : QDialog( parent ),
42  d( new PluginAboutDialogPrivate() )
43 {
44  d->u_dialog.setupUi( this );
45 
46  setAboutText( QString() );
47  setAuthorsText( QString() );
48  setDataText( QString() );
49  setLicenseAgreementText( QString() );
50 }
51 
52 PluginAboutDialog::~PluginAboutDialog()
53 {
54  delete d;
55 }
56 
57 void PluginAboutDialog::setName( const QString& name )
58 {
59  d->u_dialog.m_pMarbleTitleLabel->setText( name );
60  setWindowTitle( tr( "About %1" ).arg( name ) );
61 }
62 
63 void PluginAboutDialog::setVersion( const QString& version )
64 {
65  d->u_dialog.m_pMarbleVersionLabel->setText( tr( "Version %1" ).arg( version ) );
66 }
67 
68 void PluginAboutDialog::setIcon( const QIcon& icon )
69 {
70  d->u_dialog.m_pMarbleLogoLabel->setPixmap( icon.pixmap( 64, 64 ) );
71 }
72 
73 void PluginAboutDialog::setAboutText( const QString& about )
74 {
75  d->u_dialog.m_pMarbleAboutBrowser->setText( about );
76 }
77 
78 void PluginAboutDialog::setAuthors( const QList<PluginAuthor>& authors )
79 {
80  QString string;
81  foreach ( const PluginAuthor& author, authors ) {
82  string += author.name;
83  string += "\n ";
84  string += author.email;
85  string += "\n ";
86  string += author.task;
87  string += "\n\n";
88  }
89 
90  setAuthorsText( string );
91 }
92 
93 void PluginAboutDialog::setAuthorsText( const QString& authors )
94 {
95  d->u_dialog.m_pMarbleAuthorsBrowser->setText( authors );
96 }
97 
98 void PluginAboutDialog::setDataText( const QString& data )
99 {
100  if ( data.isNull() ) {
101  d->u_dialog.tabWidget->removeTab( d->u_dialog.tabWidget->indexOf( d->u_dialog.m_dataTab ) );
102  }
103  else {
104  d->u_dialog.tabWidget->insertTab( dataTabIndex, d->u_dialog.m_dataTab, tr( "Data" ) );
105  d->u_dialog.m_pMarbleDataBrowser->setText( data );
106  }
107 }
108 
109 void PluginAboutDialog::setLicense( PluginAboutDialog::LicenseKey license )
110 {
111  QString filename;
112  switch ( license ) {
113  case PluginAboutDialog::License_LGPL_V2:
114  filename = "lgpl2.txt";
115  break;
116  default:
117  filename = "lgpl2.txt";
118  }
119 
120  QString path = MarbleDirs::path( "licenses/" + filename );
121  QTextBrowser *browser = d->u_dialog.m_pMarbleLicenseBrowser;
122  browser->setText( QString() );
123  if( !path.isEmpty() )
124  {
125  QFile f( path );
126  if( f.open( QIODevice::ReadOnly ) )
127  {
128  QTextStream ts( &f );
129  browser->setText( ts.readAll() );
130  }
131  f.close();
132  }
133 }
134 
135 void PluginAboutDialog::setLicenseAgreementText( const QString& license )
136 {
137  if ( license.isNull() ) {
138  setLicense( PluginAboutDialog::License_LGPL_V2 );
139  }
140  else {
141  d->u_dialog.m_pMarbleLicenseBrowser->setText( license );
142  }
143 }
144 
145 } // namespace Marble
146 
147 #include "PluginAboutDialog.moc"
Marble::PluginAboutDialog::setDataText
void setDataText(const QString &data)
Sets the text displayed in the "Data" tab of the dialog.
Definition: PluginAboutDialog.cpp:98
Marble::PluginAboutDialog::setAuthorsText
void setAuthorsText(const QString &authors)
Sets the text displayed in the "Authors" tab of the dialog.
Definition: PluginAboutDialog.cpp:93
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:53
QDialog
Marble::dataTabIndex
int dataTabIndex
Definition: PluginAboutDialog.cpp:25
Marble::PluginAuthor::email
QString email
Definition: PluginInterface.h:38
QWidget
Marble::PluginAuthor
Definition: PluginInterface.h:28
Marble::PluginAboutDialog::License_LGPL_V2
Definition: PluginAboutDialog.h:36
Marble::PluginAboutDialog::setName
void setName(const QString &name)
Sets the name of the plugin.
Definition: PluginAboutDialog.cpp:57
Marble::PluginAboutDialog::setLicenseAgreementText
void setLicenseAgreementText(const QString &license)
Sets the text displayed in the "License Agreement" tab of the dialog.
Definition: PluginAboutDialog.cpp:135
MarbleDirs.h
Marble::PluginAuthor::name
QString name
Definition: PluginInterface.h:36
Marble::PluginAuthor::task
QString task
Definition: PluginInterface.h:37
Marble::PluginAboutDialog::setVersion
void setVersion(const QString &version)
Sets the version of the plugin;.
Definition: PluginAboutDialog.cpp:63
Marble::PluginAboutDialog::LicenseKey
LicenseKey
Definition: PluginAboutDialog.h:31
Marble::PluginAboutDialog::setAboutText
void setAboutText(const QString &about)
Sets the text displayed in the "About" tab of the dialog.
Definition: PluginAboutDialog.cpp:73
PluginAboutDialog.h
Marble::PluginAboutDialog::~PluginAboutDialog
virtual ~PluginAboutDialog()
Definition: PluginAboutDialog.cpp:52
Marble::PluginAboutDialog::setIcon
void setIcon(const QIcon &icon)
Sets the icon to be displayed at the top of the dialog.
Definition: PluginAboutDialog.cpp:68
Marble::PluginAboutDialog::setLicense
void setLicense(PluginAboutDialog::LicenseKey license)
Sets the license for the "License Agreement" tab of the dialog.
Definition: PluginAboutDialog.cpp:109
Marble::PluginAboutDialog::PluginAboutDialog
PluginAboutDialog(QWidget *parent=0)
Definition: PluginAboutDialog.cpp:40
Marble::PluginAboutDialog::setAuthors
void setAuthors(const QList< PluginAuthor > &authors)
Sets the authors working on this plugin.
Definition: PluginAboutDialog.cpp:78
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal