diff options
Diffstat (limited to 'kview/modules/presenter')
-rw-r--r-- | kview/modules/presenter/DESIGN | 10 | ||||
-rw-r--r-- | kview/modules/presenter/config/kviewpresenterconfig.cpp | 2 | ||||
-rw-r--r-- | kview/modules/presenter/config/kviewpresenterconfig.h | 2 | ||||
-rw-r--r-- | kview/modules/presenter/imagelistdialog.ui | 23 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenter.cpp | 105 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenter.h | 13 | ||||
-rw-r--r-- | kview/modules/presenter/kviewpresenterconfmodule.h | 2 |
7 files changed, 74 insertions, 83 deletions
diff --git a/kview/modules/presenter/DESIGN b/kview/modules/presenter/DESIGN index 3b187e78..034a3032 100644 --- a/kview/modules/presenter/DESIGN +++ b/kview/modules/presenter/DESIGN @@ -27,15 +27,15 @@ Presenter Plugin: - keep local copy of downloaded files - delete local copy on destruction - API: - QImage * image(); + TQImage * image(); KURL url(); - QString file(); //returns local filename or QString::null + TQString file(); //returns local filename or TQString::null - when loading an item from the playlist first ask for a - QImage, if that's not available ask for a local file, if + TQImage, if that's not available ask for a local file, if that's also not available take the url. - API: - QImage * image(); - QString file(); + TQImage * image(); + TQString file(); KURL url(); void setRandom(bool); void randomizeList(); diff --git a/kview/modules/presenter/config/kviewpresenterconfig.cpp b/kview/modules/presenter/config/kviewpresenterconfig.cpp index f88f09b1..1e1e091c 100644 --- a/kview/modules/presenter/config/kviewpresenterconfig.cpp +++ b/kview/modules/presenter/config/kviewpresenterconfig.cpp @@ -38,7 +38,7 @@ KViewPresenterConfig::KViewPresenterConfig( TQWidget * parent, const char *, con layout->setAutoAdd( true ); m_pCheckBox = new TQCheckBox( "This is only for testing...", this ); - connect( m_pCheckBox, TQT_SIGNAL( clicked() ), this, TQT_SLOT( checkChanged() ) ); + connect( m_pCheckBox, TQ_SIGNAL( clicked() ), this, TQ_SLOT( checkChanged() ) ); } KViewPresenterConfig::~KViewPresenterConfig() diff --git a/kview/modules/presenter/config/kviewpresenterconfig.h b/kview/modules/presenter/config/kviewpresenterconfig.h index 8aaf462f..73742259 100644 --- a/kview/modules/presenter/config/kviewpresenterconfig.h +++ b/kview/modules/presenter/config/kviewpresenterconfig.h @@ -25,7 +25,7 @@ class TQCheckBox; class KViewPresenterConfig : public TDECModule { - Q_OBJECT + TQ_OBJECT public: KViewPresenterConfig( TQWidget * parent, const char * name = 0, const TQStringList & args = TQStringList() ); diff --git a/kview/modules/presenter/imagelistdialog.ui b/kview/modules/presenter/imagelistdialog.ui index 547c0cf0..1f7a2435 100644 --- a/kview/modules/presenter/imagelistdialog.ui +++ b/kview/modules/presenter/imagelistdialog.ui @@ -254,31 +254,26 @@ </connections> <includes> <include location="global" impldecl="in declaration">kdialog.h</include> + <include location="local" impldecl="in implementation">imagelistdialog.ui.h</include> + <include location="local" impldecl="in implementation">imagelistitem.h</include> <include location="global" impldecl="in implementation">kdebug.h</include> <include location="global" impldecl="in implementation">kimageviewer/viewer.h</include> - <include location="global" impldecl="in implementation">tdeio/netaccess.h</include> + <include location="global" impldecl="in implementation">knuminput.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> <include location="global" impldecl="in implementation">kurl.h</include> <include location="global" impldecl="in implementation">tdefiledialog.h</include> - <include location="global" impldecl="in implementation">tqstring.h</include> + <include location="global" impldecl="in implementation">tdeio/netaccess.h</include> + <include location="global" impldecl="in implementation">tdelistview.h</include> <include location="global" impldecl="in implementation">tdemessagebox.h</include> - <include location="local" impldecl="in implementation">imagelistitem.h</include> - <include location="local" impldecl="in implementation">imagelistdialog.ui.h</include> + <include location="global" impldecl="in implementation">tqstring.h</include> </includes> <forwards> <forward>class KURL</forward> </forwards> -<Q_SLOTS> +<slots> <slot access="private" specifier="non virtual">init()</slot> <slot specifier="non virtual">noSort()</slot> -</Q_SLOTS> +</slots> <layoutdefaults spacing="6" margin="11"/> <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> -<includes> - <include location="global" impldecl="in implementation">knuminput.h</include> - <include location="global" impldecl="in implementation">kpushbutton.h</include> -</includes> -<includehints> - <includehint>kdialog.h</includehint> - <includehint>tdelistview.h</includehint> -</includehints> </UI> diff --git a/kview/modules/presenter/kviewpresenter.cpp b/kview/modules/presenter/kviewpresenter.cpp index c05490bb..96b3abbb 100644 --- a/kview/modules/presenter/kviewpresenter.cpp +++ b/kview/modules/presenter/kviewpresenter.cpp @@ -60,7 +60,6 @@ KViewPresenter::KViewPresenter( TQObject* parent, const char* name, const TQStri , m_pSlideshowTimer( new TQTimer( this ) ) { kdDebug( 4630 ) << k_funcinfo << endl; - m_imagelist.setAutoDelete( true ); TQObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false ); m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() ); @@ -68,18 +67,18 @@ KViewPresenter::KViewPresenter( TQObject* parent, const char* name, const TQStri if( m_pViewer ) { ( void ) new TDEAction( i18n( "&Image List..." ), 0, 0, - this, TQT_SLOT( slotImageList() ), + this, TQ_SLOT( slotImageList() ), actionCollection(), "plugin_presenter_imageList" ); m_paSlideshow = new TDEToggleAction( i18n( "Start &Slideshow" ), Key_S, actionCollection(), "plugin_presenter_slideshow" ); ( void ) new TDEAction( i18n( "&Previous Image in List" ), "go-previous", ALT+Key_Left, - this, TQT_SLOT( prev() ), + this, TQ_SLOT( prev() ), actionCollection(), "plugin_presenter_prev" ); ( void ) new TDEAction( i18n( "&Next Image in List" ), "go-next", ALT+Key_Right, - this, TQT_SLOT( next() ), + this, TQ_SLOT( next() ), actionCollection(), "plugin_presenter_next" ); - connect( m_paSlideshow, TQT_SIGNAL( toggled( bool ) ), m_pImageList->m_pSlideshow, TQT_SLOT( setOn( bool ) ) ); - connect( m_pImageList->m_pSlideshow, TQT_SIGNAL( toggled( bool ) ), m_paSlideshow, TQT_SLOT( setChecked( bool ) ) ); + connect( m_paSlideshow, TQ_SIGNAL( toggled( bool ) ), m_pImageList->m_pSlideshow, TQ_SLOT( setOn( bool ) ) ); + connect( m_pImageList->m_pSlideshow, TQ_SIGNAL( toggled( bool ) ), m_paSlideshow, TQ_SLOT( setChecked( bool ) ) ); // search for file_open action KXMLGUIClient * parentClient = static_cast<KXMLGUIClient*>( parent->tqt_cast( "KXMLGUIClient" ) ); @@ -89,48 +88,48 @@ KViewPresenter::KViewPresenter( TQObject* parent, const char* name, const TQStri m_paFileClose = parentClient->actionCollection()->action( "file_close" ); } if( m_paFileClose ) - connect( m_paFileClose, TQT_SIGNAL( activated() ), this, TQT_SLOT( slotClose() ) ); + connect( m_paFileClose, TQ_SIGNAL( activated() ), this, TQ_SLOT( slotClose() ) ); if( m_paFileOpen ) { - disconnect( m_paFileOpen, TQT_SIGNAL( activated() ), parent, TQT_SLOT( slotOpenFile() ) ); - connect( m_paFileOpen, TQT_SIGNAL( activated() ), this, TQT_SLOT( slotOpenFiles() ) ); + disconnect( m_paFileOpen, TQ_SIGNAL( activated() ), parent, TQ_SLOT( slotOpenFile() ) ); + connect( m_paFileOpen, TQ_SIGNAL( activated() ), this, TQ_SLOT( slotOpenFiles() ) ); } else { (void) new TDEAction( i18n( "Open &Multiple Files..." ), "queue", CTRL+SHIFT+Key_O, - this, TQT_SLOT( slotOpenFiles() ), + this, TQ_SLOT( slotOpenFiles() ), actionCollection(), "plugin_presenter_openFiles" ); } - connect( m_pViewer, TQT_SIGNAL( imageOpened( const KURL & ) ), - TQT_SLOT( slotImageOpened( const KURL & ) ) ); + connect( m_pViewer, TQ_SIGNAL( imageOpened( const KURL & ) ), + TQ_SLOT( slotImageOpened( const KURL & ) ) ); } else kdWarning( 4630 ) << "no KImageViewer interface found - the presenter plugin won't work" << endl; //( void )new KViewPresenterConfModule( this ); - connect( m_pImageList->m_pListView, TQT_SIGNAL( executed( TQListViewItem* ) ), - this, TQT_SLOT( changeItem( TQListViewItem* ) ) ); - connect( m_pImageList->m_pPrevious, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( prev() ) ); - connect( m_pImageList->m_pNext, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( next() ) ); - connect( m_pImageList->m_pListView, TQT_SIGNAL( spacePressed( TQListViewItem* ) ), - this, TQT_SLOT( changeItem( TQListViewItem* ) ) ); - connect( m_pImageList->m_pListView, TQT_SIGNAL( returnPressed( TQListViewItem* ) ), - this, TQT_SLOT( changeItem( TQListViewItem* ) ) ); - connect( m_pImageList->m_pSlideshow, TQT_SIGNAL( toggled( bool ) ), - this, TQT_SLOT( slideshow( bool ) ) ); - connect( m_pImageList->m_pInterval, TQT_SIGNAL( valueChanged( int ) ), - this, TQT_SLOT( setSlideshowInterval( int ) ) ); - connect( m_pImageList->m_pShuffle, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( shuffle() ) ); - connect( m_pImageList->m_pLoad, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( loadList() ) ); - connect( m_pImageList->m_pSave, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( saveList() ) ); - connect( m_pImageList->m_pCloseAll, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( closeAll() ) ); + connect( m_pImageList->m_pListView, TQ_SIGNAL( executed( TQListViewItem* ) ), + this, TQ_SLOT( changeItem( TQListViewItem* ) ) ); + connect( m_pImageList->m_pPrevious, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( prev() ) ); + connect( m_pImageList->m_pNext, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( next() ) ); + connect( m_pImageList->m_pListView, TQ_SIGNAL( spacePressed( TQListViewItem* ) ), + this, TQ_SLOT( changeItem( TQListViewItem* ) ) ); + connect( m_pImageList->m_pListView, TQ_SIGNAL( returnPressed( TQListViewItem* ) ), + this, TQ_SLOT( changeItem( TQListViewItem* ) ) ); + connect( m_pImageList->m_pSlideshow, TQ_SIGNAL( toggled( bool ) ), + this, TQ_SLOT( slideshow( bool ) ) ); + connect( m_pImageList->m_pInterval, TQ_SIGNAL( valueChanged( int ) ), + this, TQ_SLOT( setSlideshowInterval( int ) ) ); + connect( m_pImageList->m_pShuffle, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( shuffle() ) ); + connect( m_pImageList->m_pLoad, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( loadList() ) ); + connect( m_pImageList->m_pSave, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( saveList() ) ); + connect( m_pImageList->m_pCloseAll, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( closeAll() ) ); // allow drop on the dialog m_pImageList->installEventFilter( this ); @@ -140,8 +139,8 @@ KViewPresenter::KViewPresenter( TQObject* parent, const char* name, const TQStri // grab drops on the main view m_pViewer->widget()->installEventFilter( this ); - connect( m_pSlideshowTimer, TQT_SIGNAL( timeout() ), - this, TQT_SLOT( next() ) ); + connect( m_pSlideshowTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( next() ) ); } KViewPresenter::~KViewPresenter() @@ -149,19 +148,19 @@ KViewPresenter::~KViewPresenter() kdDebug( 4630 ) << k_funcinfo << endl; if( m_paFileOpen ) { - disconnect( m_paFileOpen, TQT_SIGNAL( activated() ), this, TQT_SLOT( slotOpenFiles() ) ); + disconnect( m_paFileOpen, TQ_SIGNAL( activated() ), this, TQ_SLOT( slotOpenFiles() ) ); // If the parent() doesn't exist we either leave the "File Open" action // in an unusable state or KView was just shutting down and therefor we // can ignore this. I've only seen the second one happening and to get // rid of the TQObject::connect warning we do the parent() check. if( parent() ) - connect( m_paFileOpen, TQT_SIGNAL( activated() ), parent(), TQT_SLOT( slotOpenFile() ) ); + connect( m_paFileOpen, TQ_SIGNAL( activated() ), parent(), TQ_SLOT( slotOpenFile() ) ); } } bool KViewPresenter::eventFilter( TQObject *obj, TQEvent *ev ) { - if( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pImageList) || TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pImageList->m_pListView) || TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pImageList->m_pListView->viewport()) || TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pViewer->widget()) ) + if( obj == m_pImageList || obj == m_pImageList->m_pListView || obj == m_pImageList->m_pListView->viewport() || obj == m_pViewer->widget() ) { switch( ev->type() ) { @@ -190,14 +189,12 @@ bool KViewPresenter::eventFilter( TQObject *obj, TQEvent *ev ) { for( TQStringList::const_iterator it = l.begin(); it != l.end(); ++it ) { - ImageInfo * info = new ImageInfo( KURL( *it ) ); + ImageInfo info = ImageInfo( KURL( *it ) ); if( ! m_imagelist.contains( info ) ) { - m_imagelist.inSort( info ); + m_imagelist.append( info ); ( void )new ImageListItem( m_pImageList->m_pListView, KURL( *it ) ); } - else - delete info; } return true; } @@ -217,15 +214,13 @@ void KViewPresenter::slotImageOpened( const KURL & url ) if( ! m_bDontAdd ) { kdDebug( 4630 ) << k_funcinfo << "imagelist:" << endl; - ImageInfo * info = new ImageInfo( url ); + ImageInfo info = ImageInfo( url ); if( ! m_imagelist.contains( info ) ) { - m_imagelist.inSort( info ); + m_imagelist.append( info ); TQListViewItem * item = new ImageListItem( m_pImageList->m_pListView, url ); makeCurrent( item ); } - else - delete info; } } @@ -247,14 +242,12 @@ void KViewPresenter::slotOpenFiles() m_pViewer->openURL( *it ); for( ++it; it != urls.end(); ++it ) { - ImageInfo * info = new ImageInfo( *it ); + ImageInfo info = ImageInfo( *it ); if( ! m_imagelist.contains( info ) ) { - m_imagelist.inSort( info ); + m_imagelist.append( info ); ( void )new ImageListItem( m_pImageList->m_pListView, *it ); } - else - delete info; } } @@ -265,7 +258,7 @@ void KViewPresenter::slotClose() next = 0; ImageInfo info( m_pCurrentItem->url() ); - m_imagelist.remove( &info ); + m_imagelist.remove( info ); delete m_pCurrentItem; m_pCurrentItem = 0; @@ -285,7 +278,7 @@ void KViewPresenter::changeItem( TQListViewItem * qitem ) { kdDebug( 4630 ) << "file doesn't exist. removed." << endl; ImageInfo info( item->url() ); - m_imagelist.remove( &info ); + m_imagelist.remove( info ); if( m_pCurrentItem == item ) { TQListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild(); @@ -430,14 +423,12 @@ void KViewPresenter::loadList() while( ! t.eof() ) { KURL url ( t.readLine() ); - ImageInfo * info = new ImageInfo( url ); + ImageInfo info = ImageInfo( url ); if( ! m_imagelist.contains( info ) ) { - m_imagelist.inSort( info ); + m_imagelist.append( info ); ( void )new ImageListItem( m_pImageList->m_pListView, url ); } - else - delete info; } } else diff --git a/kview/modules/presenter/kviewpresenter.h b/kview/modules/presenter/kviewpresenter.h index 4159abc5..865c9f86 100644 --- a/kview/modules/presenter/kviewpresenter.h +++ b/kview/modules/presenter/kviewpresenter.h @@ -24,7 +24,7 @@ #include <tdeparts/plugin.h> #include <kurl.h> -#include <tqsortedlist.h> +#include <tqvaluelist.h> namespace KImageViewer { class Viewer; } @@ -37,7 +37,7 @@ class TDEAction; class KViewPresenter : public KParts::Plugin { - Q_OBJECT + TQ_OBJECT public: KViewPresenter( TQObject* parent, const char* name, const TQStringList & ); @@ -47,6 +47,11 @@ protected: struct ImageInfo { KURL url; + + ImageInfo() + : url() + { + } ImageInfo( const KURL & url ) : url( url ) { @@ -57,7 +62,7 @@ protected: } bool operator!=( const ImageInfo & i1 ) { - return url.prettyURL() == i1.url.prettyURL(); + return url.prettyURL() != i1.url.prettyURL(); } bool operator>( const ImageInfo & i1 ) { @@ -94,7 +99,7 @@ private: TDEAction * m_paFileOpen; TDEAction * m_paFileClose; - TQSortedList<ImageInfo> m_imagelist; + TQValueList<ImageInfo> m_imagelist; bool m_bDontAdd; ImageListItem * m_pCurrentItem; TQTimer * m_pSlideshowTimer; diff --git a/kview/modules/presenter/kviewpresenterconfmodule.h b/kview/modules/presenter/kviewpresenterconfmodule.h index c4bd52e0..5787541f 100644 --- a/kview/modules/presenter/kviewpresenterconfmodule.h +++ b/kview/modules/presenter/kviewpresenterconfmodule.h @@ -27,7 +27,7 @@ class TQCheckBox; class KViewPresenterConfModule : public KPreferencesModule { - Q_OBJECT + TQ_OBJECT public: KViewPresenterConfModule( TQObject * parent ); |