23 #include <tqclipboard.h>
27 #include <ktextedit.h>
28 #include <tqobjectlist.h>
29 #include <tqpainter.h>
31 #include <tqtabwidget.h>
34 #include <tdeapplication.h>
35 #include <tdeglobal.h>
36 #include <tdeglobalsettings.h>
38 #include <ktextbrowser.h>
39 #include <kurllabel.h>
40 #include <tdeaboutdialog.h>
41 #include <kaboutdialog_private.h>
45 template class TQPtrList<TDEAboutContributor>;
48 #define WORKTEXT_IDENTATION 16
53 #include "tdeaboutdialog.moc"
54 #include "kaboutdialog_private.moc"
57 class TDEAboutTabWidget :
public TQTabWidget
60 TDEAboutTabWidget( TQWidget* parent ) : TQTabWidget( parent ) {}
61 TQSize sizeHint()
const {
62 return TQTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + TQSize(4,4) );
69 TDEAboutContributor::TDEAboutContributor( TQWidget *_parent,
const char *wname,
70 const TQString &_name,
const TQString &_email,
71 const TQString &_url,
const TQString &_work,
72 bool showHeader,
bool showFrame,
74 : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0)
78 setFrameStyle(TQFrame::Panel | TQFrame::Raised);
81 mLabel[0] =
new TQLabel(
this );
82 mLabel[1] =
new TQLabel(
this );
83 mLabel[2] =
new TQLabel(
this );
84 mLabel[3] =
new TQLabel(
this );
85 mText[0] =
new TQLabel(
this );
88 mText[3] =
new TQLabel(
this );
90 setName( _name, i18n(
"Author"),
false );
91 setEmail( _email, i18n(
"Email"),
false );
92 setURL( _url, i18n(
"Homepage"),
false );
93 setWork( _work, i18n(
"Task"),
false );
99 connect(kurl, TQ_SIGNAL(leftClickedURL(
const TQString &)),
100 TQ_SLOT(emailClickedSlot(
const TQString &)));
102 kurl =
static_cast<KURLLabel *
>(mText[2]);
106 connect(kurl, TQ_SIGNAL(leftClickedURL(
const TQString &)),
107 TQ_SLOT(urlClickedSlot(
const TQString &)));
109 mLabel[3]->setAlignment( AlignTop );
111 fontChange( font() );
116 void TDEAboutContributor::setName(
const TQString &_text,
const TQString &_header,
119 mLabel[0]->setText(_header);
120 mText[0]->setText(_text);
121 if( _update ) { updateLayout(); }
125 void TDEAboutContributor::setEmail(
const TQString &_text,
const TQString &_header,
128 mLabel[1]->setText(_header);
130 kurl->setText(_text);
132 if( _update ) { updateLayout(); }
136 void TDEAboutContributor::setURL(
const TQString &_text,
const TQString &_header,
139 mLabel[2]->setText(_header);
141 kurl->setText(_text);
143 if( _update ) { updateLayout(); }
147 void TDEAboutContributor::setWork(
const TQString &_text,
const TQString &_header,
150 mLabel[3]->setText(_header);
151 mText[3]->setText(_text);
152 if( _update ) { updateLayout(); }
156 TQString TDEAboutContributor::getName(
void )
const
158 return mText[0]->text();
162 TQString TDEAboutContributor::getEmail(
void )
const
164 return mText[1]->text();
168 TQString TDEAboutContributor::getURL(
void )
const
170 return mText[2]->text();
174 TQString TDEAboutContributor::getWork(
void )
const
176 return mText[3]->text();
181 void TDEAboutContributor::updateLayout(
void )
186 if( !mText[0]->text().isEmpty() ) { ++row; }
187 if( !mText[1]->text().isEmpty() ) { ++row; }
188 if( !mText[2]->text().isEmpty() ) { ++row; }
189 if( !mText[3]->text().isEmpty() ) { ++row; }
195 gbox =
new TQGridLayout(
this, 1, 1, 0 );
196 for(
int i=0; i<4; ++i )
204 if( mText[0]->text().isEmpty() && !mShowHeader )
206 gbox =
new TQGridLayout(
this, row, 1, frameWidth()+1, 2 );
210 gbox =
new TQGridLayout(
this, row, 2, frameWidth()+1, 2 );
215 gbox->setColStretch( 1, 10 );
218 for(
int i=0, r=0; i<4; ++i )
220 mLabel[i]->setFixedHeight( fontMetrics().lineSpacing() );
223 mText[i]->setFixedHeight( fontMetrics().lineSpacing() );
226 if( !mText[i]->text().isEmpty() )
230 gbox->addWidget( mLabel[i], r, 0, (TQt::AlignmentFlags)AlignLeft );
231 gbox->addWidget( mText[i], r, 1, (TQt::AlignmentFlags)AlignLeft );
240 gbox->addMultiCellWidget( mText[i], r, r, 0, 1, (TQt::AlignmentFlags)AlignLeft );
244 gbox->addWidget( mText[i], r, 1, (TQt::AlignmentFlags)AlignLeft );
259 setMinimumSize( sizeHint() );
263 void TDEAboutContributor::fontChange(
const TQFont & )
269 mText[0]->setFont( f );
275 TQSize TDEAboutContributor::sizeHint(
void )
const
277 return minimumSizeHint();
281 void TDEAboutContributor::urlClickedSlot(
const TQString &u )
287 void TDEAboutContributor::emailClickedSlot(
const TQString &e )
289 emit sendEmail( mText[0]->text(), e ) ;
296 TDEAboutContainerBase::TDEAboutContainerBase(
int layoutType, TQWidget *_parent,
298 : TQWidget( _parent, _name ),
299 mImageLabel(0), mTitleLabel(0), mIconLabel(0),mVersionLabel(0),
300 mAuthorLabel(0), mImageFrame(0),mPageTab(0),mPlainSpace(0),d(0)
303 if( !mTopLayout ) {
return; }
305 if( layoutType & AbtImageOnly )
307 layoutType &= ~(AbtImageLeft|AbtImageRight|AbtTabbed|AbtPlain);
309 if( layoutType & AbtImageLeft )
311 layoutType &= ~AbtImageRight;
314 if( layoutType & AbtTitle )
316 mTitleLabel =
new TQLabel(
this,
"title" );
317 mTitleLabel->setAlignment(AlignCenter);
318 mTopLayout->addWidget( mTitleLabel );
322 if( layoutType & AbtProduct )
324 TQWidget*
const productArea =
new TQWidget(
this,
"area" );
325 mTopLayout->addWidget( productArea, 0, TQApplication::reverseLayout() ? AlignRight : AlignLeft );
328 if( !hbox ) {
return; }
330 mIconLabel =
new TQLabel( productArea );
331 hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter );
333 TQVBoxLayout*
const vbox =
new TQVBoxLayout();
334 if( !vbox ) {
return; }
335 hbox->addLayout( vbox );
337 mVersionLabel =
new TQLabel( productArea,
"version" );
338 mAuthorLabel =
new TQLabel( productArea,
"author" );
339 vbox->addWidget( mVersionLabel );
340 vbox->addWidget( mAuthorLabel );
346 TQHBoxLayout*
const hbox =
new TQHBoxLayout();
347 if( !hbox ) {
return; }
348 mTopLayout->addLayout( hbox, 10 );
350 if( layoutType & AbtImageLeft )
352 TQVBoxLayout* vbox =
new TQVBoxLayout();
353 hbox->addLayout(vbox);
355 mImageFrame =
new TQFrame(
this );
356 setImageFrame(
true );
357 vbox->addWidget( mImageFrame );
360 vbox =
new TQVBoxLayout( mImageFrame, 1 );
362 connect( mImageLabel, TQ_SIGNAL(mouseTrack(
int,
const TQMouseEvent * )),
363 TQ_SLOT( slotMouseTrack(
int,
const TQMouseEvent * )) );
364 vbox->addStretch(10);
365 vbox->addWidget( mImageLabel );
366 vbox->addStretch(10);
370 if( layoutType & AbtTabbed )
372 mPageTab =
new TDEAboutTabWidget(
this );
373 if( !mPageTab ) {
return; }
374 hbox->addWidget( mPageTab, 10 );
376 else if( layoutType & AbtImageOnly )
378 mImageFrame =
new TQFrame(
this );
379 setImageFrame(
true );
380 hbox->addWidget( mImageFrame, 10 );
382 TQGridLayout*
const gbox =
new TQGridLayout(mImageFrame, 3, 3, 1, 0 );
383 gbox->setRowStretch( 0, 10 );
384 gbox->setRowStretch( 2, 10 );
385 gbox->setColStretch( 0, 10 );
386 gbox->setColStretch( 2, 10 );
389 connect( mImageLabel, TQ_SIGNAL(mouseTrack(
int,
const TQMouseEvent * )),
390 TQ_SLOT( slotMouseTrack(
int,
const TQMouseEvent * )) );
391 gbox->addWidget( mImageLabel, 1, 1 );
396 mPlainSpace =
new TQFrame(
this );
397 if( !mPlainSpace ) {
return; }
398 hbox->addWidget( mPlainSpace, 10 );
401 if( layoutType & AbtImageRight )
403 TQVBoxLayout *vbox =
new TQVBoxLayout();
404 hbox->addLayout(vbox);
406 mImageFrame =
new TQFrame(
this );
407 setImageFrame(
true );
408 vbox->addWidget( mImageFrame );
411 vbox =
new TQVBoxLayout( mImageFrame, 1 );
413 connect( mImageLabel, TQ_SIGNAL(mouseTrack(
int,
const TQMouseEvent * )),
414 TQ_SLOT( slotMouseTrack(
int,
const TQMouseEvent * )) );
415 vbox->addStretch(10);
416 vbox->addWidget( mImageLabel );
417 vbox->addStretch(10);
421 fontChange( font() );
425 void TDEAboutContainerBase::show(
void )
430 TQSize TDEAboutContainerBase::sizeHint(
void )
const
432 return minimumSize().expandedTo( TQSize( TQWidget::sizeHint().width(), 0 ) );
435 void TDEAboutContainerBase::fontChange(
const TQFont & )
441 int fs = f.pointSize();
443 fs = TQFontInfo(f).pointSize();
444 f.setPointSize( fs+2 );
445 mTitleLabel->setFont(f);
452 mVersionLabel->setFont(f);
453 mAuthorLabel->setFont(f);
454 mVersionLabel->parentWidget()->layout()->activate();
460 TQFrame *TDEAboutContainerBase::addTextPage(
const TQString &title,
461 const TQString &text,
462 bool richText,
int numLines )
464 TQFrame*
const page = addEmptyPage( title );
465 if( !page ) {
return 0; }
466 if( numLines <= 0 ) { numLines = 10; }
473 browser->setHScrollBarMode( TQScrollView::AlwaysOff );
474 browser->setText( text );
475 browser->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
477 vbox->addWidget(browser);
478 connect(browser, TQ_SIGNAL(urlClick(
const TQString &)),
479 TQ_SLOT(slotUrlClick(
const TQString &)));
480 connect(browser, TQ_SIGNAL(mailClick(
const TQString &,
const TQString &)),
481 TQ_SLOT(slotMailClick(
const TQString &,
const TQString &)));
487 textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
488 textEdit->setWordWrap( TQTextEdit::NoWrap );
489 vbox->addWidget( textEdit );
495 TQFrame *TDEAboutContainerBase::addLicensePage(
const TQString &title,
496 const TQString &text,
int numLines)
498 TQFrame*
const page = addEmptyPage( title );
499 if( !page ) {
return 0; }
500 if( numLines <= 0 ) { numLines = 10; }
507 textEdit->setWordWrap( TQTextEdit::NoWrap );
508 textEdit->setText( text );
509 textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
510 vbox->addWidget( textEdit );
515 TDEAboutContainer *TDEAboutContainerBase::addContainerPage(
const TQString &title,
521 kdDebug(291) <<
"addPage: " <<
"Invalid layout" <<
endl;
528 mPageTab->addTab( container, title );
530 connect(container, TQ_SIGNAL(urlClick(
const TQString &)),
531 TQ_SLOT(slotUrlClick(
const TQString &)));
532 connect(container, TQ_SIGNAL(mailClick(
const TQString &,
const TQString &)),
533 TQ_SLOT(slotMailClick(
const TQString &,
const TQString &)));
540 const TQString &title,
546 kdDebug(291) <<
"addPage: " <<
"Invalid layout" <<
endl;
550 TQFrame*
const page = addEmptyPage( title );
552 TQScrollView*
const scrollView =
new TQScrollView( page );
553 scrollView->viewport()->setBackgroundMode( PaletteBackground );
554 vbox->addWidget( scrollView );
559 scrollView->addChild( container );
562 connect(container, TQ_SIGNAL(urlClick(
const TQString &)),
563 TQ_SLOT(slotUrlClick(
const TQString &)));
564 connect(container, TQ_SIGNAL(mailClick(
const TQString &,
const TQString &)),
565 TQ_SLOT(slotMailClick(
const TQString &,
const TQString &)));
571 TQFrame *TDEAboutContainerBase::addEmptyPage(
const TQString &title )
575 kdDebug(291) <<
"addPage: " <<
"Invalid layout" <<
endl;
579 TQFrame*
const page =
new TQFrame( mPageTab, title.latin1() );
580 page->setFrameStyle( TQFrame::NoFrame );
582 mPageTab->addTab( page, title );
592 mTopLayout->addWidget( container, 0, childAlignment );
594 connect(container, TQ_SIGNAL(urlClick(
const TQString &)),
595 TQ_SLOT(slotUrlClick(
const TQString &)));
596 connect(container, TQ_SIGNAL(mailClick(
const TQString &,
const TQString &)),
597 TQ_SLOT(slotMailClick(
const TQString &,
const TQString &)));
604 void TDEAboutContainerBase::setTitle(
const TQString &title )
608 kdDebug(291) <<
"setTitle: " <<
"Invalid layout" <<
endl;
611 mTitleLabel->setText(title);
615 void TDEAboutContainerBase::setImage(
const TQString &fileName )
619 kdDebug(291) <<
"setImage: " <<
"Invalid layout" <<
endl;
622 if( fileName.isNull() )
627 const TQPixmap logo( fileName );
629 mImageLabel->setPixmap( logo );
631 mImageFrame->layout()->activate();
634 void TDEAboutContainerBase::setProgramLogo(
const TQString &fileName )
636 if( fileName.isNull() )
641 const TQPixmap logo( fileName );
642 setProgramLogo( logo );
645 void TDEAboutContainerBase::setProgramLogo(
const TQPixmap &pixmap )
649 kdDebug(291) <<
"setProgramLogo: " <<
"Invalid layout" <<
endl;
652 if( !pixmap.isNull() )
654 mIconLabel->setPixmap( pixmap );
658 void TDEAboutContainerBase::setImageBackgroundColor(
const TQColor &color )
662 mImageFrame->setBackgroundColor( color );
667 void TDEAboutContainerBase::setImageFrame(
bool state )
673 mImageFrame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
674 mImageFrame->setLineWidth(1);
678 mImageFrame->setFrameStyle( TQFrame::NoFrame );
679 mImageFrame->setLineWidth(0);
685 void TDEAboutContainerBase::setProduct(
const TQString &appName,
686 const TQString &version,
687 const TQString &author,
688 const TQString &year )
692 kdDebug(291) <<
"setProduct: " <<
"Invalid layout" <<
endl;
698 mIconLabel->setPixmap( kapp->icon() );
699 kdDebug(291) <<
"setPixmap (iconName): " << kapp->iconName() <<
endl;
704 const TQString msg1 = i18n(
"%1 %2 (Using Trinity %3)").arg(appName).arg(version).
705 arg(TQString::fromLatin1(TDE_VERSION_STRING));
706 const TQString msg2 = !year.isEmpty() ? i18n(
"%1 %2, %3").arg(
'©').arg(year).
707 arg(author) : TQString::fromLatin1(
"");
712 mVersionLabel->setText( msg1 );
713 mAuthorLabel->setText( msg2 );
716 mAuthorLabel->hide();
719 mIconLabel->parentWidget()->layout()->activate();
723 void TDEAboutContainerBase::slotMouseTrack(
int mode,
const TQMouseEvent *e )
725 emit mouseTrack( mode, e );
729 void TDEAboutContainerBase::slotUrlClick(
const TQString &url )
731 emit urlClick( url );
734 void TDEAboutContainerBase::slotMailClick(
const TQString &_name,
735 const TQString &_address )
737 emit mailClick( _name, _address );
742 TDEAboutContainer::TDEAboutContainer( TQWidget *_parent,
const char *_name,
743 int _margin,
int _spacing,
744 int childAlignment,
int innerAlignment )
745 : TQFrame( _parent, _name ), d(0)
747 mAlignment = innerAlignment;
749 TQGridLayout*
const gbox =
new TQGridLayout(
this, 3, 3, _margin, _spacing );
750 if( childAlignment & AlignHCenter )
752 gbox->setColStretch( 0, 10 );
753 gbox->setColStretch( 2, 10 );
755 else if( childAlignment & AlignRight )
757 gbox->setColStretch( 0, 10 );
761 gbox->setColStretch( 2, 10 );
764 if( childAlignment & AlignVCenter )
766 gbox->setRowStretch( 0, 10 );
767 gbox->setRowStretch( 2, 10 );
769 else if( childAlignment & AlignRight )
771 gbox->setRowStretch( 0, 10 );
775 gbox->setRowStretch( 2, 10 );
778 mVbox =
new TQVBoxLayout( _spacing );
779 gbox->addLayout( mVbox, 1, 1 );
784 void TDEAboutContainer::childEvent( TQChildEvent *e )
786 if( !e->inserted() || !e->child()->isWidgetType() )
791 TQWidget*
const w =
static_cast<TQWidget *
>(e->child());
792 mVbox->addWidget( w, 0, mAlignment );
793 const TQSize s( sizeHint() );
796 TQObjectList
const l = childrenListObject();
797 TQObjectListIterator itr( l );
799 while ( (o = itr.current()) ) {
801 if( o->isWidgetType() )
803 static_cast<TQWidget*
>(o)->setMinimumWidth( s.width() );
809 TQSize TDEAboutContainer::sizeHint(
void )
const
820 TQObjectList
const l = childrenListObject();
822 TQObjectListIterator itr( l );
824 while ( (o = itr.current()) ) {
826 if( o->isWidgetType() )
829 TQWidget*
const w=
static_cast<TQWidget*
>(o);
831 TQSize s = w->minimumSize();
834 s = w->minimumSizeHint();
840 s = TQSize( 100, 100 );
844 total_size.setHeight( total_size.height() + s.height() );
845 if( s.width() > total_size.width() ) { total_size.setWidth( s.width() ); }
856 total_size.setHeight( total_size.height() + layout()->spacing()*(numChild-1) );
857 total_size += TQSize( layout()->margin()*2, layout()->margin()*2 + 1 );
861 total_size = TQSize( 1, 1 );
867 TQSize TDEAboutContainer::minimumSizeHint(
void )
const
873 void TDEAboutContainer::addWidget( TQWidget *widget )
875 widget->reparent(
this, 0, TQPoint(0,0) );
879 void TDEAboutContainer::addPerson(
const TQString &_name,
const TQString &_email,
880 const TQString &_url,
const TQString &_task,
881 bool showHeader,
bool showFrame,
bool showBold)
885 _name, _email, _url, _task, showHeader, showFrame, showBold );
886 connect( cont, TQ_SIGNAL( openURL(
const TQString&)),
887 this, TQ_SIGNAL( urlClick(
const TQString &)));
888 connect( cont, TQ_SIGNAL( sendEmail(
const TQString &,
const TQString &)),
889 this, TQ_SIGNAL( mailClick(
const TQString &,
const TQString &)));
893 void TDEAboutContainer::addTitle(
const TQString &title,
int alignment,
894 bool showFrame,
bool showBold )
897 TQLabel*
const label =
new TQLabel( title,
this,
"title" );
900 TQFont labelFont( font() );
901 labelFont.setBold(
true );
902 label->setFont( labelFont );
906 label->setFrameStyle(TQFrame::Panel | TQFrame::Raised);
908 label->setAlignment( alignment );
912 void TDEAboutContainer::addImage(
const TQString &fileName,
int alignment )
914 if( fileName.isNull() )
920 const TQImage logo( fileName );
925 label->setPixmap( pix );
927 label->setAlignment( alignment );
947 void setName(
const TQString&);
951 void setEmail(
const TQString&);
955 void setURL(
const TQString&);
960 void setWork(
const TQString&);
964 TQSize minimumSizeHint(
void);
965 virtual void show(
void );
971 void resizeEvent(TQResizeEvent*);
973 void paintEvent(TQPaintEvent*);
986 void urlClickedSlot(
const TQString&);
988 void emailClickedSlot(
const TQString& emailaddress);
992 void sendEmail(
const TQString& name,
const TQString& email);
994 void openURL(
const TQString& url);
1000 TDEAboutContributor::TDEAboutContributor(TQWidget* parent,
const char* n)
1001 : TQFrame(parent, n),
1002 name(new TQLabel(this)),
1007 if(name==0 || email==0)
1009 kdDebug() <<
"TDEAboutContributor::TDEAboutContributor: Out of memory." <<
endl;
1012 setFrameStyle(TQFrame::Panel | TQFrame::Raised);
1014 connect(email, TQ_SIGNAL(leftClickedURL(
const TQString&)),
1015 TQ_SLOT(emailClickedSlot(
const TQString&)));
1016 connect(url, TQ_SIGNAL(leftClickedURL(
const TQString&)),
1017 TQ_SLOT(urlClickedSlot(
const TQString&)));
1022 TDEAboutContributor::setName(
const TQString& n)
1030 TDEAboutContributor::getName()
1033 return name->text();
1037 TDEAboutContributor::setURL(
const TQString& u)
1045 TDEAboutContributor::getURL()
1053 TDEAboutContributor::setEmail(
const TQString& e)
1061 TDEAboutContributor::getEmail()
1064 return email->text();
1069 TDEAboutContributor::emailClickedSlot(
const TQString& e)
1072 kdDebug() <<
"TDEAboutContributor::emailClickedSlot: called." <<
endl;
1073 emit(sendEmail(
name->text(), e));
1078 TDEAboutContributor::urlClickedSlot(
const TQString& u)
1081 kdDebug() <<
"TDEAboutContributor::urlClickedSlot: called." <<
endl;
1087 TDEAboutContributor::setWork(
const TQString& w)
1099 TDEAboutContributor::sizeHint()
1102 const int FrameWidth=frameWidth();
1103 const int WorkTextWidth=200;
1107 maxx=
name->sizeHint().width();
1108 maxx=TQMAX(maxx, email->sizeHint().width()+WORKTEXT_IDENTATION);
1112 rect=fontMetrics().boundingRect
1113 (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
1115 if(maxx<rect.width())
1117 maxx=WorkTextWidth+WORKTEXT_IDENTATION;
1119 maxx=TQMAX(maxx, url->sizeHint().width()+WORKTEXT_IDENTATION);
1121 maxy=2*(
name->sizeHint().height()+Grid);
1122 maxy+=
name->sizeHint().height();
1123 maxy+=rect.height();
1127 return TQSize(maxx, maxy);
1131 TQSize TDEAboutContributor::minimumSizeHint(
void)
1133 return( sizeHint() );
1137 void TDEAboutContributor::show(
void )
1140 setMinimumSize( sizeHint() );
1146 TDEAboutContributor::resizeEvent(TQResizeEvent*)
1150 int framewidth=frameWidth(), childwidth=width()-2*framewidth;
1154 (framewidth, framewidth, childwidth,
name->sizeHint().height());
1155 cy=
name->height()+Grid;
1157 (framewidth+WORKTEXT_IDENTATION, cy,
1158 childwidth-WORKTEXT_IDENTATION,
name->sizeHint().height());
1159 cy+=
name->height()+Grid;
1161 (framewidth+WORKTEXT_IDENTATION, cy,
1162 childwidth-WORKTEXT_IDENTATION,
name->sizeHint().height());
1169 TDEAboutContributor::paintEvent(TQPaintEvent* e)
1173 int cy=frameWidth()+
name->height()+email->height()+Grid+url->height()+Grid;
1174 int h=height()-cy-frameWidth();
1175 int w=width()-WORKTEXT_IDENTATION-2*frameWidth();
1177 TQFrame::paintEvent(e);
1178 if(work.isEmpty())
return;
1179 TQPainter paint(
this);
1181 paint.drawText(WORKTEXT_IDENTATION, cy, w, h, AlignLeft | WordBreak, work);
1189 TQSize TDEAboutContributor::sizeHint(
void )
1192 int h = fontMetrics().lineSpacing()*3 + 2*s;
1193 int m = frameWidth();
1195 int w =
name->sizeHint().width();
1196 w = TQMAX( w, email->sizeHint().width()+s);
1197 w = TQMAX( w, url->sizeHint().width()+s);
1199 if( work.isEmpty() ==
false )
1201 const int WorkTextWidth=200;
1202 TQRect r = fontMetrics().boundingRect
1203 (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
1206 w = TQMAX( w, WorkTextWidth+s );
1208 h += TQMAX( fontMetrics().lineSpacing(), r.height() ) + s;
1210 return( TQSize( w + 2*m, h + 2*m ) );
1242 void TDEAboutContributor::resizeEvent(TQResizeEvent*)
1244 int x = frameWidth();
1246 int h = fontMetrics().lineSpacing();
1247 int w = width() - 2*x;
1250 name->setGeometry( x, y, w, h );
1252 email->setGeometry( x+s, y, w-s, h );
1254 url->setGeometry( x+s, y, w-s, h );
1276 void TDEAboutContributor::paintEvent( TQPaintEvent *e )
1278 TQFrame::paintEvent(e);
1279 if(work.isEmpty())
return;
1282 int h = fontMetrics().lineSpacing();
1283 int y = height() - frameWidth() - fontMetrics().lineSpacing();
1286 TQPainter paint(
this );
1287 paint.drawText( x, y, w, h, AlignLeft | WordBreak, work );
1309 : TQWidget(_parent, _name),
1310 version(new TQLabel(this)),
1311 cont(new TQLabel(this)),
1312 logo(new TQLabel(this)),
1315 showMaintainer(false),
1322 kdDebug() <<
"TDEAboutWidget::TDEAboutWidget: Out of memory." <<
endl;
1326 cont->setText(i18n(
"Other Contributors:"));
1327 logo->setText(i18n(
"(No logo available)"));
1328 logo->setFrameStyle(TQFrame::Panel | TQFrame::Raised);
1329 version->setAlignment(AlignCenter);
1331 connect(
author, TQ_SIGNAL(
sendEmail(
const TQString&,
const TQString&)),
1348 int maintWidth, maintHeight;
1354 maintWidth=total_size.width();
1355 maintHeight=total_size.height();
1360 total_size=
author->sizeHint();
1362 cy=
version->sizeHint().height()+Grid;
1364 tempx=TQMAX(total_size.width(), maintWidth);
1366 cx=TQMAX(cx,
version->sizeHint().width());
1367 cy+=TQMAX(
logo->height(),
1372 cx=TQMAX(cx,
cont->sizeHint().width());
1373 cy+=
cont->sizeHint().height()+Grid;
1374 TQPtrListIterator<TDEAboutContributor> _pos(
contributors);
1376 while ( (currEntry = _pos.current()) )
1379 cy+=currEntry->sizeHint().height();
1383 setMinimumSize(cx, cy);
1407 const TQString &_url,
const TQString &_w)
1411 author->setEmail(_email);
1419 const TQString &_url,
const TQString &_w)
1432 const TQString &_url,
const TQString &_w)
1438 c->setEmail(_email);
1442 connect(c, TQ_SIGNAL(
sendEmail(
const TQString&,
const TQString&)),
1444 connect(c, TQ_SIGNAL(
openURL(
const TQString&)), TQ_SLOT(
openURLSlot(
const TQString&)));
1460 int _x=0, _y, cx, tempx, tempy;
1462 version->setGeometry(0, 0, width(),
version->sizeHint().height());
1468 tempx=
logo->width()+Grid;
1471 (tempx, _y, cx,
author->sizeHint().height());
1475 _y+=TQMAX(
logo->height(),
1480 tempy=
cont->sizeHint().height();
1481 cont->setGeometry(0, _y, width(), tempy);
1487 TQPtrListIterator<TDEAboutContributor> _pos(
contributors);
1489 while( (currEntry = _pos.current()) )
1492 tempy=currEntry->sizeHint().height();
1494 currEntry->setGeometry(_x, _y, width(), tempy);
1507 :
KDialogBase(_parent, _name, modal, TQString::null, Ok, Ok ),
1514 kdDebug() <<
"TDEAboutDialog::TDEAboutDialog: Out of memory." <<
endl;
1518 connect(
about, TQ_SIGNAL(
sendEmail(
const TQString&,
const TQString&)),
1528 TQWidget *_parent,
const char *_name,
bool modal,
1529 bool separator,
const TQString &user1,
1530 const TQString &user2,
const TQString &user3 )
1531 :
KDialogBase( _parent, _name, modal, TQString::null, buttonMask, defaultButton,
1532 separator, user1, user2, user3 ),
1542 connect(
mContainerBase, TQ_SIGNAL(mailClick(
const TQString &,
const TQString &)),
1543 this, TQ_SLOT(
sendEmailSlot(
const TQString &,
const TQString &)));
1544 connect(
mContainerBase, TQ_SIGNAL(mouseTrack(
int,
const TQMouseEvent *)),
1567 if( !
about ) {
return; }
1570 resize( sizeHint() );
1576 if( !
about ) {
return; }
1582 const TQString &_url,
const TQString &_w)
1585 if( !
about ) {
return; }
1591 const TQString &_url,
const TQString &_work)
1594 if( !
about ) {
return; }
1600 const TQString &_url,
const TQString &_w)
1603 if( !
about ) {
return; }
1611 if( !
about ) {
return; }
1619 kapp->invokeMailer( email, TQString::null );
1630 kapp->invokeBrowser( url );
1643 bool richText,
int numLines )
1646 return mContainerBase->addTextPage( title, text, richText, numLines );
1658 int childAlignment,
int innerAlignment )
1667 int childAlignment,
int innerAlignment )
1670 return mContainerBase->addScrolledContainerPage( title, childAlignment,
1684 int innerAlignment )
1687 return mContainerBase->addContainer( childAlignment, innerAlignment );
1738 const TQString &author,
const TQString &year )
1747 const TQString &_path,
const TQColor &_imageColor,
1748 const TQString &_url )
1758 c->addPerson( TQString::null, TQString::null, _url, TQString::null );
1769 KImageTrackLabel::KImageTrackLabel( TQWidget *_parent,
const char *_name, WFlags f )
1770 : TQLabel( _parent, _name, f )
1772 setText( i18n(
"Image missing"));
1775 void KImageTrackLabel::mousePressEvent( TQMouseEvent *e )
1777 emit mouseTrack( MousePress, e );
1780 void KImageTrackLabel::mouseReleaseEvent( TQMouseEvent *e )
1782 emit mouseTrack( MouseRelease, e );
1785 void KImageTrackLabel::mouseDoubleClickEvent( TQMouseEvent *e )
1787 emit mouseTrack( MouseDoubleClick, e );
1790 void KImageTrackLabel::mouseMoveEvent ( TQMouseEvent *e )
1792 emit mouseTrack( MouseDoubleClick, e );
1795 void TDEAboutDialog::virtual_hook(
int id,
void* data )
1796 { KDialogBase::virtual_hook(
id, data ); }
A dialog base class with standard buttons and predefined layouts.
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
@ Close
Show Close-button.
virtual void setPlainCaption(const TQString &caption)
Make a plain caption without any modifications.
static int spacingHint()
Return the number of pixels you shall use between widgets inside a dialog according to the KDE standa...
Used internally by TDEAboutContainerBase.
virtual void setReadOnly(bool readOnly)
Reimplemented to set a proper "deactivated" background color.
A drop-in replacement for TQLabel that displays hyperlinks.
virtual void setMargin(int margin)
Reimplemented for internal reasons, the API is not affected.
void setFloat(bool do_float=true)
Turns on or off the "float" feature.
void setURL(const TQString &url)
Sets the URL for this label to url.
void setUnderline(bool on=true)
Turns on or off the underlining.
Used internally by TDEAboutDialog.
TDEAboutContainer can be used to make a application specific AboutDialog.
Used internally by TDEAboutWidget.
A KDialogBase with predefined main widget.
void setVersion(const TQString &name)
(Constructor I only) Sets the text describing the version.
void setLogo(const TQPixmap &)
(Constructor I only) Sets the image as the application logo.
void setImage(const TQString &fileName)
(Constructor II only) Define an image to be shown in the dialog.
void setImageBackgroundColor(const TQColor &color)
(Constructor II only) The image has a minimum size, but is centered within an area if the dialog box ...
virtual void mouseTrackSlot(int mode, const TQMouseEvent *e)
(Constructor II only) Tells the position of the mouse cursor when the left mouse button is pressed ab...
TDEAboutContainer * addScrolledContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container inside a TQScrollView to a tab box.
TDEAboutDialog(TQWidget *parent=0, const char *name=0, bool modal=true)
The standard Qt constructor (Constructor I).
void sendEmail(const TQString &name, const TQString &email)
Send an email to this person.
void setAuthor(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
(Constructor I only) Sets the author's name and email address.
virtual void show(void)
Makes a modeless (modal = false in constructor) dialog visible.
void sendEmailSlot(const TQString &name, const TQString &email)
Connected to widget->sendEmail.
void setMaintainer(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
(Constructor I only) Sets the maintainer's name and email address.
void openURL(const TQString &url)
Open the selected URL.
TDEAboutContainerBase * mContainerBase
The main widget (Constructor II)
TQFrame * addPage(const TQString &title)
(Constructor II only) Adds an empty page to a tab box.
static void imageURL(TQWidget *parent, const TQString &caption, const TQString &path, const TQColor &imageColor, const TQString &url)
Create a modal dialog with an image in the upper area with a URL link below.
TQFrame * addTextPage(const TQString &title, const TQString &text, bool richText=false, int numLines=10)
(Constructor II only) Adds a text page to a tab box.
void setIcon(const TQString &fileName) TDE_DEPRECATED
(Constructor II only) Define the program logo to be shown in the dialog.
TDEAboutContainer * addContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container to a tab box.
TQFrame * addLicensePage(const TQString &title, const TQString &text, int numLines=10)
(Constructor II only) Adds a license page to a tab box.
void setImageFrame(bool state)
(Constructor II only) Enables or disables a frame around the image.
TDEAboutWidget * about
The main widget (Constructor I)
void setProduct(const TQString &appName, const TQString &version, const TQString &author, const TQString &year)
(Constructor II only) Prints the application name, KDE version, author, a copyright sign and a year s...
void openURLSlot(const TQString &url)
Open this URL.
void adjust()
Adjusts the dialog.
void setProgramLogo(const TQString &fileName)
Overloaded version of setProgramLogo(const TQPixmap& pixmap).
void addContributor(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
(Constructor I only) Show this person as one of the major contributors.
void setTitle(const TQString &title)
(Constructor II only) Sets a title (not caption) in the uppermost area of the dialog.
TDEAboutContainer * addContainer(int childAlignment, int innerAlignment)
(Constructor II only) Adds a container.
static TQFont generalFont()
static TQFont fixedFont()
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)
TQString name(StdAccel id)
TQString label(StdAccel id)