@ -20,15 +20,15 @@
*
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
// Qt includes.
// T Qt includes.
# include < qguardedptr.h>
# include < qlabel.h>
# include < qsplitter.h>
# include < qlayout.h>
# include < qframe.h>
# include < qpushbutton.h>
# include < qtimer.h>
# include < t qguardedptr.h>
# include < t qlabel.h>
# include < t qsplitter.h>
# include < t qlayout.h>
# include < t qframe.h>
# include < t qpushbutton.h>
# include < t qtimer.h>
// KDE includes.
@ -57,8 +57,8 @@ namespace KIPI
{
struct AlbumLVI : public KListViewItem {
AlbumLVI ( KListView * parent, const KIPI : : ImageCollection & album )
: KListViewItem ( parent, album . name ( ) )
AlbumLVI ( KListView * tq parent, const KIPI : : ImageCollection & album )
: KListViewItem ( tq parent, album . name ( ) )
, _album ( album ) { }
const KIPI : : ImageCollection & _album ;
@ -66,8 +66,8 @@ struct AlbumLVI : public KListViewItem {
struct ImageLVI : public KListViewItem {
ImageLVI ( KListView * parent, const KURL & url )
: KListViewItem ( parent, url . fileName ( ) ) , _url ( url ) { }
ImageLVI ( KListView * tq parent, const KURL & url )
: KListViewItem ( tq parent, url . fileName ( ) ) , _url ( url ) { }
KURL _url ;
} ;
@ -79,46 +79,46 @@ struct ImageDialog::Private {
KIPI : : Interface * _interface ;
KListView * _albumList ;
KListView * _imageList ;
QLabel* _preview ;
QValueList< ImageCollection > _albums ;
T QLabel* _preview ;
T QValueList< ImageCollection > _albums ;
bool _singleSelection ;
} ;
ImageDialog : : ImageDialog ( QWidget* parent, KIPI : : Interface * interface ,
ImageDialog : : ImageDialog ( T QWidget* tq parent, KIPI : : Interface * interface ,
bool singleSelection )
: KDialogBase ( KDialogBase : : Plain , i18n ( " Select Image From Album " ) , Help | Ok | Cancel ,
Ok , parent, " album-dialog " , true , true )
Ok , tq parent, " album-dialog " , true , true )
{
d = new Private ;
d - > _interface = interface ;
d - > _singleSelection = singleSelection ;
QWidget* box = plainPage ( ) ;
QVBoxLayout * dvlay = new QVBoxLayout( box , 6 ) ;
T QWidget* box = plainPage ( ) ;
T QVBoxLayout * dvlay = new T QVBoxLayout( box , 6 ) ;
//---------------------------------------------
QFrame * headerFrame = new QFrame( box ) ;
headerFrame - > setFrameStyle ( QFrame: : Panel | QFrame: : Sunken ) ;
QHBoxLayout* layout = new QHBoxLayout( headerFrame ) ;
layout- > setMargin ( 2 ) ; // to make sure the frame gets displayed
layout- > setSpacing ( 0 ) ;
QLabel * pixmapLabelLeft = new QLabel( headerFrame , " pixmapLabelLeft " ) ;
T QFrame * headerFrame = new T QFrame( box ) ;
headerFrame - > setFrameStyle ( T QFrame: : Panel | T QFrame: : Sunken ) ;
T QHBoxLayout* tq layout = new T QHBoxLayout( headerFrame ) ;
tq layout- > setMargin ( 2 ) ; // to make sure the frame gets displayed
tq layout- > setSpacing ( 0 ) ;
T QLabel * pixmapLabelLeft = new T QLabel( headerFrame , " pixmapLabelLeft " ) ;
pixmapLabelLeft - > setScaledContents ( false ) ;
layout- > addWidget ( pixmapLabelLeft ) ;
QLabel * labelTitle = new QLabel( i18n ( " Select Image From Album " ) , headerFrame , " labelTitle " ) ;
layout- > addWidget ( labelTitle ) ;
layout- > setStretchFactor ( labelTitle , 1 ) ;
tq layout- > addWidget ( pixmapLabelLeft ) ;
T QLabel * labelTitle = new T QLabel( i18n ( " Select Image From Album " ) , headerFrame , " labelTitle " ) ;
tq layout- > addWidget ( labelTitle ) ;
tq layout- > setStretchFactor ( labelTitle , 1 ) ;
dvlay - > addWidget ( headerFrame ) ;
QString directory ;
T QString directory ;
KGlobal : : dirs ( ) - > addResourceType ( " kipi_banner_left " , KGlobal : : dirs ( ) - > kde_default ( " data " ) + " kipi/data " ) ;
directory = KGlobal : : dirs ( ) - > findResourceDir ( " kipi_banner_left " , " banner_left.png " ) ;
pixmapLabelLeft - > setPaletteBackgroundColor ( QColor( 201 , 208 , 255 ) ) ;
pixmapLabelLeft - > setPixmap ( QPixmap( directory + " banner_left.png " ) ) ;
labelTitle - > setPaletteBackgroundColor ( QColor( 201 , 208 , 255 ) ) ;
pixmapLabelLeft - > setPaletteBackgroundColor ( T QColor( 201 , 208 , 255 ) ) ;
pixmapLabelLeft - > setPixmap ( T QPixmap( directory + " banner_left.png " ) ) ;
labelTitle - > setPaletteBackgroundColor ( T QColor( 201 , 208 , 255 ) ) ;
//---------------------------------------------
@ -133,52 +133,52 @@ ImageDialog::ImageDialog(QWidget* parent, KIPI::Interface* interface,
0 ,
" http://extragear.kde.org/apps/kipi " ) ;
QPushButton * helpButton = actionButton ( Help ) ;
T QPushButton * helpButton = actionButton ( Help ) ;
KHelpMenu * helpMenu = new KHelpMenu ( this , about , false ) ;
helpMenu - > menu ( ) - > removeItemAt ( 0 ) ;
helpMenu - > menu ( ) - > insertItem ( i18n ( " Kipi Plugins Handbooks " ) , this , SLOT( slotHelp ( ) ) , 0 , - 1 , 0 ) ;
helpMenu - > menu ( ) - > insertItem ( i18n ( " Kipi Plugins Handbooks " ) , this , TQT_ SLOT( slotHelp ( ) ) , 0 , - 1 , 0 ) ;
helpButton - > setPopup ( helpMenu - > menu ( ) ) ;
//---------------------------------------------
QSplitter* splitter = new QSplitter( box ) ;
T QSplitter* splitter = new T QSplitter( box ) ;
d - > _albumList = new KListView ( splitter ) ;
d - > _albumList - > addColumn ( i18n ( " Album Name " ) ) ;
d - > _albumList - > setMinimumWidth ( 200 ) ;
d - > _albumList - > setResizeMode ( QListView: : LastColumn ) ;
d - > _albumList - > setResizeMode ( T QListView: : LastColumn ) ;
d - > _imageList = new KListView ( splitter ) ;
d - > _imageList - > addColumn ( i18n ( " Image Name " ) ) ;
d - > _imageList - > setMinimumWidth ( 200 ) ;
d - > _imageList - > setSelectionMode ( singleSelection ? QListView: : Single :
QListView: : Extended ) ;
d - > _imageList - > setResizeMode ( QListView: : LastColumn ) ;
d - > _imageList - > setSelectionMode ( singleSelection ? T QListView: : Single :
T QListView: : Extended ) ;
d - > _imageList - > setResizeMode ( T QListView: : LastColumn ) ;
d - > _preview = new QLabel( splitter ) ;
d - > _preview - > setAlignment( AlignHCenter | AlignVCenter | WordBreak ) ;
d - > _preview = new T QLabel( splitter ) ;
d - > _preview - > tq setAlignment( AlignHCenter | AlignVCenter | WordBreak ) ;
d - > _preview - > setFixedWidth ( PREVIEW_SIZE ) ;
d - > _preview - > setText ( i18n ( " No image selected " ) ) ;
dvlay - > addWidget ( splitter ) ;
d - > _albums = d - > _interface - > allAlbums ( ) ;
QValueList< ImageCollection > : : ConstIterator it = d - > _albums . begin ( ) ;
T QValueList< ImageCollection > : : ConstIterator it = d - > _albums . begin ( ) ;
for ( ; it ! = d - > _albums . end ( ) ; + + it ) {
new AlbumLVI ( d - > _albumList , * it ) ;
}
QTimer: : singleShot ( 0 , this , SLOT( slotInitialShow ( ) ) ) ;
T QTimer: : singleShot ( 0 , this , TQT_ SLOT( slotInitialShow ( ) ) ) ;
connect ( d - > _albumList , SIGNAL( selectionChanged ( QListViewItem* ) ) ,
this , SLOT( fillImageList ( QListViewItem* ) ) ) ;
connect ( d - > _albumList , TQT_ SIGNAL( selectionChanged ( T QListViewItem* ) ) ,
this , TQT_ SLOT( fillImageList ( T QListViewItem* ) ) ) ;
if ( singleSelection )
connect ( d - > _imageList , SIGNAL( selectionChanged ( QListViewItem* ) ) ,
this , SLOT( slotImageSelected ( QListViewItem* ) ) ) ;
connect ( d - > _imageList , TQT_ SIGNAL( selectionChanged ( T QListViewItem* ) ) ,
this , TQT_ SLOT( slotImageSelected ( T QListViewItem* ) ) ) ;
else
connect ( d - > _imageList , SIGNAL( selectionChanged ( ) ) ,
this , SLOT( slotImagesSelected ( ) ) ) ;
connect ( d - > _imageList , TQT_ SIGNAL( selectionChanged ( ) ) ,
this , TQT_ SLOT( slotImagesSelected ( ) ) ) ;
enableButtonOK ( false ) ;
}
@ -198,19 +198,19 @@ KURL::List ImageDialog::urls() const
return d - > _urls ;
}
KURL ImageDialog : : getImageURL ( QWidget* parent, KIPI : : Interface * interface ) {
ImageDialog dlg ( parent, interface , true ) ;
if ( dlg . exec ( ) = = QDialog: : Accepted ) {
KURL ImageDialog : : getImageURL ( T QWidget* tq parent, KIPI : : Interface * interface ) {
ImageDialog dlg ( tq parent, interface , true ) ;
if ( dlg . exec ( ) = = T QDialog: : Accepted ) {
return dlg . url ( ) ;
} else {
return KURL ( ) ;
}
}
KURL : : List ImageDialog : : getImageURLs ( QWidget* parent, Interface * interface )
KURL : : List ImageDialog : : getImageURLs ( T QWidget* tq parent, Interface * interface )
{
ImageDialog dlg ( parent, interface , false ) ;
if ( dlg . exec ( ) = = QDialog: : Accepted )
ImageDialog dlg ( tq parent, interface , false ) ;
if ( dlg . exec ( ) = = T QDialog: : Accepted )
return dlg . urls ( ) ;
else
{
@ -220,7 +220,7 @@ KURL::List ImageDialog::getImageURLs(QWidget* parent, Interface* interface)
}
void ImageDialog : : fillImageList ( QListViewItem* item ) {
void ImageDialog : : fillImageList ( T QListViewItem* item ) {
d - > _imageList - > clear ( ) ;
if ( ! item ) return ;
@ -234,7 +234,7 @@ void ImageDialog::fillImageList(QListViewItem* item) {
}
void ImageDialog : : slotImageSelected ( QListViewItem* item ) {
void ImageDialog : : slotImageSelected ( T QListViewItem* item ) {
if ( ! item ) {
enableButtonOK ( false ) ;
d - > _preview - > setText ( i18n ( " No image selected " ) ) ;
@ -246,8 +246,8 @@ void ImageDialog::slotImageSelected(QListViewItem* item) {
d - > _preview - > clear ( ) ;
KIO : : PreviewJob * thumbJob = KIO : : filePreview ( d - > _url , PREVIEW_SIZE ) ;
connect ( thumbJob , SIGNAL( gotPreview ( const KFileItem * , const QPixmap& ) ) ,
SLOT( slotGotPreview ( const KFileItem * , const QPixmap& ) ) ) ;
connect ( thumbJob , TQT_ SIGNAL( gotPreview ( const KFileItem * , const T QPixmap& ) ) ,
TQT_ SLOT( slotGotPreview ( const KFileItem * , const T QPixmap& ) ) ) ;
}
void ImageDialog : : slotImagesSelected ( )
@ -256,8 +256,8 @@ void ImageDialog::slotImagesSelected()
d - > _urls . clear ( ) ;
d - > _preview - > clear ( ) ;
QListViewItem* selectedItem = 0 ;
QListViewItem* listItem = d - > _imageList - > firstChild ( ) ;
T QListViewItem* selectedItem = 0 ;
T QListViewItem* listItem = d - > _imageList - > firstChild ( ) ;
while ( listItem )
{
if ( listItem - > isSelected ( ) )
@ -284,8 +284,8 @@ void ImageDialog::slotImagesSelected()
d - > _url = d - > _urls . first ( ) ;
KIO : : PreviewJob * thumbJob = KIO : : filePreview ( d - > _url , PREVIEW_SIZE ) ;
connect ( thumbJob , SIGNAL( gotPreview ( const KFileItem * , const QPixmap& ) ) ,
SLOT( slotGotPreview ( const KFileItem * , const QPixmap& ) ) ) ;
connect ( thumbJob , TQT_ SIGNAL( gotPreview ( const KFileItem * , const T QPixmap& ) ) ,
TQT_ SLOT( slotGotPreview ( const KFileItem * , const T QPixmap& ) ) ) ;
}
else
{
@ -294,7 +294,7 @@ void ImageDialog::slotImagesSelected()
}
}
void ImageDialog : : slotGotPreview ( const KFileItem * , const QPixmap& pix ) {
void ImageDialog : : slotGotPreview ( const KFileItem * , const T QPixmap& pix ) {
d - > _preview - > setPixmap ( pix ) ;
}
@ -308,7 +308,7 @@ void ImageDialog::slotInitialShow()
{
ImageCollection current = d - > _interface - > currentAlbum ( ) ;
QListViewItemIterator it ( d - > _albumList ) ;
T QListViewItemIterator it ( d - > _albumList ) ;
while ( it . current ( ) )
{
AlbumLVI * lvi = static_cast < AlbumLVI * > ( it . current ( ) ) ;