kaboutdialog.h
/*
* This file is part of the KDE Libraries
* Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and
* Espen Sand (espen@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
/*
* This file declares a class for creating "About ..." dialogs
* in a general way. It provides geometry management and some
* options to connect for, like emailing the author or maintainer.
*/
#ifndef _KABOUTDIALOG_H_
#define _KABOUTDIALOG_H_
#include <kdialogbase.h>
#include <qstring.h>
class QFrame;
class QLabel;
class QVBoxLayout;
class QTabWidget;
class KURLLabel;
class KAboutContainer;
class KAboutContainerBase;
class KAboutWidgetPrivate;
class KAboutContainerPrivate;
class KDEUI_EXPORT KAboutContainer : public QFrame
{
Q_OBJECT
public:
KAboutContainer( QWidget *parent=0, const char *name=0,
int margin=0, int spacing=0,
int childAlignment = AlignCenter,
int innerAlignment = AlignCenter );
void addWidget( QWidget *widget );
void addPerson( const QString &name, const QString &email,
const QString &url, const QString &task,
bool showHeader = false, bool showframe = false,
bool showBold = false );
void addTitle( const QString &title, int alignment=AlignLeft,
bool showframe = false, bool showBold = false );
void addImage( const QString &fileName, int alignment=AlignLeft );
virtual QSize sizeHint( void ) const;
virtual QSize minimumSizeHint( void ) const;
protected:
virtual void childEvent( QChildEvent *e );
signals:
void urlClick( const QString &url );
void mailClick( const QString &name, const QString &address );
private:
QVBoxLayout *mVbox;
int mAlignment;
KAboutContainerPrivate* const d;
};
class KAboutContributorPrivate;
class KDEUI_EXPORT KAboutContributor : public QFrame
{
Q_OBJECT
public:
KAboutContributor( QWidget *parent=0, const char *name=0,
const QString &username=QString::null,
const QString &email=QString::null,
const QString &url=QString::null,
const QString &work=QString::null,
bool showHeader=false, bool showFrame=true,
bool showBold=false );
void setName( const QString &text, const QString &header=QString::null,
bool update = true );
void setEmail( const QString &text, const QString &header=QString::null,
bool update = true );
void setURL( const QString &text, const QString &header=QString::null,
bool update = true );
void setWork( const QString &text, const QString &header=QString::null,
bool update = true );
QString getName( void ) const;
QString getEmail( void ) const;
QString getURL( void ) const;
QString getWork( void ) const;
virtual QSize sizeHint( void ) const;
protected:
virtual void fontChange( const QFont &oldFont );
protected slots:
void urlClickedSlot( const QString& );
void emailClickedSlot( const QString& emailaddress );
private:
void updateLayout( void );
signals:
void sendEmail(const QString& name, const QString& email);
void openURL(const QString& url);
private:
QLabel *mLabel[4];
QLabel *mText[4];
bool mShowHeader;
bool mShowBold;
KAboutContributorPrivate* const d;
virtual void setName(const char *_name) { QFrame::setName(_name); }
};
class KDEUI_EXPORT KAboutWidget : public QWidget
{
Q_OBJECT
public:
KAboutWidget(QWidget* parent=0, const char* name=0 );
void adjust();
void setLogo(const QPixmap&);
void setAuthor(const QString& name, const QString& email,
const QString& url, const QString& work);
void setMaintainer(const QString& name, const QString& email,
const QString& url, const QString& work);
void addContributor(const QString& name, const QString& email,
const QString& url, const QString& work);
void setVersion(const QString& name);
// -------------------------------------------------------------------------
protected slots:
void sendEmailSlot(const QString& name, const QString& email);
void openURLSlot(const QString& url);
// -------------------------------------------------------------------------
signals:
void sendEmail(const QString& name, const QString& email);
void openURL(const QString& url);
// -------------------------------------------------------------------------
protected:
// events:
void resizeEvent(QResizeEvent*);
QLabel *version;
QLabel *cont;
QLabel *logo;
KAboutContributor *author;
KAboutContributor *maintainer;
bool showMaintainer;
QPtrList<KAboutContributor> contributors;
// #########################################################################
//
private:
KAboutWidgetPrivate* const d;
};
class KAboutDialogPrivate;
class KDEUI_EXPORT KAboutDialog : public KDialogBase
{
Q_OBJECT
public:
enum LayoutType
{
AbtPlain = 0x0001,
AbtTabbed = 0x0002,
AbtTitle = 0x0004,
AbtImageLeft = 0x0008,
AbtImageRight = 0x0010,
AbtImageOnly = 0x0020,
AbtProduct = 0x0040,
AbtKDEStandard = AbtTabbed|AbtTitle|AbtImageLeft,
AbtAppStandard = AbtTabbed|AbtTitle|AbtProduct,
AbtImageAndTitle = AbtPlain|AbtTitle|AbtImageOnly
};
public:
KAboutDialog( QWidget *parent=0, const char *name=0, bool modal=true );
KAboutDialog( int dialogLayout, const QString &caption, int buttonMask,
ButtonCode defaultButton, QWidget *parent=0,
const char *name=0, bool modal=false, bool separator = false,
const QString &user1 = QString::null,
const QString &user2 = QString::null,
const QString &user3 = QString::null );
void adjust();
virtual void show( void );
virtual void show( QWidget *centerParent );
void setTitle( const QString &title );
void setImage( const QString &fileName );
void setIcon( const QString &fileName ) KDE_DEPRECATED; // KDE4: remove
void setProgramLogo( const QString &fileName );
void setProgramLogo( const QPixmap &pixmap );
void setImageBackgroundColor( const QColor &color );
void setImageFrame( bool state );
void setProduct( const QString &appName, const QString &version,
const QString &author, const QString &year );
QFrame *addTextPage( const QString &title, const QString &text,
bool richText=false, int numLines=10 );
QFrame *addLicensePage( const QString &title, const QString &text,
int numLines=10 );
KAboutContainer *addContainerPage( const QString &title,
int childAlignment = AlignCenter, int innerAlignment = AlignCenter );
KAboutContainer *addScrolledContainerPage( const QString &title,
int childAlignment = AlignCenter, int innerAlignment = AlignCenter );
KAboutContainer *addContainer( int childAlignment, int innerAlignment );
QFrame *addPage( const QString &title );
void setLogo(const QPixmap&);
void setAuthor(const QString& name, const QString& email,
const QString& url, const QString& work);
void setMaintainer(const QString& name, const QString& email,
const QString& url, const QString& work);
void addContributor(const QString& name, const QString& email,
const QString& url, const QString& work);
void setVersion(const QString& name);
static void imageURL( QWidget *parent, const QString &caption,
const QString &path, const QColor &imageColor,
const QString &url );
signals:
void sendEmail(const QString& name, const QString& email);
void openURL(const QString& url);
// ----------------------------------------------------------------------------
protected:
KAboutWidget * about;
KAboutContainerBase *mContainerBase;
// -------------------------------------------------------------------------
protected slots:
void sendEmailSlot(const QString& name, const QString& email);
void openURLSlot(const QString& url);
virtual void mouseTrackSlot( int mode, const QMouseEvent *e );
// #########################################################################
protected:
virtual void virtual_hook( int id, void* data );
private:
KAboutDialogPrivate* const d;
};
#endif // defined KABOUTDIALOG_H
KURLLabel
A drop-in replacement for QLabel that displays hyperlinks.
Definition: kurllabel.h:71
KAboutDialog::about
KAboutWidget * about
The main widget (Constructor I)
Definition: kaboutdialog.h:599
KAboutContainer
KAboutContainer can be used to make a application specific AboutDialog.
Definition: kaboutdialog.h:50
KAboutWidget::logo
QLabel * logo
The frame showing the logo.
Definition: kaboutdialog.h:228
KDialogBase::addPage
QFrame * addPage(const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
Add a page to the dialog when the class is used in TreeList , IconList or Tabbed mode.
Definition: kdialogbase.cpp:1296
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KAboutWidget::cont
QLabel * cont
The label showing the text "Other contributors:".
Definition: kaboutdialog.h:224
KAboutWidget::showMaintainer
bool showMaintainer
Show the maintainer?
Definition: kaboutdialog.h:240
KAboutContributor
Used internally by KAboutWidget.
Definition: kaboutdialog.h:92
KAboutDialog::mContainerBase
KAboutContainerBase * mContainerBase
The main widget (Constructor II)
Definition: kaboutdialog.h:604
KAboutDialog
A KDialogBase with predefined main widget.
Definition: kaboutdialog.h:283
KAboutDialog::LayoutType
LayoutType
Layout formats.
Definition: kaboutdialog.h:291
KAboutWidget::contributors
QPtrList< KAboutContributor > contributors
A set of people who contributed to the application.
Definition: kaboutdialog.h:244
KAboutWidget::maintainer
KAboutContributor * maintainer
The application maintainer.
Definition: kaboutdialog.h:236
KAboutWidget::author
KAboutContributor * author
The application developer.
Definition: kaboutdialog.h:232
KAboutWidget
KAboutWidget is the main widget for KAboutDialog.
Definition: kaboutdialog.h:150
KAboutWidget::version
QLabel * version
The label showing the program version.
Definition: kaboutdialog.h:220
KAboutContainerBase
Used internally by KAboutDialog.
Definition: kaboutdialog_private.h:69

KDE Home | KDE Accessibility Home | Description of Access Keys