diff options
| author | 2007-01-26 03:54:22 +0000 | |
|---|---|---|
| committer | 2007-01-26 03:54:22 +0000 | |
| commit | 1a8a7e6f145613c34ff0604b95370995fc625ef2 (patch) | |
| tree | 79b63ab083ae2eecfbf98170e9d50731f6bb4d67 /src/modules | |
| parent | fix win compilation and update win projects (diff) | |
| download | KVIrc-1a8a7e6f145613c34ff0604b95370995fc625ef2.tar.gz KVIrc-1a8a7e6f145613c34ff0604b95370995fc625ef2.tar.bz2 KVIrc-1a8a7e6f145613c34ff0604b95370995fc625ef2.zip | |
More Qt 4.x port and the torrent module by Alexander Stillich
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@255 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
68 files changed, 2301 insertions, 603 deletions
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am index 165f56135..47280a277 100644 --- a/src/modules/Makefile.am +++ b/src/modules/Makefile.am @@ -56,5 +56,6 @@ SUBDIRS = about \ tmphighlight \ toolbar \ toolbareditor \ + torrent \ url \ window diff --git a/src/modules/actioneditor/actioneditor.cpp b/src/modules/actioneditor/actioneditor.cpp index f76bf5df9..5299e63a3 100644 --- a/src/modules/actioneditor/actioneditor.cpp +++ b/src/modules/actioneditor/actioneditor.cpp @@ -72,8 +72,8 @@ static QString g_szLastEditedAction; #define LVI_MINIMUM_TEXT_WIDTH 150 #define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER) -KviActionEditorListViewItem::KviActionEditorListViewItem(QListView * v,KviActionData * a) -: QListViewItem(v,"") +KviActionEditorListViewItem::KviActionEditorListViewItem(KviTalListView * v,KviActionData * a) +: KviTalListViewItem(v,"") { m_pActionData = a; m_pListView = v; @@ -111,7 +111,7 @@ QString KviActionEditorListViewItem::key(int,bool) const void KviActionEditorListViewItem::setup() { - QListViewItem::setup(); + KviTalListViewItem::setup(); int iWidth = m_pListView->visibleWidth(); if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER; @@ -617,7 +617,7 @@ void KviSingleActionEditor::commit() KviActionEditorListView::KviActionEditorListView(QWidget * pParent) -: QListView(pParent) +: KviTalListView(pParent) { setSelectionMode(Extended); int iWidth = visibleWidth(); @@ -633,7 +633,7 @@ KviActionEditorListView::~KviActionEditorListView() void KviActionEditorListView::resizeEvent(QResizeEvent * e) { - QListView::resizeEvent(e); + KviTalListView::resizeEvent(e); int iWidth = visibleWidth(); if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; setColumnWidth(0,iWidth); @@ -662,7 +662,7 @@ KviActionEditor::KviActionEditor(QWidget * par) //m_pListView->setMultiSelection(false); m_pListView->setShowSortIndicator(true); m_pListView->setFocusPolicy(QWidget::StrongFocus); - connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentChanged(QListViewItem *))); + connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentChanged(KviTalListViewItem *))); m_pNewActionButton = new QPushButton(__tr2qs("New Action"),box); @@ -846,7 +846,7 @@ bool KviActionEditor::actionExists(const QString &szName) } -void KviActionEditor::currentChanged(QListViewItem * i) +void KviActionEditor::currentChanged(KviTalListViewItem * i) { if(m_pSingleActionEditor->actionData()) { diff --git a/src/modules/actioneditor/actioneditor.h b/src/modules/actioneditor/actioneditor.h index 3417e92cd..bd6cf38c4 100644 --- a/src/modules/actioneditor/actioneditor.h +++ b/src/modules/actioneditor/actioneditor.h @@ -27,7 +27,7 @@ #include "kvi_window.h" #include <qwidget.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" class KviActionEditorListViewItem; @@ -71,16 +71,16 @@ class KviStyledCheckBox; class QSimpleRichText; class QPushButton; -class KviActionEditorListViewItem : public QListViewItem +class KviActionEditorListViewItem : public KviTalListViewItem { public: - KviActionEditorListViewItem(QListView * v,KviActionData * a); + KviActionEditorListViewItem(KviTalListView * v,KviActionData * a); ~KviActionEditorListViewItem(); protected: KviActionData * m_pActionData; QSimpleRichText * m_pText; QPixmap * m_pIcon; - QListView * m_pListView; + KviTalListView * m_pListView; QString m_szKey; public: KviActionData * actionData(){ return m_pActionData; }; @@ -92,7 +92,7 @@ public: }; -class KviActionEditorListView : public QListView +class KviActionEditorListView : public KviTalListView { Q_OBJECT public: @@ -170,7 +170,7 @@ protected: int selectedCount(); QString nameForAutomaticAction(const QString &szTemplate); protected slots: - void currentChanged(QListViewItem * it); + void currentChanged(KviTalListViewItem * it); void newAction(); void deleteActions(); void exportActions(); diff --git a/src/modules/addon/managementdialog.cpp b/src/modules/addon/managementdialog.cpp index 69f0241ac..7b4ed078e 100644 --- a/src/modules/addon/managementdialog.cpp +++ b/src/modules/addon/managementdialog.cpp @@ -62,8 +62,8 @@ extern QRect g_rectManagementDialogGeometry; #define LVI_MINIMUM_TEXT_WIDTH 300 #define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER) -KviScriptAddonListViewItem::KviScriptAddonListViewItem(QListView * v,KviKvsScriptAddon * a) -: QListViewItem(v,"") +KviScriptAddonListViewItem::KviScriptAddonListViewItem(KviTalListView * v,KviKvsScriptAddon * a) +: KviTalListViewItem(v,"") { m_pAddon = new KviKvsScriptAddon(*a); m_pListView = v; @@ -98,7 +98,7 @@ QString KviScriptAddonListViewItem::key(int,bool) const void KviScriptAddonListViewItem::setup() { - QListViewItem::setup(); + KviTalListViewItem::setup(); int iWidth = m_pListView->visibleWidth(); if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER; @@ -110,7 +110,7 @@ void KviScriptAddonListViewItem::setup() void KviScriptAddonListViewItem::paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align) { - QListViewItem::paintCell(p,cg,column,width,align); + KviTalListViewItem::paintCell(p,cg,column,width,align); // p->fillRect(QRect(0,0,width,height()),isSelected() ? cg.highlight() : cg.base()); p->drawPixmap(LVI_BORDER,LVI_BORDER,*m_pIcon); int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING; @@ -226,7 +226,7 @@ KviScriptManagementDialog::KviScriptManagementDialog(QWidget * p) fillListView(); currentChanged(0); - connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentChanged(QListViewItem *))); + connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentChanged(KviTalListViewItem *))); //currentToolBarChanged(); if(g_rectManagementDialogGeometry.y() < 5) @@ -261,7 +261,7 @@ void KviScriptManagementDialog::fillListView() } } -void KviScriptManagementDialog::currentChanged(QListViewItem *) +void KviScriptManagementDialog::currentChanged(KviTalListViewItem *) { KviScriptAddonListViewItem * it = (KviScriptAddonListViewItem *)m_pListView->currentItem(); if(!it) diff --git a/src/modules/addon/managementdialog.h b/src/modules/addon/managementdialog.h index 0c9a8fd23..9eeee79db 100644 --- a/src/modules/addon/managementdialog.h +++ b/src/modules/addon/managementdialog.h @@ -32,23 +32,23 @@ #include <qlabel.h> #include <qdialog.h> #include <qcolor.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" class QPushButton; class QPixmap; class QSimpleRichText; class KviKvsScriptAddon; -class KviScriptAddonListViewItem : public QListViewItem +class KviScriptAddonListViewItem : public KviTalListViewItem { public: - KviScriptAddonListViewItem(QListView * v,KviKvsScriptAddon * a); + KviScriptAddonListViewItem(KviTalListView * v,KviKvsScriptAddon * a); ~KviScriptAddonListViewItem(); protected: KviKvsScriptAddon * m_pAddon; QSimpleRichText * m_pText; QPixmap * m_pIcon; - QListView * m_pListView; + KviTalListView * m_pListView; QString m_szKey; public: KviKvsScriptAddon * addon(){ return m_pAddon; }; @@ -92,7 +92,7 @@ protected: virtual void showEvent(QShowEvent * e); virtual void closeEvent(QCloseEvent *e); protected slots: - void currentChanged(QListViewItem *i); + void currentChanged(KviTalListViewItem *i); void closeClicked(); void showScriptHelp(); void configureScript(); diff --git a/src/modules/aliaseditor/aliaseditor.cpp b/src/modules/aliaseditor/aliaseditor.cpp index 826acef1d..9033004e4 100644 --- a/src/modules/aliaseditor/aliaseditor.cpp +++ b/src/modules/aliaseditor/aliaseditor.cpp @@ -53,14 +53,14 @@ extern KviAliasEditorWindow * g_pAliasEditorWindow; extern KviModule * g_pAliasEditorModule; -KviAliasEditorListViewItem::KviAliasEditorListViewItem(QListView * pListView,Type eType,const QString &szName) -: QListViewItem(pListView), m_eType(eType), m_pParentNamespaceItem(0) +KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviTalListView * pListView,Type eType,const QString &szName) +: KviTalListViewItem(pListView), m_eType(eType), m_pParentNamespaceItem(0) { setName(szName); } KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,Type eType,const QString &szName) -: QListViewItem(pParentNamespaceItem), m_eType(eType), m_pParentNamespaceItem(pParentNamespaceItem) +: KviTalListViewItem(pParentNamespaceItem), m_eType(eType), m_pParentNamespaceItem(pParentNamespaceItem) { setName(szName); } @@ -88,7 +88,7 @@ KviAliasListViewItem::KviAliasListViewItem(KviAliasNamespaceListViewItem * pPare m_cPos=QPoint(0,0); } -KviAliasListViewItem::KviAliasListViewItem(QListView * pListView,const QString &szName) +KviAliasListViewItem::KviAliasListViewItem(KviTalListView * pListView,const QString &szName) : KviAliasEditorListViewItem(pListView,KviAliasEditorListViewItem::Alias,szName) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS))); @@ -96,7 +96,7 @@ KviAliasListViewItem::KviAliasListViewItem(QListView * pListView,const QString & } -KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(QListView * pListView,const QString &szName) +KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(KviTalListView * pListView,const QString &szName) : KviAliasEditorListViewItem(pListView,KviAliasEditorListViewItem::Namespace,szName) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_NAMESPACE))); @@ -214,9 +214,9 @@ KviAliasEditor::KviAliasEditor(QWidget * par) l->addWidget(m_pSplitter,0,0); KviTalVBox * box = new KviTalVBox(m_pSplitter); - m_pListView = new QListView(box); + m_pListView = new KviTalListView(box); m_pListView->addColumn(__tr2qs("Alias")); - m_pListView->setSelectionMode(QListView::Extended); + m_pListView->setSelectionMode(KviTalListView::Extended); m_pListView->setShowSortIndicator(true); m_pListView->setRootIsDecorated(true); @@ -379,12 +379,12 @@ void KviAliasEditor::oneTimeSetup() ++it; } - connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentItemChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); } -bool KviAliasEditor::hasSelectedItems(QListViewItem * it) +bool KviAliasEditor::hasSelectedItems(KviTalListViewItem * it) { if(!it)return false; if(it->isSelected())return true; @@ -395,7 +395,7 @@ bool KviAliasEditor::hasSelectedItems(QListViewItem * it) return hasSelectedItems(it->nextSibling()); } -bool KviAliasEditor::itemExists(QListViewItem *pSearchFor,QListViewItem * pSearchAt) +bool KviAliasEditor::itemExists(KviTalListViewItem *pSearchFor,KviTalListViewItem * pSearchAt) { if(!pSearchFor)return false; if(!pSearchAt)return false; @@ -405,7 +405,7 @@ bool KviAliasEditor::itemExists(QListViewItem *pSearchFor,QListViewItem * pSearc } -void KviAliasEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { m_pContextPopup->clear(); @@ -958,7 +958,7 @@ QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QStrin return szNewName; } -void KviAliasEditor::openParentItems(QListViewItem * it) +void KviAliasEditor::openParentItems(KviTalListViewItem * it) { if(it->parent()) { @@ -968,7 +968,7 @@ void KviAliasEditor::openParentItems(QListViewItem * it) } -void KviAliasEditor::selectOneItem(QListViewItem * it,QListViewItem *pStartFrom) +void KviAliasEditor::selectOneItem(KviTalListViewItem * it,KviTalListViewItem *pStartFrom) { if(!pStartFrom)return; if(pStartFrom == it)pStartFrom->setSelected(true); @@ -978,7 +978,7 @@ void KviAliasEditor::selectOneItem(QListViewItem * it,QListViewItem *pStartFrom) } -void KviAliasEditor::activateItem(QListViewItem * it) +void KviAliasEditor::activateItem(KviTalListViewItem * it) { openParentItems(it); selectOneItem(it,m_pListView->firstChild()); @@ -1062,9 +1062,9 @@ void KviAliasEditor::renameItem() } // take child items, if any - KviPtrList<QListViewItem> lChildren; + KviPtrList<KviTalListViewItem> lChildren; lChildren.setAutoDelete(false); - QListViewItem * it = m_pLastEditedItem->firstChild(); + KviTalListViewItem * it = m_pLastEditedItem->firstChild(); while(it) { lChildren.append(it); @@ -1116,7 +1116,7 @@ void KviAliasEditor::saveLastEditedItem() ((KviAliasListViewItem *)m_pLastEditedItem)->setCursorPosition(m_pEditor->getCursor()); } -void KviAliasEditor::currentItemChanged(QListViewItem *it) +void KviAliasEditor::currentItemChanged(KviTalListViewItem *it) { saveLastEditedItem(); diff --git a/src/modules/aliaseditor/aliaseditor.h b/src/modules/aliaseditor/aliaseditor.h index 4b4e54d37..12e62e04a 100644 --- a/src/modules/aliaseditor/aliaseditor.h +++ b/src/modules/aliaseditor/aliaseditor.h @@ -30,7 +30,7 @@ #include <qwidget.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qlineedit.h> #include "kvi_tal_popupmenu.h" #include <qstringlist.h> @@ -41,12 +41,12 @@ class KviScriptEditor; class KviAliasNamespaceListViewItem; -class KviAliasEditorListViewItem : public QListViewItem +class KviAliasEditorListViewItem : public KviTalListViewItem { public: enum Type { Alias, Namespace }; public: - KviAliasEditorListViewItem(QListView * pListView,Type eType,const QString &szName); + KviAliasEditorListViewItem(KviTalListView * pListView,Type eType,const QString &szName); KviAliasEditorListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,Type eType,const QString &szName); ~KviAliasEditorListViewItem(){}; protected: @@ -69,7 +69,7 @@ class KviAliasListViewItem; class KviAliasNamespaceListViewItem : public KviAliasEditorListViewItem { public: - KviAliasNamespaceListViewItem(QListView * pListView,const QString &szName); + KviAliasNamespaceListViewItem(KviTalListView * pListView,const QString &szName); KviAliasNamespaceListViewItem(KviAliasNamespaceListViewItem * pParentNamespace,const QString &szName); ~KviAliasNamespaceListViewItem(){}; public: @@ -86,7 +86,7 @@ class KviAliasListViewItem : public KviAliasEditorListViewItem { public: KviAliasListViewItem(KviAliasNamespaceListViewItem * pParentNamespace,const QString &szName); - KviAliasListViewItem(QListView *pListView,const QString &szName); + KviAliasListViewItem(KviTalListView *pListView,const QString &szName); ~KviAliasListViewItem(){}; public: QString m_szBuffer; @@ -108,7 +108,7 @@ public: ~KviAliasEditor(); public: KviScriptEditor * m_pEditor; - QListView * m_pListView; + KviTalListView * m_pListView; QLabel * m_pNameLabel; QPushButton * m_pRenameButton; KviAliasEditorListViewItem * m_pLastEditedItem; @@ -127,14 +127,14 @@ public: void loadProperties(KviConfig *); static void splitFullAliasOrNamespaceName(const QString &szFullName,QStringList &lNamespaces,QString &szName); protected slots: - void currentItemChanged(QListViewItem *it); + void currentItemChanged(KviTalListViewItem *it); void newAlias(); void newNamespace(); void exportAll(); void exportSelectedSepFiles(); void exportSelected(); void removeSelectedItems(); - void itemPressed(QListViewItem *it,const QPoint &pnt,int col); + void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col); void renameItem(); void slotFind(); void slotCollapseNamespaces(); @@ -148,18 +148,18 @@ protected: void recursiveCommit(KviAliasEditorListViewItem * it); void getExportAliasBuffer(QString &buffer,KviAliasListViewItem * it); void oneTimeSetup(); - void selectOneItem(QListViewItem * it,QListViewItem *pStartFrom); + void selectOneItem(KviTalListViewItem * it,KviTalListViewItem *pStartFrom); void saveLastEditedItem(); void getUniqueItemName(KviAliasEditorListViewItem *item,QString &buffer,KviAliasEditorListViewItem::Type eType); void appendSelectedItems(KviPtrList<KviAliasEditorListViewItem> * l,KviAliasEditorListViewItem * pStartFrom,bool bIncludeChildrenOfSelected = false); void appendAliasItems(KviPtrList<KviAliasListViewItem> * l,KviAliasEditorListViewItem * pStartFrom,bool bSelectedOnly); bool removeItem(KviAliasEditorListViewItem *it,bool * pbYesToAll,bool bDeleteEmptyTree); - void openParentItems(QListViewItem * it); - void activateItem(QListViewItem * it); + void openParentItems(KviTalListViewItem * it); + void activateItem(KviTalListViewItem * it); QString askForAliasName(const QString &szAction,const QString &szText,const QString &szInitialText); QString askForNamespaceName(const QString &szAction,const QString &szText,const QString &szInitialText); - bool itemExists(QListViewItem *pSearchFor,QListViewItem * pSearchAt); - bool hasSelectedItems(QListViewItem * it); + bool itemExists(KviTalListViewItem *pSearchFor,KviTalListViewItem * pSearchAt); + bool hasSelectedItems(KviTalListViewItem * it); KviAliasNamespaceListViewItem * findNamespaceItem(const QString &szName); KviAliasNamespaceListViewItem * getNamespaceItem(const QString &szName); KviAliasListViewItem * findAliasItem(const QString &szName); diff --git a/src/modules/channelsjoin/channelsjoinwindow.cpp b/src/modules/channelsjoin/channelsjoinwindow.cpp index c420bb6ed..ce46cbe79 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.cpp +++ b/src/modules/channelsjoin/channelsjoinwindow.cpp @@ -37,7 +37,7 @@ #include <qlabel.h> #include <qlineedit.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qgroupbox.h> #include <qlayout.h> #include <qcheckbox.h> @@ -60,13 +60,13 @@ KviChannelsJoinWindow::KviChannelsJoinWindow(QWidget * par, const char * name) QGridLayout * g = new QGridLayout(this,4,2,4,8); - m_pListView = new QListView(this); + m_pListView = new KviTalListView(this); m_pListView->addColumn(__tr2qs("Channel")); m_pListView->setRootIsDecorated(true); - m_pListView->setSelectionMode(QListView::Single); + m_pListView->setSelectionMode(KviTalListView::Single); g->addMultiCellWidget(m_pListView,0,0,0,1); - connect(m_pListView,SIGNAL(clicked(QListViewItem *)),this,SLOT(itemClicked(QListViewItem *))); - connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(itemDoubleClicked(QListViewItem *))); + connect(m_pListView,SIGNAL(clicked(KviTalListViewItem *)),this,SLOT(itemClicked(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *)),this,SLOT(itemDoubleClicked(KviTalListViewItem *))); m_pGroupBox = new QGroupBox(2,QGroupBox::Horizontal,__tr2qs("Channel" ),this); @@ -151,9 +151,9 @@ void KviChannelsJoinWindow::fillListView() m_pListView->header()->hide(); - QListViewItem * par = new QListViewItem(m_pListView,__tr2qs("Recent Channels")); + KviTalListViewItem * par = new KviTalListViewItem(m_pListView,__tr2qs("Recent Channels")); par->setOpen(true); - QListViewItem * chld; + KviTalListViewItem * chld; if(m_pConsole) { @@ -163,14 +163,14 @@ void KviChannelsJoinWindow::fillListView() { for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it) { - chld = new QListViewItem(par,*it); + chld = new KviTalListViewItem(par,*it); chld->setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); } } } // FIXME: Registered channels go here! - par = new QListViewItem(m_pListView,__tr2qs("Registered Channels")); + par = new KviTalListViewItem(m_pListView,__tr2qs("Registered Channels")); par->setOpen(true); KviAsciiDict<KviRegisteredChannelList> * d = g_pRegisteredChannelDataBase->channelDict(); @@ -179,7 +179,7 @@ void KviChannelsJoinWindow::fillListView() KviAsciiDictIterator<KviRegisteredChannelList> it(*d); while(it.current()) { - chld = new QListViewItem(par,it.currentKey()); + chld = new KviTalListViewItem(par,it.currentKey()); chld->setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); ++it; } @@ -188,7 +188,7 @@ void KviChannelsJoinWindow::fillListView() } -void KviChannelsJoinWindow::itemClicked(QListViewItem * it) +void KviChannelsJoinWindow::itemClicked(KviTalListViewItem * it) { if(!it)return; if(!it->parent())return; @@ -197,7 +197,7 @@ void KviChannelsJoinWindow::itemClicked(QListViewItem * it) enableJoin(); } -void KviChannelsJoinWindow::itemDoubleClicked(QListViewItem * it) +void KviChannelsJoinWindow::itemDoubleClicked(KviTalListViewItem * it) { if(!it)return; if(!it->parent())return; @@ -268,7 +268,7 @@ void KviChannelsJoinWindow::namesClicked() if(!tmp.isEmpty())doCmd("raw names", tmp.ptr()); } -void KviChannelsJoinWindow::itemDoubleClicked(QListBoxItem * it) +void KviChannelsJoinWindow::itemDoubleClicked(KviTalListBoxItem * it) { if (it == 0)return; KviStr tmp = it->text(); diff --git a/src/modules/channelsjoin/channelsjoinwindow.h b/src/modules/channelsjoin/channelsjoinwindow.h index 4bc9a2588..5e76791a2 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.h +++ b/src/modules/channelsjoin/channelsjoinwindow.h @@ -33,8 +33,8 @@ class QGroupBox; class QPushButton; class KviStyledCheckBox; class QLineEdit; -class QListView; -class QListViewItem; + +#include "kvi_tal_listview.h" class KviChannelsJoinWindow : public QDialog { @@ -44,7 +44,7 @@ public: ~KviChannelsJoinWindow(); protected: QLineEdit * m_pChannelEdit; - QListView * m_pListView; + KviTalListView * m_pListView; QGroupBox * m_pGroupBox; QLineEdit * m_pPass; KviStyledCheckBox * m_pShowAtStartupCheck; @@ -58,8 +58,8 @@ public: void setConsole(KviConsole * pConsole); protected slots: void editTextChanged(const QString &); - void itemClicked(QListViewItem *it); - void itemDoubleClicked(QListViewItem *it); + void itemClicked(KviTalListViewItem *it); + void itemDoubleClicked(KviTalListViewItem *it); void editReturnPressed(); void cancelClicked(); void joinClicked(); diff --git a/src/modules/editor/scripteditor.cpp b/src/modules/editor/scripteditor.cpp index bd27cae06..c2068daa4 100644 --- a/src/modules/editor/scripteditor.cpp +++ b/src/modules/editor/scripteditor.cpp @@ -69,8 +69,8 @@ static QColor g_clrFind(187,221,255); static QFont g_fntNormal("Fixed",12); -KviCompletionBox::KviCompletionBox(QWidget * parent = 0, const char * name = 0, WFlags f = 0) -: QListBox(parent,name,f) +KviCompletionBox::KviCompletionBox(QWidget * parent = 0) +: KviTalListBox(parent) { setPaletteForegroundColor(QColor(0,0,0)); setPaletteBackgroundColor(QColor(255,255,255)); @@ -80,7 +80,7 @@ KviCompletionBox::KviCompletionBox(QWidget * parent = 0, const char * name = 0, setFont(listfont); setVariableWidth(false); setFixedWidth(200); - //completelistbox->setColumnMode(QListBox::Variable); + //completelistbox->setColumnMode(KviTalListBox::Variable); hide(); } @@ -152,7 +152,7 @@ void KviCompletionBox::keyPressEvent(QKeyEvent * e) } } - QListBox::keyPressEvent(e); + KviTalListBox::keyPressEvent(e); } KviScriptEditorWidgetColorOptions::KviScriptEditorWidgetColorOptions(QWidget * pParent) @@ -223,7 +223,7 @@ KviScriptEditorWidget::KviScriptEditorWidget(QWidget * pParent) m_szHelp="Nothing"; updateOptions(); m_szFind=""; - completelistbox=new KviCompletionBox(this,"completelistbox"); + completelistbox=new KviCompletionBox(this); connect (completelistbox,SIGNAL(selected(const QString &)),this,SLOT(slotComplete(const QString &))); } diff --git a/src/modules/editor/scripteditor.h b/src/modules/editor/scripteditor.h index 914f9bd15..d0a278688 100644 --- a/src/modules/editor/scripteditor.h +++ b/src/modules/editor/scripteditor.h @@ -33,18 +33,18 @@ #include <qsyntaxhighlighter.h> #include <qdialog.h> #include <qcheckbox.h> -#include <qlistbox.h> +#include "kvi_tal_listbox.h" #include <qevent.h> #include "kvi_list.h" #include "kvi_selectors.h" typedef KviPtrList<int> ColumnList; -class KviCompletionBox: public QListBox +class KviCompletionBox: public KviTalListBox { Q_OBJECT public: - KviCompletionBox(QWidget * parent, const char * name, WFlags f); + KviCompletionBox(QWidget * parent); ~KviCompletionBox(){}; void updateContents(QString word); diff --git a/src/modules/eventeditor/eventeditor.cpp b/src/modules/eventeditor/eventeditor.cpp index ca2dd5e3f..0d0d547ad 100644 --- a/src/modules/eventeditor/eventeditor.cpp +++ b/src/modules/eventeditor/eventeditor.cpp @@ -74,7 +74,7 @@ KviEventEditor::KviEventEditor(QWidget * par) l->addWidget(spl,0,0); KviTalVBox * boxi = new KviTalVBox(spl); - m_pListView = new QListView(boxi); + m_pListView = new KviTalListView(boxi); m_pListView->addColumn(__tr2qs("Event")); m_pListView->setMultiSelection(false); m_pListView->setShowSortIndicator(true); @@ -127,12 +127,12 @@ void KviEventEditor::oneTimeSetup() m_pContextPopup = new KviTalPopupMenu(this); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(selectionChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); } -void KviEventEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviEventEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { __range_valid(m_bOneTimeSetupDone); @@ -205,14 +205,14 @@ void KviEventEditor::addHandlerForCurrentEvent() { __range_valid(m_pOneTimeSetupDone); - QListViewItem * it = m_pListView->selectedItem(); + KviTalListViewItem * it = m_pListView->selectedItem(); if(it) { if(it->parent() == 0) { QString buffer = __tr2qs("default"); getUniqueHandlerName((KviEventListViewItem *)it,buffer); - QListViewItem * ch = new KviEventHandlerListViewItem(it,buffer,"",true); + KviTalListViewItem * ch = new KviEventHandlerListViewItem(it,buffer,"",true); it->setOpen(true); m_pListView->setSelected(ch,true); } @@ -224,7 +224,7 @@ void KviEventEditor::removeCurrentHandler() __range_valid(m_pOneTimeSetupDone); if(m_pLastEditedItem) { - QListViewItem * it = m_pLastEditedItem; + KviTalListViewItem * it = m_pLastEditedItem; m_pLastEditedItem = 0; delete it; m_pEditor->setEnabled(false); @@ -249,13 +249,13 @@ void KviEventEditor::commit() saveLastEditedItem(); KviKvsEventManager::instance()->removeAllScriptAppHandlers(); - for(QListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling()) + for(KviTalListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling()) { if(it->firstChild()) { QString szContext; - for(QListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling()) + for(KviTalListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling()) { KviQString::sprintf(szContext,"%Q::%Q",&(((KviEventListViewItem *)it)->m_szName),&(((KviEventHandlerListViewItem *)ch)->m_szName)); @@ -292,7 +292,7 @@ void KviEventEditor::saveLastEditedItem() m_pLastEditedItem->m_szBuffer = tmp; } -void KviEventEditor::selectionChanged(QListViewItem * it) +void KviEventEditor::selectionChanged(KviTalListViewItem * it) { __range_valid(m_bOneTimeSetupDone); saveLastEditedItem(); diff --git a/src/modules/eventeditor/eventeditor.h b/src/modules/eventeditor/eventeditor.h index cfd2783fd..e9f94ff4d 100644 --- a/src/modules/eventeditor/eventeditor.h +++ b/src/modules/eventeditor/eventeditor.h @@ -26,35 +26,35 @@ #include "kvi_string.h" #include <qwidget.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qlineedit.h> class KviScriptEditor; -class KviEventListViewItem : public QListViewItem +class KviEventListViewItem : public KviTalListViewItem { public: unsigned int m_uEventIdx; QString m_szName; QString m_szParams; public: - KviEventListViewItem(QListView * par,unsigned int uEvIdx,const QString &name,const QString ¶ms) - : QListViewItem(par), m_uEventIdx(uEvIdx), m_szName(name), m_szParams(params) {}; + KviEventListViewItem(KviTalListView * par,unsigned int uEvIdx,const QString &name,const QString ¶ms) + : KviTalListViewItem(par), m_uEventIdx(uEvIdx), m_szName(name), m_szParams(params) {}; ~KviEventListViewItem() {}; public: virtual QString text(int col) const { return m_szName; }; virtual const QPixmap * pixmap(int col) const; }; -class KviEventHandlerListViewItem : public QListViewItem +class KviEventHandlerListViewItem : public KviTalListViewItem { public: QString m_szName; QString m_szBuffer; bool m_bEnabled; public: - KviEventHandlerListViewItem(QListViewItem * par,const QString &name,const QString &buffer,bool bEnabled) - : QListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {}; + KviEventHandlerListViewItem(KviTalListViewItem * par,const QString &name,const QString &buffer,bool bEnabled) + : KviTalListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {}; ~KviEventHandlerListViewItem() {}; public: virtual QString text(int col) const { return m_szName; }; @@ -71,7 +71,7 @@ public: ~KviEventEditor(); public: KviScriptEditor * m_pEditor; - QListView * m_pListView; + KviTalListView * m_pListView; QLineEdit * m_pNameEditor; KviTalPopupMenu * m_pContextPopup; KviEventHandlerListViewItem * m_pLastEditedItem; @@ -82,8 +82,8 @@ public: void getUniqueHandlerName(KviEventListViewItem *it,QString &buffer); void getExportEventBuffer(QString &szBuffer,KviEventHandlerListViewItem * it); protected slots: - void selectionChanged(QListViewItem *it); - void itemPressed(QListViewItem *it,const QPoint &pnt,int col); + void selectionChanged(KviTalListViewItem *it); + void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col); void toggleCurrentHandlerEnabled(); void removeCurrentHandler(); void addHandlerForCurrentEvent(); diff --git a/src/modules/filetransferwindow/filetransferwindow.cpp b/src/modules/filetransferwindow/filetransferwindow.cpp index 740790300..e410a028f 100644 --- a/src/modules/filetransferwindow/filetransferwindow.cpp +++ b/src/modules/filetransferwindow/filetransferwindow.cpp @@ -58,8 +58,8 @@ extern KviFileTransferWindow * g_pFileTransferWindow; -KviFileTransferItem::KviFileTransferItem(QListView * v,KviFileTransfer * t) -: QListViewItem(v) +KviFileTransferItem::KviFileTransferItem(KviTalListView * v,KviFileTransfer * t) +: KviTalListViewItem(v) { m_pTransfer = t; m_pTransfer->setDisplayItem(this); @@ -130,7 +130,7 @@ void KviFileTransferItem::paintCell(QPainter * p,const QColorGroup &cg,int colum void KviFileTransferItem::setHeight(int h) { - QListViewItem::setHeight(m_pTransfer->displayHeight(g_pFileTransferWindow->lineSpacing())); + KviTalListViewItem::setHeight(m_pTransfer->displayHeight(g_pFileTransferWindow->lineSpacing())); } @@ -153,7 +153,7 @@ KviFileTransferWindow::KviFileTransferWindow(KviModuleExtensionDescriptor * d,Kv m_pSplitter = new QSplitter(QSplitter::Horizontal,this,"splitter"); m_pVertSplitter = new QSplitter(QSplitter::Vertical,m_pSplitter,"vsplitter"); - m_pListView = new QListView(m_pVertSplitter); + m_pListView = new KviTalListView(m_pVertSplitter); //m_pListView->header()->hide(); m_pListView->setAllColumnsShowFocus(true); m_pListView->addColumn(__tr2qs_ctx("Type","filetransferwindow"),56); @@ -166,8 +166,8 @@ KviFileTransferWindow::KviFileTransferWindow(KviModuleExtensionDescriptor * d,Kv //m_pListView->setFocusPolicy(NoFocus); //m_pListView->viewport()->setFocusPolicy(NoFocus); - //connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - // this,SLOT(showHostPopup(QListViewItem *,const QPoint &,int))); + //connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + // this,SLOT(showHostPopup(KviTalListViewItem *,const QPoint &,int))); QFontMetrics fm(font()); m_iLineSpacing = fm.lineSpacing(); @@ -175,8 +175,8 @@ KviFileTransferWindow::KviFileTransferWindow(KviModuleExtensionDescriptor * d,Kv m_pIrcView = new KviIrcView(m_pVertSplitter,lpFrm,this); m_pListView->installEventFilter(this); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),this,SLOT(rightButtonPressed(QListViewItem *,const QPoint &,int))); - connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(doubleClicked(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),this,SLOT(rightButtonPressed(KviTalListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *,const QPoint &,int)),this,SLOT(doubleClicked(KviTalListViewItem *,const QPoint &,int))); fillTransferView(); connect(KviFileTransferManager::instance(),SIGNAL(transferRegistered(KviFileTransfer *)),this,SLOT(transferRegistered(KviFileTransfer *))); @@ -268,13 +268,13 @@ void KviFileTransferWindow::transferUnregistering(KviFileTransfer * t) it = 0; } -void KviFileTransferWindow::doubleClicked(QListViewItem *it,const QPoint &pnt,int col) +void KviFileTransferWindow::doubleClicked(KviTalListViewItem *it,const QPoint &pnt,int col) { if(it) openLocalFile(); } -void KviFileTransferWindow::rightButtonPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviFileTransferWindow::rightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { if(!m_pContextPopup)m_pContextPopup = new KviTalPopupMenu(this); if(!m_pLocalFilePopup)m_pLocalFilePopup = new KviTalPopupMenu(this); @@ -410,7 +410,7 @@ void KviFileTransferWindow::rightButtonPressed(QListViewItem *it,const QPoint &p KviFileTransfer * KviFileTransferWindow::selectedTransfer() { - QListViewItem * it = m_pListView->selectedItem(); + KviTalListViewItem * it = m_pListView->selectedItem(); if(!it)return 0; KviFileTransferItem * i = (KviFileTransferItem *)it; return i->transfer(); @@ -622,8 +622,8 @@ void KviFileTransferWindow::heartbeat() { if(m_pListView->childCount() < 1)return; - QListViewItem * i1; - QListViewItem * i2; + KviTalListViewItem * i1; + KviTalListViewItem * i2; i1 = m_pListView->itemAt(QPoint(1,1)); if(!i1) diff --git a/src/modules/filetransferwindow/filetransferwindow.h b/src/modules/filetransferwindow/filetransferwindow.h index 17eddb41a..7c79dcf7d 100644 --- a/src/modules/filetransferwindow/filetransferwindow.h +++ b/src/modules/filetransferwindow/filetransferwindow.h @@ -33,7 +33,7 @@ #include "kvi_filetransfer.h" #include "kvi_dynamictooltip.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #include "kvi_tal_popupmenu.h" #include <qtoolbutton.h> #include <qtimer.h> @@ -41,10 +41,10 @@ -class KviFileTransferItem : public QListViewItem +class KviFileTransferItem : public KviTalListViewItem { public: - KviFileTransferItem(QListView * v,KviFileTransfer * t); + KviFileTransferItem(KviTalListView * v,KviFileTransfer * t); ~KviFileTransferItem(); protected: KviFileTransfer * m_pTransfer; @@ -65,7 +65,7 @@ public: ~KviFileTransferWindow(); protected: QSplitter * m_pVertSplitter; - QListView * m_pListView; + KviTalListView * m_pListView; KviTalPopupMenu * m_pContextPopup; KviTalPopupMenu * m_pLocalFilePopup; KviTalPopupMenu * m_pOpenFilePopup; @@ -92,8 +92,8 @@ public: protected slots: void transferRegistered(KviFileTransfer *t); void transferUnregistering(KviFileTransfer *t); - void rightButtonPressed(QListViewItem *it,const QPoint &pnt,int col); - void doubleClicked(QListViewItem *it,const QPoint &pnt,int col); + void rightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col); + void doubleClicked(KviTalListViewItem *it,const QPoint &pnt,int col); void heartbeat(); void clearTerminated(); void clearAll(); diff --git a/src/modules/help/helpwindow.cpp b/src/modules/help/helpwindow.cpp index c051ebbb8..eb40416ac 100644 --- a/src/modules/help/helpwindow.cpp +++ b/src/modules/help/helpwindow.cpp @@ -92,7 +92,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) connect(pBtnRefreshIndex,SIGNAL(clicked()),this,SLOT(refreshIndex())); QToolTip::add( pBtnRefreshIndex, __tr2qs("Refresh index") ); - m_pIndexListBox = new QListBox(m_pIndexTab); + m_pIndexListBox = new KviTalListBox(m_pIndexTab); QStringList docList=g_pDocIndex->titlesList(); m_pIndexListBox->insertStringList(docList); connect(m_pIndexListBox,SIGNAL(selected(int)),this,SLOT(indexSelected ( int ))); @@ -107,7 +107,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name) connect( m_pTermsEdit, SIGNAL( returnPressed() ), this, SLOT( startSearch() ) ); - m_pResultBox = new QListBox(m_pSearchTab); + m_pResultBox = new KviTalListBox(m_pSearchTab); connect(m_pResultBox,SIGNAL(selected(int)),this,SLOT(searchSelected ( int ))); QValueList<int> li; @@ -245,7 +245,7 @@ void KviHelpWindow::showIndexTopic() void KviHelpWindow::searchInIndex( const QString &s ) { - QListBoxItem *i = m_pIndexListBox->firstItem(); + KviTalListBoxItem *i = m_pIndexListBox->firstItem(); QString sl = s.lower(); while ( i ) { QString t = i->text(); diff --git a/src/modules/help/helpwindow.h b/src/modules/help/helpwindow.h index 1a48cd73d..2f130eaaa 100644 --- a/src/modules/help/helpwindow.h +++ b/src/modules/help/helpwindow.h @@ -26,7 +26,7 @@ #include "kvi_string.h" #include "kvi_tal_vbox.h" #include <qtabwidget.h> -#include <qlistbox.h> +#include "kvi_tal_listbox.h" #include <qlineedit.h> #include <qprogressdialog.h> @@ -46,11 +46,11 @@ protected: KviTalVBox * m_pIndexTab; KviTalVBox * m_pSearchTab; - QListBox * m_pIndexListBox; + KviTalListBox * m_pIndexListBox; QLineEdit * m_pIndexSearch; QStringList m_foundDocs; QStringList m_terms; - QListBox * m_pResultBox; + KviTalListBox * m_pResultBox; QLineEdit * m_pTermsEdit; public: KviHelpWidget * helpWidget(){ return m_pHelpWidget; }; diff --git a/src/modules/links/linkswindow.cpp b/src/modules/links/linkswindow.cpp index 35d76fa7a..e8e06fb84 100644 --- a/src/modules/links/linkswindow.cpp +++ b/src/modules/links/linkswindow.cpp @@ -66,14 +66,14 @@ KviLinksWindow::KviLinksWindow(KviFrame * lpFrm,KviConsole * lpConsole) m_pSplitter = new QSplitter(QSplitter::Horizontal,this,"splitter"); m_pVertSplitter = new QSplitter(QSplitter::Vertical,m_pSplitter,"vsplitter"); - m_pListView = new QListView(m_pVertSplitter); + m_pListView = new KviTalListView(m_pVertSplitter); m_pListView->addColumn(__tr2qs("Link")); m_pListView->addColumn(__tr2qs("Hops")); m_pListView->addColumn(__tr2qs("Description")); m_pListView->setRootIsDecorated(true); m_pListView->setAllColumnsShowFocus(true); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(showHostPopup(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(showHostPopup(KviTalListViewItem *,const QPoint &,int))); m_pIrcView = new KviIrcView(m_pVertSplitter,lpFrm,this); @@ -194,8 +194,8 @@ void KviLinksWindow::endOfLinks() outputNoFmt(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Received end of links.")); outputNoFmt(KVI_OUT_SYSTEMMESSAGE,"======================"); - QListViewItem * it = 0; - QListViewItem * root = 0; + KviTalListViewItem * it = 0; + KviTalListViewItem * root = 0; int totalHosts = 0; int totalHops = 0; @@ -213,7 +213,7 @@ void KviLinksWindow::endOfLinks() m_pListView->setUpdatesEnabled(false); for(KviLink *l=m_pLinkList->first();l;l=m_pLinkList->next()){ totalHosts++; - if(l->hops == 0)root = new QListViewItem(m_pListView,QString(l->host.ptr()),"0",QString(l->description.ptr())); + if(l->hops == 0)root = new KviTalListViewItem(m_pListView,QString(l->host.ptr()),"0",QString(l->description.ptr())); else { totalHops += l->hops; if(l->hops < 4){ @@ -237,10 +237,10 @@ void KviLinksWindow::endOfLinks() brokenLinks++; KviStr tmp(KviStr::Format,__tr2qs("%s: Parent link %s"),l->description.ptr(),l->parent.ptr()); KviStr tmp2(KviStr::Format,"%d",l->hops); - if(root)it = new QListViewItem(m_pListView,root,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr())); + if(root)it = new KviTalListViewItem(m_pListView,root,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr())); else { outputNoFmt(KVI_OUT_SYSTEMERROR,__tr2qs("Warning: No root link was sent by the server, the stats may be invalid.")); - it = new QListViewItem(m_pListView,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr())); + it = new KviTalListViewItem(m_pListView,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr())); } } else { it = it->parent(); @@ -304,35 +304,35 @@ void KviLinksWindow::endOfLinks() m_pListView->repaint(); } -QListViewItem * KviLinksWindow::insertLink(KviLink *l) +KviTalListViewItem * KviLinksWindow::insertLink(KviLink *l) { __range_valid(l->hops > 0); - QListViewItem * i = getItemByHost(l->parent.ptr(),0); - QListViewItem * it = 0; + KviTalListViewItem * i = getItemByHost(l->parent.ptr(),0); + KviTalListViewItem * it = 0; if(!i)return 0; else { KviStr hops(KviStr::Format,"%d",l->hops); - it = new QListViewItem(i,QString(l->host.ptr()),QString(hops.ptr()),QString(l->description.ptr())); + it = new KviTalListViewItem(i,QString(l->host.ptr()),QString(hops.ptr()),QString(l->description.ptr())); i->setOpen(true); } return it; } -QListViewItem * KviLinksWindow::getItemByHost(const char *host,QListViewItem * par) +KviTalListViewItem * KviLinksWindow::getItemByHost(const char *host,KviTalListViewItem * par) { - QListViewItem * i = (par ? par->firstChild() : m_pListView->firstChild()); + KviTalListViewItem * i = (par ? par->firstChild() : m_pListView->firstChild()); if(!i)return 0; while(i){ KviStr tmp = i->text(0); if(kvi_strEqualCI(tmp.ptr(),host))return i; - QListViewItem * ch = getItemByHost(host,i); + KviTalListViewItem * ch = getItemByHost(host,i); if(ch)return ch; i = i->nextSibling(); } return 0; } -void KviLinksWindow::showHostPopup(QListViewItem *i,const QPoint &p,int) +void KviLinksWindow::showHostPopup(KviTalListViewItem *i,const QPoint &p,int) { if(!i)return; KviStr host=i->text(0); diff --git a/src/modules/links/linkswindow.h b/src/modules/links/linkswindow.h index 8de5b8be2..f89129b5a 100644 --- a/src/modules/links/linkswindow.h +++ b/src/modules/links/linkswindow.h @@ -29,7 +29,7 @@ #include "kvi_console.h" #include "kvi_irccontext.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #include "kvi_tal_popupmenu.h" #include <qtoolbutton.h> @@ -54,7 +54,7 @@ public: protected: QSplitter * m_pVertSplitter; QSplitter * m_pTopSplitter; - QListView * m_pListView; + KviTalListView * m_pListView; KviPtrList<KviLink> * m_pLinkList; KviTalPopupMenu * m_pHostPopup; QString m_szRootServer; @@ -73,7 +73,7 @@ protected: // virtual void setProperties(KviWindowProperty *p); // virtual void saveProperties(); protected slots: - void showHostPopup(QListViewItem *i,const QPoint &p,int c); + void showHostPopup(KviTalListViewItem *i,const QPoint &p,int c); void hostPopupClicked(int id); void requestLinks(); void connectionStateChange(); @@ -82,8 +82,8 @@ public: private: void reset(); void endOfLinks(); - QListViewItem * insertLink(KviLink * l); - QListViewItem * getItemByHost(const char *host,QListViewItem * par); + KviTalListViewItem * insertLink(KviLink * l); + KviTalListViewItem * getItemByHost(const char *host,KviTalListViewItem * par); }; #endif //_KVI_LINKSWINDOW_H_ diff --git a/src/modules/list/listwindow.cpp b/src/modules/list/listwindow.cpp index 32d0be5d9..81254e647 100644 --- a/src/modules/list/listwindow.cpp +++ b/src/modules/list/listwindow.cpp @@ -69,8 +69,8 @@ KviChannelListViewItemData::~KviChannelListViewItemData() -KviChannelListViewItem::KviChannelListViewItem(QListView * v,KviChannelListViewItemData * pData) -: QListViewItem(v) +KviChannelListViewItem::KviChannelListViewItem(KviTalListView * v,KviChannelListViewItemData * pData) +: KviTalListViewItem(v) { m_pData = pData; } @@ -81,7 +81,7 @@ KviChannelListViewItem::~KviChannelListViewItem() delete m_pData; } -int KviChannelListViewItem::width ( const QFontMetrics & fm, const QListView * lv, int column ) const +int KviChannelListViewItem::width ( const QFontMetrics & fm, const KviTalListView * lv, int column ) const { QString szText; @@ -109,7 +109,7 @@ void KviChannelListViewItem::paintCell(QPainter * p,const QColorGroup &cg,int co default: szText = m_pData->m_szTopic; break; } - QListView* lv = listView(); + KviTalListView* lv = (KviTalListView *)listView(); int marg = lv->itemMargin(); int r = marg; @@ -194,14 +194,14 @@ KviListWindow::KviListWindow(KviFrame * lpFrm,KviConsole * lpConsole) m_pInfoLabel = new KviThemedLabel(m_pTopSplitter,"info_label"); - m_pListView = new QListView(m_pVertSplitter); + m_pListView = new KviTalListView(m_pVertSplitter); m_pListView->addColumn(__tr2qs("Channel")); m_pListView->addColumn(__tr2qs("Users")); m_pListView->addColumn(__tr2qs("Topic")); m_pListView->setAllColumnsShowFocus(TRUE); m_pListView->setSorting(100); - connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(itemDoubleClicked(QListViewItem *))); + connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *)),this,SLOT(itemDoubleClicked(KviTalListViewItem *))); m_pIrcView = new KviIrcView(m_pVertSplitter,lpFrm,this); @@ -388,7 +388,7 @@ void KviListWindow::flush() m_pListView->viewport()->update(); } -void KviListWindow::itemDoubleClicked(QListViewItem *it) +void KviListWindow::itemDoubleClicked(KviTalListViewItem *it) { QString sz = ((KviChannelListViewItem *)it)->channel(); if(sz.isEmpty())return; diff --git a/src/modules/list/listwindow.h b/src/modules/list/listwindow.h index 4bce65750..009522662 100644 --- a/src/modules/list/listwindow.h +++ b/src/modules/list/listwindow.h @@ -32,7 +32,7 @@ #include "kvi_console.h" #include "kvi_irccontext.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #include "kvi_tal_popupmenu.h" #include <qtoolbutton.h> #include <qlineedit.h> @@ -52,16 +52,16 @@ protected: QString m_szUsersKey; }; -class KviChannelListViewItem : public QListViewItem +class KviChannelListViewItem : public KviTalListViewItem { public: - KviChannelListViewItem(QListView * v,KviChannelListViewItemData * pData); + KviChannelListViewItem(KviTalListView * v,KviChannelListViewItemData * pData); ~KviChannelListViewItem(); protected: KviChannelListViewItemData * m_pData; public: const QString & channel(){ return m_pData->m_szChan; }; - virtual int width ( const QFontMetrics & fm, const QListView * lv, int c ) const; + virtual int width ( const QFontMetrics & fm, const KviTalListView * lv, int c ) const; protected: virtual void paintCell(QPainter * p,const QColorGroup &cg,int col,int wdth,int align); virtual QString key(int col,bool) const; @@ -78,7 +78,7 @@ public: protected: QSplitter * m_pVertSplitter; QSplitter * m_pTopSplitter; - QListView * m_pListView; + KviTalListView * m_pListView; QLineEdit * m_pParamsEdit; QToolButton * m_pRequestButton; QToolButton * m_pStopListDownloadButton; @@ -97,7 +97,7 @@ protected: virtual void getBaseLogFileName(KviStr &buffer); protected slots: void flush(); - void itemDoubleClicked(QListViewItem *it); + void itemDoubleClicked(KviTalListViewItem *it); void requestList(); void stoplistdownload(); void connectionStateChange(); diff --git a/src/modules/logview/logviewmdiwindow.cpp b/src/modules/logview/logviewmdiwindow.cpp index 91be75ce1..951d33f8c 100644 --- a/src/modules/logview/logviewmdiwindow.cpp +++ b/src/modules/logview/logviewmdiwindow.cpp @@ -35,7 +35,7 @@ #include <qpixmap.h> #include <qsplitter.h> #include <qtoolbutton.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qfileinfo.h> #include <qdir.h> #include "kvi_tal_popupmenu.h" @@ -59,15 +59,15 @@ KviLogViewMDIWindow::KviLogViewMDIWindow(KviModuleExtensionDescriptor * d,KviFra m_pIndexTab = new KviTalVBox(m_pTabWidget); m_pTabWidget->insertTab(m_pIndexTab,__tr2qs_ctx("Index","logview")); - m_pListView = new QListView(m_pIndexTab); + m_pListView = new KviTalListView(m_pIndexTab); m_pListView->addColumn(__tr2qs_ctx("Log File","logview"),135); - m_pListView->setColumnWidthMode(0,QListView::Maximum); + m_pListView->setColumnWidthMode(0,KviTalListView::Maximum); m_pListView->setAllColumnsShowFocus(true); m_pListView->setMultiSelection(false); m_pListView->setShowSortIndicator(true); m_pListView->setRootIsDecorated(true); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(itemSelected(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonClicked ( QListViewItem * , const QPoint &, int )),this,SLOT(rightButtonClicked ( QListViewItem * , const QPoint &, int ))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(itemSelected(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonClicked ( KviTalListViewItem * , const QPoint &, int )),this,SLOT(rightButtonClicked ( KviTalListViewItem * , const QPoint &, int ))); //m_pSearchTab = new KviTalVBox(m_pTabWidget); //m_pTabWidget->insertTab(m_pSearchTab,__tr2qs_ctx("Search","logview")); @@ -214,7 +214,7 @@ void KviLogViewMDIWindow::oneTimeSetup() } } -void KviLogViewMDIWindow::itemSelected(QListViewItem * it) +void KviLogViewMDIWindow::itemSelected(KviTalListViewItem * it) { bool bCompressed=0; //A parent node @@ -289,7 +289,7 @@ QStringList KviLogViewMDIWindow::getFileNames() return logDir.entryList(); } -void KviLogViewMDIWindow::rightButtonClicked ( QListViewItem * it, const QPoint &, int ) +void KviLogViewMDIWindow::rightButtonClicked ( KviTalListViewItem * it, const QPoint &, int ) { if(!it) return; if(((KviLogListViewItem *)it)->fileName(0).isEmpty()) return; diff --git a/src/modules/logview/logviewmdiwindow.h b/src/modules/logview/logviewmdiwindow.h index a106e98bf..02cb8a387 100644 --- a/src/modules/logview/logviewmdiwindow.h +++ b/src/modules/logview/logviewmdiwindow.h @@ -26,11 +26,11 @@ #include "kvi_moduleextension.h" #include "kvi_tal_vbox.h" +#include "kvi_tal_listview.h" #include <qtabwidget.h> -class QListView; +class KviTalListView; class QStringList; -class QListViewItem; class KviLogViewWidget; class KviLogViewMDIWindow : public KviWindow , public KviModuleExtension @@ -40,7 +40,7 @@ public: KviLogViewMDIWindow(KviModuleExtensionDescriptor * d,KviFrame * lpFrm); ~KviLogViewMDIWindow(); protected: - QListView * m_pListView; + KviTalListView * m_pListView; QStringList * m_pFileNames; QString m_szLogDirectory; QTabWidget * m_pTabWidget; @@ -57,8 +57,8 @@ protected: virtual void die(); virtual QSize sizeHint() const; protected slots: - void rightButtonClicked ( QListViewItem *, const QPoint &, int ); - void itemSelected(QListViewItem * it); + void rightButtonClicked ( KviTalListViewItem *, const QPoint &, int ); + void itemSelected(KviTalListViewItem * it); void deleteCurrent(); }; diff --git a/src/modules/logview/logviewwidget.h b/src/modules/logview/logviewwidget.h index f97c98598..bc0ef146a 100644 --- a/src/modules/logview/logviewwidget.h +++ b/src/modules/logview/logviewwidget.h @@ -26,18 +26,18 @@ #include "kvi_window.h" #include "kvi_scripteditor.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" class KviScriptEditor; -class KviLogListViewItem : public QListViewItem +class KviLogListViewItem : public KviTalListViewItem { public: - KviLogListViewItem(QListViewItem * par, const QString & typeName, const QString & name) - : QListViewItem(par), m_szTypeName(typeName), m_szName(name) {}; - KviLogListViewItem(QListView * par, const QString & typeName, const QString & name) - : QListViewItem(par), m_szTypeName(typeName), m_szName(name) {}; + KviLogListViewItem(KviTalListViewItem * par, const QString & typeName, const QString & name) + : KviTalListViewItem(par), m_szTypeName(typeName), m_szName(name) {}; + KviLogListViewItem(KviTalListView * par, const QString & typeName, const QString & name) + : KviTalListViewItem(par), m_szTypeName(typeName), m_szName(name) {}; ~KviLogListViewItem() {}; public: QString m_szTypeName; @@ -50,7 +50,7 @@ public: class KviLogListViewItemType : public KviLogListViewItem { public: - KviLogListViewItemType(QListView * par, const QString & typeName) + KviLogListViewItemType(KviTalListView * par, const QString & typeName) : KviLogListViewItem(par,typeName,typeName) {}; ~KviLogListViewItemType() {}; public: @@ -61,7 +61,7 @@ public: class KviLogListViewLog : public KviLogListViewItem { public: - KviLogListViewLog(QListViewItem * par,const QString & date, const QString & fileName, const QString & owner) + KviLogListViewLog(KviTalListViewItem * par,const QString & date, const QString & fileName, const QString & owner) : KviLogListViewItem(par,"",date), m_szFileName(fileName), m_szOwner(owner) {}; ~KviLogListViewLog() {}; public: diff --git a/src/modules/mediaplayer/mp_amarokinterface.cpp b/src/modules/mediaplayer/mp_amarokinterface.cpp index ee996e54b..e12c9c2cb 100644 --- a/src/modules/mediaplayer/mp_amarokinterface.cpp +++ b/src/modules/mediaplayer/mp_amarokinterface.cpp @@ -48,7 +48,7 @@ MP_IMPLEMENT_DESCRIPTOR( KviAmarokInterface::KviAmarokInterface() -: KviMediaPlayerDCOPInterface("amarok") + : KviDCOPHelper(true, "amarok") { } @@ -58,28 +58,28 @@ KviAmarokInterface::~KviAmarokInterface() int KviAmarokInterface::detect(bool bStart){ return detectApp("amarok",bStart,95,99); } -bool KviAmarokInterface::prev(){ return simpleDCOPCall("player","prev()"); } -bool KviAmarokInterface::next(){ return simpleDCOPCall("player","next()"); } -bool KviAmarokInterface::play(){ return simpleDCOPCall("player","play()"); } -bool KviAmarokInterface::stop(){ return simpleDCOPCall("player","stop()"); } -bool KviAmarokInterface::pause(){ return simpleDCOPCall("player","pause()"); } -bool KviAmarokInterface::mute(){ return simpleDCOPCall("player","mute()"); } -bool KviAmarokInterface::quit(){ return simpleDCOPCall("MainApplication-Interface","quit()"); } +bool KviAmarokInterface::prev(){ return voidRetVoidDCOPCall("player","prev()"); } +bool KviAmarokInterface::next(){ return voidRetVoidDCOPCall("player","next()"); } +bool KviAmarokInterface::play(){ return voidRetVoidDCOPCall("player","play()"); } +bool KviAmarokInterface::stop(){ return voidRetVoidDCOPCall("player","stop()"); } +bool KviAmarokInterface::pause(){ return voidRetVoidDCOPCall("player","pause()"); } +bool KviAmarokInterface::mute(){ return voidRetVoidDCOPCall("player","mute()"); } +bool KviAmarokInterface::quit(){ return voidRetVoidDCOPCall("MainApplication-Interface","quit()"); } bool KviAmarokInterface::jumpTo(int &iPos) { - return intDCOPCall("player","seek(int)",iPos/1000); + return voidRetIntDCOPCall("player","seek(int)",iPos/1000); } bool KviAmarokInterface::setVol(int &iVol) { - return intDCOPCall("player","setVolume(int)",100*iVol/255); + return voidRetIntDCOPCall("player","setVolume(int)",100*iVol/255); } #define MP_DCOP_STRING_CALL(_fncname,_iface,_fnc) \ QString KviAmarokInterface::_fncname() \ { \ QString ret; \ - if(!stringRetDCOPCall(_iface,_fnc,ret))return false; \ + if(!stringRetVoidDCOPCall(_iface,_fnc,ret))return false; \ return ret; \ } @@ -94,59 +94,59 @@ MP_DCOP_STRING_CALL(album,"player","album()") int KviAmarokInterface::getVol() { int ret; - if(!intRetDCOPCall("player","getVolume()",ret))return false; + if(!intRetVoidDCOPCall("player","getVolume()",ret))return false; return ret * 255 / 100; } int KviAmarokInterface::sampleRate() { int ret; - if(!intRetDCOPCall("player","sampleRate()",ret))return false; + if(!intRetVoidDCOPCall("player","sampleRate()",ret))return false; return ret; } int KviAmarokInterface::length() { int ret; - if(!intRetDCOPCall("player","trackTotalTime()",ret))return false; + if(!intRetVoidDCOPCall("player","trackTotalTime()",ret))return false; return ret * 1000; } int KviAmarokInterface::position() { int ret; - if(!intRetDCOPCall("player","trackCurrentTime()",ret))return false; + if(!intRetVoidDCOPCall("player","trackCurrentTime()",ret))return false; return ret * 1000; } bool KviAmarokInterface::getRepeat() { bool ret; - if(!boolRetDCOPCall("player","repeatTrackStatus()",ret))return false; + if(!boolRetVoidDCOPCall("player","repeatTrackStatus()",ret))return false; return ret; } bool KviAmarokInterface::getShuffle() { bool ret; - if(!boolRetDCOPCall("player","randomModeStatus()",ret))return false; + if(!boolRetVoidDCOPCall("player","randomModeStatus()",ret))return false; return ret; } bool KviAmarokInterface::setRepeat(bool &bVal) { - return boolDCOPCall("player","enableRepeatTrack(bool)",bVal); + return voidRetBoolDCOPCall("player","enableRepeatTrack(bool)",bVal); } bool KviAmarokInterface::setShuffle(bool &bVal) { - return boolDCOPCall("player","enableRandomMode(bool)",bVal); + return voidRetBoolDCOPCall("player","enableRandomMode(bool)",bVal); } KviMediaPlayerInterface::PlayerStatus KviAmarokInterface::status() { int ret; - if(!intRetDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown; + if(!intRetVoidDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown; switch(ret) { case 0: @@ -168,7 +168,7 @@ KviMediaPlayerInterface::PlayerStatus KviAmarokInterface::status() QString KviAmarokInterface::mrl() { QString ret; - if(!stringRetDCOPCall("player","encodedURL()",ret))return false; + if(!stringRetVoidDCOPCall("player","encodedURL()",ret))return false; KURL url(ret); return url.prettyURL(); } diff --git a/src/modules/mediaplayer/mp_amarokinterface.h b/src/modules/mediaplayer/mp_amarokinterface.h index f19d07772..81463a382 100644 --- a/src/modules/mediaplayer/mp_amarokinterface.h +++ b/src/modules/mediaplayer/mp_amarokinterface.h @@ -28,9 +28,10 @@ #ifdef COMPILE_KDE_SUPPORT - #include "mp_dcopinterface.h" + #include "kvi_dcophelper.h" + #include "mp_interface.h" - class KviAmarokInterface : public KviMediaPlayerDCOPInterface + class KviAmarokInterface : public KviMediaPlayerInterface, private KviDCOPHelper { public: KviAmarokInterface(); diff --git a/src/modules/mediaplayer/mp_jukinterface.cpp b/src/modules/mediaplayer/mp_jukinterface.cpp index 0b31ebedf..3e89a408f 100644 --- a/src/modules/mediaplayer/mp_jukinterface.cpp +++ b/src/modules/mediaplayer/mp_jukinterface.cpp @@ -50,7 +50,7 @@ MP_IMPLEMENT_DESCRIPTOR( KviJukInterface::KviJukInterface() -: KviMediaPlayerDCOPInterface("amarok") + : KviDCOPHelper(true, "amarok") { } @@ -60,27 +60,27 @@ KviJukInterface::~KviJukInterface() int KviJukInterface::detect(bool bStart){ return detectApp("juk",bStart,90,96); } -bool KviJukInterface::prev(){ return simpleDCOPCall("Player","forward()"); } -bool KviJukInterface::next(){ return simpleDCOPCall("Player","back()"); } -bool KviJukInterface::play(){ return simpleDCOPCall("Player","play()"); } -bool KviJukInterface::stop(){ return simpleDCOPCall("Player","stop()"); } -bool KviJukInterface::pause(){ return simpleDCOPCall("Player","pause()"); } -bool KviJukInterface::quit(){ return simpleDCOPCall("MainApplication-Interface","quit()"); } +bool KviJukInterface::prev(){ return voidRetVoidDCOPCall("Player","forward()"); } +bool KviJukInterface::next(){ return voidRetVoidDCOPCall("Player","back()"); } +bool KviJukInterface::play(){ return voidRetVoidDCOPCall("Player","play()"); } +bool KviJukInterface::stop(){ return voidRetVoidDCOPCall("Player","stop()"); } +bool KviJukInterface::pause(){ return voidRetVoidDCOPCall("Player","pause()"); } +bool KviJukInterface::quit(){ return voidRetVoidDCOPCall("MainApplication-Interface","quit()"); } bool KviJukInterface::setVol(int &iVol) { - return floatDCOPCall("player","setVolume(float)",(float)(iVol)/255.); + return voidRetFloatDCOPCall("player","setVolume(float)",(float)(iVol)/255.); } bool KviJukInterface::jumpTo(int &iPos) { - return intDCOPCall("player","seek(int)",iPos/1000); + return voidRetIntDCOPCall("player","seek(int)",iPos/1000); } bool KviJukInterface::getShuffle() { QString szMode; - if(!stringRetDCOPCall("player","randomPlayMode()",szMode))return false; + if(!stringRetVoidDCOPCall("player","randomPlayMode()",szMode))return false; return (szMode != "NoRandom"); } @@ -93,7 +93,7 @@ bool KviJukInterface::setShuffle(bool &bVal) } else { szMode = "NoRandom"; } - if(!stringDCOPCall("player","setRandomPlayMode(QString)",szMode))return false; + if(!voidRetStringDCOPCall("player","setRandomPlayMode(QString)",szMode))return false; return true; } @@ -102,7 +102,7 @@ bool KviJukInterface::setShuffle(bool &bVal) QString KviJukInterface::_fncname() \ { \ QString ret; \ - if(!stringRetDCOPCall(_iface,_fnc,ret))return false; \ + if(!stringRetVoidDCOPCall(_iface,_fnc,ret))return false; \ return ret; \ } @@ -121,7 +121,7 @@ MP_DCOP_STRING_CALL(album,"player","album()") int KviJukInterface::sampleRate() { int ret; - if(!intRetDCOPCall("player","sampleRate()",ret))return false; + if(!intRetVoidDCOPCall("player","sampleRate()",ret))return false; return ret; } */ @@ -129,21 +129,21 @@ int KviJukInterface::sampleRate() int KviJukInterface::length() { int ret; - if(!intRetDCOPCall("player","totalTime()",ret))return false; + if(!intRetVoidDCOPCall("player","totalTime()",ret))return false; return ret * 1000; } int KviJukInterface::position() { int ret; - if(!intRetDCOPCall("player","currentTime()",ret))return false; + if(!intRetVoidDCOPCall("player","currentTime()",ret))return false; return ret * 1000; } KviMediaPlayerInterface::PlayerStatus KviJukInterface::status() { int ret; - if(!intRetDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown; + if(!intRetVoidDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown; switch(ret) { case 0: diff --git a/src/modules/mediaplayer/mp_jukinterface.h b/src/modules/mediaplayer/mp_jukinterface.h index 61685d992..80b55dfdd 100644 --- a/src/modules/mediaplayer/mp_jukinterface.h +++ b/src/modules/mediaplayer/mp_jukinterface.h @@ -29,9 +29,10 @@ #ifdef COMPILE_KDE_SUPPORT - #include "mp_dcopinterface.h" + #include "kvi_dcophelper.h" + #include "mp_interface.h" - class KviJukInterface : public KviMediaPlayerDCOPInterface + class KviJukInterface : public KviMediaPlayerInterface, private KviDCOPHelper { public: KviJukInterface(); diff --git a/src/modules/objects/class_listbox.cpp b/src/modules/objects/class_listbox.cpp index efd576acd..56ce9d3ee 100644 --- a/src/modules/objects/class_listbox.cpp +++ b/src/modules/objects/class_listbox.cpp @@ -26,7 +26,7 @@ #include "kvi_debug.h" -#include <qlistbox.h> +#include "kvi_tal_listbox.h" #include "class_list.h" #include "class_listbox.h" @@ -149,12 +149,12 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_listbox) bool KviKvsObject_listbox::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams) { - QListBox * b = new QListBox(parentScriptWidget(), name()); - b->setSelectionMode(QListBox::Single); + KviTalListBox * b = new KviTalListBox(parentScriptWidget()); + b->setSelectionMode(KviTalListBox::Single); connect(b,SIGNAL(selectionChanged()),this,SLOT(selectionChanged())); - connect(b,SIGNAL(currentChanged(QListBoxItem *)),this,SLOT(currentItemChanged(QListBoxItem *))); + connect(b,SIGNAL(currentChanged(KviTalListBoxItem *)),this,SLOT(currentItemChanged(KviTalListBoxItem *))); - connect(b,SIGNAL(onItem(QListBoxItem *)),this,SLOT(onItem(QListBoxItem *))); + connect(b,SIGNAL(onItem(KviTalListBoxItem *)),this,SLOT(onItem(KviTalListBoxItem *))); setObject(b,true);; return true; @@ -169,12 +169,12 @@ bool KviKvsObject_listbox::functioninsertItem(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("index",KVS_PT_INT,KVS_PF_OPTIONAL,iIndex) KVSO_PARAMETERS_END(c) if(widget()) - ((QListBox *)widget())->insertItem(szItem, iIndex); + ((KviTalListBox *)widget())->insertItem(szItem, iIndex); return true; } bool KviKvsObject_listbox::functionclear(KviKvsObjectFunctionCall *c) { - if (widget()) ((QListBox *)widget())->clear(); + if (widget()) ((KviTalListBox *)widget())->clear(); return true; } bool KviKvsObject_listbox::functionchangeItem(KviKvsObjectFunctionCall *c) @@ -188,14 +188,14 @@ bool KviKvsObject_listbox::functionchangeItem(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_END(c) if(!widget()) return true; if (szText.isEmpty()) c->warning(__tr2qs("No string parameter given - using empty string")); - if(uIndex >= (cnt = ((QListBox *)widget())->count())) + if(uIndex >= (cnt = ((KviTalListBox *)widget())->count())) { c->warning(__tr2qs("Item index [%d] is too big - defaulting to " \ "$count() - 1 [%d]"), uIndex, cnt); uIndex = cnt - 1; } - ((QListBox *)widget())->changeItem(szText, uIndex); + ((KviTalListBox *)widget())->changeItem(szText, uIndex); return true; @@ -208,14 +208,14 @@ bool KviKvsObject_listbox::functionremoveItem(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex) KVSO_PARAMETERS_END(c) if(!widget()) return true; - if(uIndex >= (cnt = ((QListBox *)widget())->count())) + if(uIndex >= (cnt = ((KviTalListBox *)widget())->count())) { c->warning(__tr2qs("Item index [%d] is too big - defaulting to " \ "$count() - 1 [%d]"), uIndex, cnt); uIndex = cnt - 1; } - ((QListBox *)widget())->removeItem(uIndex); + ((KviTalListBox *)widget())->removeItem(uIndex); return true; @@ -223,17 +223,17 @@ bool KviKvsObject_listbox::functionremoveItem(KviKvsObjectFunctionCall *c) bool KviKvsObject_listbox::functioncount(KviKvsObjectFunctionCall *c) { - if (widget()) c->returnValue()->setInteger(((QListBox *)widget())->count()); + if (widget()) c->returnValue()->setInteger(((KviTalListBox *)widget())->count()); return true; } bool KviKvsObject_listbox::functioncurrentText(KviKvsObjectFunctionCall *c) { - if (widget()) c->returnValue()->setString(((QListBox *)widget())->currentText().local8Bit().data()); + if (widget()) c->returnValue()->setString(((KviTalListBox *)widget())->currentText().local8Bit().data()); return true; } bool KviKvsObject_listbox::functioncurrentItem(KviKvsObjectFunctionCall *c) { - if (widget()) c->returnValue()->setInteger(((QListBox *)widget())->currentItem()); + if (widget()) c->returnValue()->setInteger(((KviTalListBox *)widget())->currentItem()); return true; } @@ -245,7 +245,7 @@ bool KviKvsObject_listbox::functiontextAt(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex) KVSO_PARAMETERS_END(c) if(widget()) - c->returnValue()->setString(((QListBox *)widget())->text(uIndex)); + c->returnValue()->setString(((KviTalListBox *)widget())->text(uIndex)); return true; } bool KviKvsObject_listbox::functionsetCurrentItem(KviKvsObjectFunctionCall *c) @@ -255,7 +255,7 @@ bool KviKvsObject_listbox::functionsetCurrentItem(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex) KVSO_PARAMETERS_END(c) if(widget()) - ((QListBox *)widget())->setCurrentItem(uIndex); + ((KviTalListBox *)widget())->setCurrentItem(uIndex); return true; } bool KviKvsObject_listbox::functionsetSelectionMode(KviKvsObjectFunctionCall *c) @@ -265,18 +265,18 @@ bool KviKvsObject_listbox::functionsetSelectionMode(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("selection_mode",KVS_PT_STRING,0,szMode) KVSO_PARAMETERS_END(c) if(!widget()) return true; - QListBox::SelectionMode iMode = QListBox::Single; + KviTalListBox::SelectionMode iMode = KviTalListBox::Single; - if(KviQString::equalCI(szMode,"single")) iMode = QListBox::Single; + if(KviQString::equalCI(szMode,"single")) iMode = KviTalListBox::Single; - else if(KviQString::equalCI(szMode,"multi")) iMode = QListBox::Multi; + else if(KviQString::equalCI(szMode,"multi")) iMode = KviTalListBox::Multi; - else if(KviQString::equalCI(szMode,"extended")) iMode = QListBox::Extended; + else if(KviQString::equalCI(szMode,"extended")) iMode = KviTalListBox::Extended; - else if(KviQString::equalCI(szMode,"none")) iMode = QListBox::NoSelection; + else if(KviQString::equalCI(szMode,"none")) iMode = KviTalListBox::NoSelection; else c->warning(__tr2qs("Invalid selection mode '%Q' assuming single"),&szMode); - ((QListBox *)widget())->setSelectionMode(iMode); + ((KviTalListBox *)widget())->setSelectionMode(iMode); return true; } @@ -284,12 +284,12 @@ bool KviKvsObject_listbox::functionselectionMode(KviKvsObjectFunctionCall *c) { if(!widget()) return true; - switch(((QListBox *)widget())->selectionMode()) + switch(((KviTalListBox *)widget())->selectionMode()) { - case QListBox::Single: c->returnValue()->setString("single"); break; - case QListBox::Multi: c->returnValue()->setString("multi"); break; - case QListBox::Extended: c->returnValue()->setString("extended"); break; - case QListBox::NoSelection: c->returnValue()->setString("none"); break; + case KviTalListBox::Single: c->returnValue()->setString("single"); break; + case KviTalListBox::Multi: c->returnValue()->setString("multi"); break; + case KviTalListBox::Extended: c->returnValue()->setString("extended"); break; + case KviTalListBox::NoSelection: c->returnValue()->setString("none"); break; default: c->returnValue()->setString("single"); break; } return true; @@ -302,7 +302,7 @@ bool KviKvsObject_listbox::functionisSelected(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex) KVSO_PARAMETERS_END(c) - if(widget())c->returnValue()->setBoolean(((QListBox *)widget())->isSelected(uIndex)); + if(widget())c->returnValue()->setBoolean(((KviTalListBox *)widget())->isSelected(uIndex)); return true; } bool KviKvsObject_listbox::functionsetSelected(KviKvsObjectFunctionCall *c) @@ -313,7 +313,7 @@ bool KviKvsObject_listbox::functionsetSelected(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex) KVSO_PARAMETER("benabled",KVS_PT_BOOLEAN,0,bSel) KVSO_PARAMETERS_END(c) - if(widget()) ((QListBox *)widget())->setSelected(uIndex,bSel); + if(widget()) ((KviTalListBox *)widget())->setSelected(uIndex,bSel); return true; } bool KviKvsObject_listbox::functionitemAt(KviKvsObjectFunctionCall *c) @@ -324,7 +324,7 @@ bool KviKvsObject_listbox::functionitemAt(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("uY",KVS_PT_UNSIGNEDINTEGER,0,uY) KVSO_PARAMETERS_END(c) if(widget()) - c->returnValue()->setInteger(((QListBox *)widget())->index(((QListBox *)widget())->itemAt(QPoint(uX,uY)))); + c->returnValue()->setInteger(((KviTalListBox *)widget())->index(((KviTalListBox *)widget())->itemAt(QPoint(uX,uY)))); return true; } @@ -341,7 +341,7 @@ void KviKvsObject_listbox::selectionChanged() callFunction(this,"selectionChangeEvent",0,0); } -void KviKvsObject_listbox::currentItemChanged(QListBoxItem *item) +void KviKvsObject_listbox::currentItemChanged(KviTalListBoxItem *item) { if (!item) callFunction(this,"currentItemChangeEvent",0,0); else @@ -358,9 +358,9 @@ bool KviKvsObject_listbox::functiononItemEvent(KviKvsObjectFunctionCall *c) return true; } -void KviKvsObject_listbox::onItem(QListBoxItem *item) +void KviKvsObject_listbox::onItem(KviTalListBoxItem *item) { - QListBox *lbx(item->listBox()); + KviTalListBox *lbx = (KviTalListBox *)(item->listBox()); KviKvsVariantList params(new KviKvsVariant((kvs_int_t)lbx->index(item))); callFunction(this,"onItemEvent",0,¶ms); } @@ -374,7 +374,7 @@ kvs_uint_t uIndex; KVSO_PARAMETERS_END(c) if(widget()) { - QRect rect=((QListBox *)widget())->itemRect(((QListBox *)widget())->item(uIndex)); + QRect rect=((KviTalListBox *)widget())->itemRect(((KviTalListBox *)widget())->item(uIndex)); KviKvsArray * a = new KviKvsArray(); a->set(0,new KviKvsVariant((kvs_int_t)rect.left())); a->set(1,new KviKvsVariant((kvs_int_t)rect.top())); diff --git a/src/modules/objects/class_listbox.h b/src/modules/objects/class_listbox.h index 30991927d..360f162bd 100644 --- a/src/modules/objects/class_listbox.h +++ b/src/modules/objects/class_listbox.h @@ -26,8 +26,8 @@ #include "class_widget.h" -class QListBox; -class QListBoxItem; +class KviTalListBox; +class KviTalListBoxItem; #include "object_macros.h" @@ -61,8 +61,8 @@ protected: bool functionitemRect(KviKvsObjectFunctionCall *c); protected slots: void selectionChanged(); - void currentItemChanged(QListBoxItem *); - void onItem(QListBoxItem *); + void currentItemChanged(KviTalListBoxItem *); + void onItem(KviTalListBoxItem *); }; diff --git a/src/modules/objects/class_listview.cpp b/src/modules/objects/class_listview.cpp index 347166d14..735a55384 100644 --- a/src/modules/objects/class_listview.cpp +++ b/src/modules/objects/class_listview.cpp @@ -25,7 +25,7 @@ //================================================================================= -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qheader.h> #include "class_listview.h" #include "kvi_error.h" @@ -213,17 +213,17 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_listview) bool KviKvsObject_listview::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams) { setObject(new KviKvsMdmListView(parentScriptWidget(),name(),this),true); - connect(widget(),SIGNAL(clicked(QListViewItem *)),this,SLOT(slotClicked(QListViewItem *))); - connect(widget(),SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(slotSelectionChanged(QListViewItem *))); + connect(widget(),SIGNAL(clicked(KviTalListViewItem *)),this,SLOT(slotClicked(KviTalListViewItem *))); + connect(widget(),SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(slotSelectionChanged(KviTalListViewItem *))); connect(widget(),SIGNAL(selectionChanged()),this,SLOT(slotMultipleSelectionChanged())); - connect(widget(),SIGNAL(currentChanged(QListViewItem *)),this,SLOT(slotCurrentChanged(QListViewItem *))); - connect(widget(),SIGNAL(returnPressed(QListViewItem *)),this,SLOT(slotReturnPressed(QListViewItem *))); - connect(widget(),SIGNAL(spacePressed(QListViewItem *)),this,SLOT(slotSpacePressed(QListViewItem *))); - connect(widget(),SIGNAL(onItem(QListViewItem *)),this,SLOT(slotOnItem(QListViewItem *))); - connect(widget(),SIGNAL(expanded(QListViewItem *)),this,SLOT(slotItemExpanded(QListViewItem *))); - connect(widget(),SIGNAL(collapsed(QListViewItem *)),this,SLOT(slotItemCollapsed(QListViewItem *))); - connect(widget(),SIGNAL(rightButtonClicked(QListViewItem *,const QPoint &,int)),this,SLOT(slotRightButtonClicked(QListViewItem *,const QPoint &,int))); - connect(widget(),SIGNAL(itemRenamed(QListViewItem *,int,const QString &)),this,SLOT(slotItemRenamed(QListViewItem *,int,const QString &))); + connect(widget(),SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(slotCurrentChanged(KviTalListViewItem *))); + connect(widget(),SIGNAL(returnPressed(KviTalListViewItem *)),this,SLOT(slotReturnPressed(KviTalListViewItem *))); + connect(widget(),SIGNAL(spacePressed(KviTalListViewItem *)),this,SLOT(slotSpacePressed(KviTalListViewItem *))); + connect(widget(),SIGNAL(onItem(KviTalListViewItem *)),this,SLOT(slotOnItem(KviTalListViewItem *))); + connect(widget(),SIGNAL(expanded(KviTalListViewItem *)),this,SLOT(slotItemExpanded(KviTalListViewItem *))); + connect(widget(),SIGNAL(collapsed(KviTalListViewItem *)),this,SLOT(slotItemCollapsed(KviTalListViewItem *))); + connect(widget(),SIGNAL(rightButtonClicked(KviTalListViewItem *,const QPoint &,int)),this,SLOT(slotRightButtonClicked(KviTalListViewItem *,const QPoint &,int))); + connect(widget(),SIGNAL(itemRenamed(KviTalListViewItem *,int,const QString &)),this,SLOT(slotItemRenamed(KviTalListViewItem *,int,const QString &))); return true; } @@ -236,7 +236,7 @@ bool KviKvsObject_listview::function_addColumn(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("width",KVS_PT_INT,0,iW) KVSO_PARAMETERS_END(c) if (widget()) - ((QListView *)object())->addColumn(szLabel,iW); + ((KviTalListView *)object())->addColumn(szLabel,iW); return true; } /* @@ -247,21 +247,21 @@ bool KviKvsObject_listview::function_setAcceptDrops(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("bEnable",KVS_PT_BOOLEAN,0,bEnable) KVSO_PARAMETERS_END(c) if (widget()) - ((QListView *)object())->setAcceptDrops(bEnable); + ((KviTalListView *)object())->setAcceptDrops(bEnable); return true; } */ bool KviKvsObject_listview::function_clear(KviKvsObjectFunctionCall *c) { if (widget()) - ((QListView *)object())->clear(); + ((KviTalListView *)object())->clear(); return true; } bool KviKvsObject_listview::function_selectedItem(KviKvsObjectFunctionCall *c) { if(widget()) - c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((QListView *)widget())->selectedItem())); + c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((KviTalListView *)widget())->selectedItem())); else c->returnValue()->setHObject((kvs_hobject_t)0); return true; @@ -270,7 +270,7 @@ bool KviKvsObject_listview::function_selectedItem(KviKvsObjectFunctionCall *c) bool KviKvsObject_listview::function_firstChild(KviKvsObjectFunctionCall *c) { if(widget()) - c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((QListView *)widget())->firstChild())); + c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((KviTalListView *)widget())->firstChild())); else c->returnValue()->setHObject((kvs_hobject_t)0); return true; @@ -279,7 +279,7 @@ bool KviKvsObject_listview::function_firstChild(KviKvsObjectFunctionCall *c) bool KviKvsObject_listview::function_currentItem(KviKvsObjectFunctionCall *c) { if(widget()) - c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((QListView *)widget())->currentItem())); + c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((KviTalListView *)widget())->currentItem())); else c->returnValue()->setHObject((kvs_hobject_t)0); return true; @@ -293,7 +293,7 @@ bool KviKvsObject_listview::function_setColumnText(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("column",KVS_PT_UNSIGNEDINTEGER,0,uCol) KVSO_PARAMETER("text",KVS_PT_STRING,0,szText) KVSO_PARAMETERS_END(c) - if (widget())((QListView *)widget())->setColumnText(uCol,szText); + if (widget())((KviTalListView *)widget())->setColumnText(uCol,szText); return true; } @@ -305,13 +305,13 @@ bool KviKvsObject_listview::function_setSelectionMode(KviKvsObjectFunctionCall * KVSO_PARAMETERS_END(c) if(!widget())return true; if(KviQString::equalCI(szMode,"NoSelection")) - ((QListView *)widget())->setSelectionMode(QListView::NoSelection); + ((KviTalListView *)widget())->setSelectionMode(KviTalListView::NoSelection); else if(KviQString::equalCI(szMode,"Multi")) - ((QListView *)widget())->setSelectionMode(QListView::Multi); + ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Multi); else if(KviQString::equalCI(szMode,"Extended")) - ((QListView *)widget())->setSelectionMode(QListView::Extended); + ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Extended); else if(KviQString::equalCI(szMode,"Single")) - ((QListView *)widget())->setSelectionMode(QListView::Single); + ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Single); else c->warning(__tr2qs("Invalid selection mode 'Q'"),&szMode); return true; } @@ -324,7 +324,7 @@ bool KviKvsObject_listview::function_setSorting(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("column",KVS_PT_INT,0,iCol) KVSO_PARAMETER("benabled",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - if (widget()) ((QListView *)widget())->setSorting(iCol,bEnabled); + if (widget()) ((KviTalListView *)widget())->setSorting(iCol,bEnabled); return true; } @@ -335,7 +335,7 @@ bool KviKvsObject_listview::function_setRootIsDecorated(KviKvsObjectFunctionCall KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - if (widget()) ((QListView *)widget())->setRootIsDecorated(bEnabled); + if (widget()) ((KviTalListView *)widget())->setRootIsDecorated(bEnabled); return true; } @@ -345,23 +345,23 @@ bool KviKvsObject_listview::function_setAllColumnsShowFocus(KviKvsObjectFunction KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("bAllColumnsShowFocus",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - if (widget())((QListView *)widget())->setAllColumnsShowFocus(bEnabled); + if (widget())((KviTalListView *)widget())->setAllColumnsShowFocus(bEnabled); return true; } bool KviKvsObject_listview::function_hideListViewHeader(KviKvsObjectFunctionCall *c) { - ((QListView *)widget())->header()->hide(); + ((KviTalListView *)widget())->header()->hide(); return true; } bool KviKvsObject_listview::function_showListViewHeader(KviKvsObjectFunctionCall *c) { - ((QListView *)widget())->header()->show(); + ((KviTalListView *)widget())->header()->show(); return true; } bool KviKvsObject_listview::function_listViewHeaderIsVisible(KviKvsObjectFunctionCall *c) { - c->returnValue()->setBoolean(((QListView *)widget())->header()->isVisible()); + c->returnValue()->setBoolean(((KviTalListView *)widget())->header()->isVisible()); return true; } @@ -371,7 +371,7 @@ bool KviKvsObject_listview::function_itemClickedEvent(KviKvsObjectFunctionCall * return true; } -void KviKvsObject_listview::slotClicked(QListViewItem * i) +void KviKvsObject_listview::slotClicked(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"itemClickedEvent",0,¶ms); @@ -383,7 +383,7 @@ bool KviKvsObject_listview::function_selectionChangedEvent(KviKvsObjectFunctionC return true; } -void KviKvsObject_listview::slotSelectionChanged(QListViewItem * i) +void KviKvsObject_listview::slotSelectionChanged(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"selectionChangedEvent",0,¶ms); @@ -402,7 +402,7 @@ bool KviKvsObject_listview::function_currentChangedEvent(KviKvsObjectFunctionCal return true; } -void KviKvsObject_listview::slotCurrentChanged(QListViewItem * i) +void KviKvsObject_listview::slotCurrentChanged(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"currentChangedEvent",0,¶ms); @@ -415,7 +415,7 @@ bool KviKvsObject_listview::function_returnPressedEvent(KviKvsObjectFunctionCall return true; } -void KviKvsObject_listview::slotReturnPressed(QListViewItem * i) +void KviKvsObject_listview::slotReturnPressed(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"returnPressedEvent",0,¶ms); @@ -427,7 +427,7 @@ bool KviKvsObject_listview::function_spacePressedEvent(KviKvsObjectFunctionCall return true; } -void KviKvsObject_listview::slotSpacePressed(QListViewItem * i) +void KviKvsObject_listview::slotSpacePressed(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"spacePressedEvent",0,¶ms); @@ -439,7 +439,7 @@ bool KviKvsObject_listview::function_onItemEvent(KviKvsObjectFunctionCall *c) return true; } -void KviKvsObject_listview::slotOnItem(QListViewItem * i) +void KviKvsObject_listview::slotOnItem(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"onItemEvent",0,¶ms); @@ -452,7 +452,7 @@ bool KviKvsObject_listview::function_itemExpandedEvent(KviKvsObjectFunctionCall return true; } -void KviKvsObject_listview::slotItemExpanded(QListViewItem * i) +void KviKvsObject_listview::slotItemExpanded(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"itemExpandedEvent",0,¶ms); @@ -464,7 +464,7 @@ bool KviKvsObject_listview::function_itemCollapsedEvent(KviKvsObjectFunctionCall return true; } -void KviKvsObject_listview::slotItemCollapsed(QListViewItem * i) +void KviKvsObject_listview::slotItemCollapsed(KviTalListViewItem * i) { KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i))); callFunction(this,"itemCollapsedEvent",0,¶ms); @@ -476,7 +476,7 @@ bool KviKvsObject_listview::function_rightButtonClickedEvent(KviKvsObjectFunctio return true; } -void KviKvsObject_listview::slotRightButtonClicked(QListViewItem * i,const QPoint &coor, int col) +void KviKvsObject_listview::slotRightButtonClicked(KviTalListViewItem * i,const QPoint &coor, int col) { KviKvsVariant *xpos=new KviKvsVariant((kvs_int_t)coor.x()); KviKvsVariant *ypos=new KviKvsVariant((kvs_int_t)coor.y()); @@ -491,14 +491,14 @@ bool KviKvsObject_listview::function_itemRenamedEvent(KviKvsObjectFunctionCall * return true; } -void KviKvsObject_listview::slotItemRenamed(QListViewItem *item,int col,const QString & szText) +void KviKvsObject_listview::slotItemRenamed(KviTalListViewItem *item,int col,const QString & szText) { KviKvsVariant *column=new KviKvsVariant((kvs_int_t)col); KviKvsVariant *txt=new KviKvsVariant(szText); KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(item)),column,txt); callFunction(this,"itemRenamedEvent",0,¶ms); } -void KviKvsObject_listview::fileDropped(QString &szFile,QListViewItem *item) +void KviKvsObject_listview::fileDropped(QString &szFile,KviTalListViewItem *item) { KviKvsVariant *file=new KviKvsVariant(szFile); KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(item)),file); @@ -506,7 +506,7 @@ void KviKvsObject_listview::fileDropped(QString &szFile,QListViewItem *item) } KviKvsMdmListView::KviKvsMdmListView(QWidget * par,const char * name,KviKvsObject_listview *parent) -:QListView( par,name) +:KviTalListView(par) { m_pParentScript=parent; setAcceptDrops(true); @@ -543,7 +543,7 @@ void KviKvsMdmListView::contentsDropEvent(QDropEvent *e) #ifndef COMPILE_ON_WINDOWS if(tmp[0] != '/')tmp.prepend("/"); //HACK HACK HACK for Qt bug (?!?) #endif - QListViewItem *i = itemAt( contentsToViewport(e->pos()) ); + KviTalListViewItem *i = itemAt( contentsToViewport(e->pos()) ); m_pParentScript->fileDropped(tmp,i); } } diff --git a/src/modules/objects/class_listview.h b/src/modules/objects/class_listview.h index dff661984..bd5f749cf 100644 --- a/src/modules/objects/class_listview.h +++ b/src/modules/objects/class_listview.h @@ -26,7 +26,7 @@ // //================================================================================= -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qdragobject.h> #include "class_widget.h" #include "class_listviewitem.h" @@ -41,7 +41,7 @@ public: public: QWidget * widget() { return (QWidget *)object(); }; - void fileDropped(QString &,QListViewItem *); + void fileDropped(QString &,KviTalListViewItem *); protected: virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); @@ -73,20 +73,20 @@ protected: bool function_setAcceptDrops(KviKvsObjectFunctionCall *c); protected slots: - void slotClicked(QListViewItem *); - void slotSelectionChanged(QListViewItem *); + void slotClicked(KviTalListViewItem *); + void slotSelectionChanged(KviTalListViewItem *); void slotMultipleSelectionChanged(); - void slotCurrentChanged(QListViewItem *); - void slotReturnPressed(QListViewItem *); - void slotSpacePressed(QListViewItem *); - void slotOnItem(QListViewItem *); - void slotItemExpanded(QListViewItem *); - void slotItemCollapsed(QListViewItem *); - void slotItemRenamed(QListViewItem *,int,const QString &); - void slotRightButtonClicked(QListViewItem * i,const QPoint &coor, int col); + void slotCurrentChanged(KviTalListViewItem *); + void slotReturnPressed(KviTalListViewItem *); + void slotSpacePressed(KviTalListViewItem *); + void slotOnItem(KviTalListViewItem *); + void slotItemExpanded(KviTalListViewItem *); + void slotItemCollapsed(KviTalListViewItem *); + void slotItemRenamed(KviTalListViewItem *,int,const QString &); + void slotRightButtonClicked(KviTalListViewItem * i,const QPoint &coor, int col); }; -class KviKvsMdmListView : public QListView +class KviKvsMdmListView : public KviTalListView { Q_OBJECT public: diff --git a/src/modules/objects/class_listviewitem.cpp b/src/modules/objects/class_listviewitem.cpp index 98a17f3e3..f50ab4910 100644 --- a/src/modules/objects/class_listviewitem.cpp +++ b/src/modules/objects/class_listviewitem.cpp @@ -147,7 +147,7 @@ bool KviKvsObject_listviewitem::init(KviKvsRunTimeContext * pContext,KviKvsVaria m_pListViewItem = new KviKvsMdmStandardListViewItem(this,((KviKvsObject_listviewitem *)parentObject())->m_pListViewItem); } else { if(parentObject()->inherits("KviKvsObject_listview")) - m_pListViewItem = new KviKvsMdmStandardListViewItem(this,((QListView *)parentScriptWidget())); + m_pListViewItem = new KviKvsMdmStandardListViewItem(this,((KviTalListView *)parentScriptWidget())); else { pContext->error(__tr2qs("The parent of the listviewitem must be either another listviewitem or a listview")); return false; @@ -163,13 +163,13 @@ void KviKvsObject_listviewitem::childDestroyed() die(); } -KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListView * par) -:QListViewItem(par), m_pMasterObject(ob) +KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par) +:KviTalListViewItem(par), m_pMasterObject(ob) { } -KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par) -:QListViewItem(par), m_pMasterObject(ob) +KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par) +:KviTalListViewItem(par), m_pMasterObject(ob) { } @@ -180,13 +180,13 @@ KviKvsMdmStandardListViewItem::~KviKvsMdmStandardListViewItem() -KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListView * par) -:QCheckListItem(par,QString::null,QCheckListItem::CheckBox), m_pMasterObject(ob) +KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par) +:KviTalCheckListItem(par,QString::null,KviTalCheckListItem::CheckBox), m_pMasterObject(ob) { } -KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par) -:QCheckListItem(par,QString::null,QCheckListItem::CheckBox), m_pMasterObject(ob) +KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par) +:KviTalCheckListItem(par,QString::null,KviTalCheckListItem::CheckBox), m_pMasterObject(ob) { } @@ -196,7 +196,7 @@ KviKvsMdmCheckListViewItem::~KviKvsMdmCheckListViewItem() } -kvs_hobject_t KviKvsObject_listviewitem::itemToHandle(QListViewItem * it) +kvs_hobject_t KviKvsObject_listviewitem::itemToHandle(KviTalListViewItem * it) { if(!it)return (kvs_hobject_t)0; KviKvsObject_listviewitem * pObject; @@ -335,10 +335,10 @@ bool KviKvsObject_listviewitem::function_setCheckable(KviKvsObjectFunctionCall * if(bCheckable) { if(m_pListViewItem->rtti() == 1)return true; // a QCheckListItem already - QListViewItem * pParent = m_pListViewItem->parent(); - QListView * pLV = m_pListViewItem->listView(); + KviTalListViewItem * pParent = m_pListViewItem->parent(); + KviTalListView * pLV = (KviTalListView *)m_pListViewItem->listView(); // swap the items, so we don't die now - QListViewItem * pThis = m_pListViewItem; + KviTalListViewItem * pThis = m_pListViewItem; m_pListViewItem = 0; delete pThis; if(pParent) @@ -347,10 +347,10 @@ bool KviKvsObject_listviewitem::function_setCheckable(KviKvsObjectFunctionCall * m_pListViewItem = new KviKvsMdmCheckListViewItem(this,pLV); } else { if(m_pListViewItem->rtti() != 1)return true; // not a QCheckListItem yet - QListViewItem * pParent = m_pListViewItem->parent(); - QListView * pLV = m_pListViewItem->listView(); + KviTalListViewItem * pParent = m_pListViewItem->parent(); + KviTalListView * pLV = (KviTalListView *)m_pListViewItem->listView(); // swap the items, so we don't die now - QListViewItem * pThis = m_pListViewItem; + KviTalListViewItem * pThis = m_pListViewItem; m_pListViewItem = 0; delete pThis; if(pParent) diff --git a/src/modules/objects/class_listviewitem.h b/src/modules/objects/class_listviewitem.h index 8d994a940..b7f0db217 100644 --- a/src/modules/objects/class_listviewitem.h +++ b/src/modules/objects/class_listviewitem.h @@ -22,7 +22,7 @@ // along with this program. If not, write to the Free Software Foundation, // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include <qlistview.h> +#include "kvi_tal_listview.h" #include "class_widget.h" @@ -36,7 +36,7 @@ public: KVSO_DECLARE_OBJECT(KviKvsObject_listviewitem) void childDestroyed(); protected: - QListViewItem * m_pListViewItem; + KviTalListViewItem * m_pListViewItem; protected: virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); protected: @@ -56,16 +56,16 @@ protected: bool function_firstChild(KviKvsObjectFunctionCall *c); bool function_nextSibling(KviKvsObjectFunctionCall *c); public: - static kvs_hobject_t itemToHandle(QListViewItem * it); + static kvs_hobject_t itemToHandle(KviTalListViewItem * it); }; -class KviKvsMdmStandardListViewItem : public QListViewItem +class KviKvsMdmStandardListViewItem : public KviTalListViewItem { public: - KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListView * par); - KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par); + KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par); + KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par); virtual ~KviKvsMdmStandardListViewItem(); protected: KviKvsObject_listviewitem * m_pMasterObject; @@ -73,11 +73,11 @@ public: KviKvsObject_listviewitem * masterObject(){ return m_pMasterObject; } }; -class KviKvsMdmCheckListViewItem : public QCheckListItem +class KviKvsMdmCheckListViewItem : public KviTalCheckListItem { public: - KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListView * par); - KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par); + KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par); + KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par); virtual ~KviKvsMdmCheckListViewItem(); protected: KviKvsObject_listviewitem * m_pMasterObject; diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index 4606c2083..e083be5ee 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -24,7 +24,7 @@ #include <qwidgetlist.h>
#include <qobjectlist.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qimage.h>
#include "kvi_iconmanager.h"
#include "kvi_window.h"
diff --git a/src/modules/options/dialog.cpp b/src/modules/options/dialog.cpp index 79af2b671..7a938f665 100644 --- a/src/modules/options/dialog.cpp +++ b/src/modules/options/dialog.cpp @@ -75,8 +75,8 @@ KviGeneralOptionsFrontWidget::~KviGeneralOptionsFrontWidget() -KviOptionsListViewItem::KviOptionsListViewItem(QListView *parent,KviOptionsWidgetInstanceEntry * e) -:QListViewItem(parent,e->szName) +KviOptionsListViewItem::KviOptionsListViewItem(KviTalListView *parent,KviOptionsWidgetInstanceEntry * e) +:KviTalListViewItem(parent,e->szName) { m_pInstanceEntry = e; m_pOptionsWidget = 0; @@ -84,8 +84,8 @@ KviOptionsListViewItem::KviOptionsListViewItem(QListView *parent,KviOptionsWidge setPixmap(0,*(g_pIconManager->getSmallIcon(e->iIcon))); } -KviOptionsListViewItem::KviOptionsListViewItem(QListViewItem *parent,KviOptionsWidgetInstanceEntry * e) -:QListViewItem(parent,e->szName) +KviOptionsListViewItem::KviOptionsListViewItem(KviTalListViewItem *parent,KviOptionsWidgetInstanceEntry * e) +:KviTalListViewItem(parent,e->szName) { m_pInstanceEntry = e; m_pOptionsWidget = 0; @@ -105,9 +105,9 @@ void KviOptionsListViewItem::paintCell(QPainter * p,const QColorGroup & cg,int c tmp.setColor(QColorGroup::Base,Qt::red); tmp.setColor(QColorGroup::Background,Qt::red); tmp.setColor(QColorGroup::Text,Qt::yellow); - QListViewItem::paintCell(p,tmp,column,width,align); + KviTalListViewItem::paintCell(p,tmp,column,width,align); } else { - QListViewItem::paintCell(p,cg,column,width,align); + KviTalListViewItem::paintCell(p,cg,column,width,align); } } @@ -189,12 +189,12 @@ KviOptionsDialog::KviOptionsDialog(QWidget * par,const QString &szGroup) vbox->setMargin(0); // Controlling list view - m_pListView = new QListView(vbox); + m_pListView = new KviTalListView(vbox); m_pListView->addColumn(""); m_pListView->header()->hide(); m_pListView->setRootIsDecorated(true); m_pListView->setSorting(-1); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(listViewItemSelectionChanged(QListViewItem *))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(listViewItemSelectionChanged(KviTalListViewItem *))); KviTalHBox * hbox = new KviTalHBox(vbox); vbox->setSpacing(2); @@ -460,7 +460,7 @@ void KviOptionsDialog::searchClicked() search(szTxt); } -void KviOptionsDialog::fillListView(QListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly) +void KviOptionsDialog::fillListView(KviTalListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly) { if(!l)return; @@ -516,12 +516,12 @@ void KviOptionsDialog::fillListView(QListViewItem * p,KviPtrList<KviOptionsWidge } } -void KviOptionsDialog::listViewItemSelectionChanged(QListViewItem *it) +void KviOptionsDialog::listViewItemSelectionChanged(KviTalListViewItem *it) { if(it) { QString str = it->text(0); - QListViewItem * par = it->parent(); + KviTalListViewItem * par = it->parent(); while(par) { diff --git a/src/modules/options/dialog.h b/src/modules/options/dialog.h index 2263f829e..52867fbe2 100644 --- a/src/modules/options/dialog.h +++ b/src/modules/options/dialog.h @@ -27,7 +27,7 @@ #include <qdialog.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qstringlist.h> #include "kvi_optionswidget.h" @@ -47,11 +47,11 @@ public: ~KviGeneralOptionsFrontWidget(); }; -class KviOptionsListViewItem : public QListViewItem +class KviOptionsListViewItem : public KviTalListViewItem { public: - KviOptionsListViewItem(QListView *parent,KviOptionsWidgetInstanceEntry * e); - KviOptionsListViewItem(QListViewItem *parent,KviOptionsWidgetInstanceEntry * e); + KviOptionsListViewItem(KviTalListView *parent,KviOptionsWidgetInstanceEntry * e); + KviOptionsListViewItem(KviTalListViewItem *parent,KviOptionsWidgetInstanceEntry * e); ~KviOptionsListViewItem(); public: KviOptionsWidgetInstanceEntry * m_pInstanceEntry; @@ -70,7 +70,7 @@ public: KviOptionsDialog(QWidget * par,const QString &szGroup); ~KviOptionsDialog(); private: - QListView * m_pListView; + KviTalListView * m_pListView; QLabel * m_pCategoryLabel; KviTalWidgetStack * m_pWidgetStack; KviGeneralOptionsFrontWidget* m_pFrontWidget; @@ -79,11 +79,11 @@ private: QToolButton * m_pSearchButton; private: void recursiveCommit(KviOptionsListViewItem *it); - void fillListView(QListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly = false); - //KviOptionsListViewItem * showHiddenChildren(QListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l); + void fillListView(KviTalListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly = false); + //KviOptionsListViewItem * showHiddenChildren(KviTalListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l); KviOptionsListViewItem * findItemByPage(KviOptionsListViewItem *it,KviOptionsWidget * pPage); private slots: - void listViewItemSelectionChanged(QListViewItem *it); + void listViewItemSelectionChanged(KviTalListViewItem *it); void applyClicked(); void okClicked(); void cancelClicked(); diff --git a/src/modules/options/optw_ircoutput.h b/src/modules/options/optw_ircoutput.h index 567bacf73..41575950a 100644 --- a/src/modules/options/optw_ircoutput.h +++ b/src/modules/options/optw_ircoutput.h @@ -24,7 +24,7 @@ // #include "kvi_optionswidget.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" class QComboBox; diff --git a/src/modules/options/optw_mediatypes.cpp b/src/modules/options/optw_mediatypes.cpp index b876bbb90..b00bb9fd6 100644 --- a/src/modules/options/optw_mediatypes.cpp +++ b/src/modules/options/optw_mediatypes.cpp @@ -44,8 +44,8 @@ static void copyMediaType(KviMediaType * dst,const KviMediaType * src) dst->szIcon = src->szIcon; } -KviMediaTypeListViewItem::KviMediaTypeListViewItem(QListView * w,KviMediaType * t) -: QListViewItem(w) +KviMediaTypeListViewItem::KviMediaTypeListViewItem(KviTalListView * w,KviMediaType * t) +: KviTalListViewItem(w) { copyData(t); } @@ -67,7 +67,7 @@ KviMediaTypesOptionsWidget::KviMediaTypesOptionsWidget(QWidget * parent) { createLayout(11,3); - m_pListView = new QListView(this); + m_pListView = new KviTalListView(this); m_pListView->addColumn(__tr2qs_ctx("Pattern","options")); m_pListView->addColumn(__tr2qs_ctx("MIME Type","options")); m_pListView->addColumn(__tr2qs_ctx("Description","options")); @@ -75,7 +75,7 @@ KviMediaTypesOptionsWidget::KviMediaTypesOptionsWidget(QWidget * parent) - connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentItemChanged(QListViewItem *))); + connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *))); layout()->addMultiCellWidget(m_pListView,0,0,0,2); @@ -212,7 +212,7 @@ void KviMediaTypesOptionsWidget::setLineEdits() m_pIcon->setText(m_pLastItem ? m_pLastItem->data()->szIcon.ptr() : ""); } -void KviMediaTypesOptionsWidget::currentItemChanged(QListViewItem *it) +void KviMediaTypesOptionsWidget::currentItemChanged(KviTalListViewItem *it) { saveLastItem(); m_pLastItem = (KviMediaTypeListViewItem *)it; diff --git a/src/modules/options/optw_mediatypes.h b/src/modules/options/optw_mediatypes.h index 30b3aed87..35fd41b9c 100644 --- a/src/modules/options/optw_mediatypes.h +++ b/src/modules/options/optw_mediatypes.h @@ -24,16 +24,16 @@ // #include "kvi_optionswidget.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qlineedit.h> #include <qpushbutton.h> #include "kvi_mediatype.h" -class KviMediaTypeListViewItem : public QListViewItem +class KviMediaTypeListViewItem : public KviTalListViewItem { public: - KviMediaTypeListViewItem(QListView * w,KviMediaType * t); + KviMediaTypeListViewItem(KviTalListView * w,KviMediaType * t); ~KviMediaTypeListViewItem(); private: KviMediaType m_data; @@ -56,7 +56,7 @@ public: KviMediaTypesOptionsWidget(QWidget * parent); ~KviMediaTypesOptionsWidget(); private: - QListView * m_pListView; + KviTalListView * m_pListView; QLineEdit * m_pDescription; QLineEdit * m_pIanaType; QLineEdit * m_pFileMask; @@ -73,7 +73,7 @@ private: void enableOrDisable(); void setLineEdits(); private slots: - void currentItemChanged(QListViewItem *it); + void currentItemChanged(KviTalListViewItem *it); void newMediaType(); void delMediaType(); public: diff --git a/src/modules/options/optw_messages.cpp b/src/modules/options/optw_messages.cpp index 4c7fb0090..316aa18a1 100644 --- a/src/modules/options/optw_messages.cpp +++ b/src/modules/options/optw_messages.cpp @@ -192,7 +192,7 @@ KviStandardColorsOptionsWidget::~KviStandardColorsOptionsWidget() KviMessageListView::KviMessageListView(QWidget * par) -: QListView(par) +: KviTalListView(par) { setItemMargin(2); } @@ -228,7 +228,7 @@ void KviMessageListView::paintEmptyAreaInternal(QPainter * p,const QRect &viewpo void KviMessageListView::paintEmptyArea(QPainter * p,const QRect &rct) { paintEmptyAreaInternal(p,rct,rct); - QListView::paintEmptyArea(p,rct); + KviTalListView::paintEmptyArea(p,rct); } @@ -236,8 +236,8 @@ void KviMessageListView::paintEmptyArea(QPainter * p,const QRect &rct) -KviMessageListViewItem::KviMessageListViewItem(QListView * l,int optId) -: QListViewItem(l) +KviMessageListViewItem::KviMessageListViewItem(KviTalListView * l,int optId) +: KviTalListViewItem(l) { m_iOptId = optId; setText(0,"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"); @@ -297,8 +297,8 @@ void KviMessageListViewItem::paintCell(QPainter * p,const QColorGroup &,int,int } -KviMessageColorListBoxItem::KviMessageColorListBoxItem(QListBox * b,const QColor &clr,int idx) -: QListBoxText(b,QString::null) +KviMessageColorListBoxItem::KviMessageColorListBoxItem(KviTalListBox * b,const QColor &clr,int idx) +: KviTalListBoxText(b,QString::null) { m_clr = clr; m_iClrIdx = idx; @@ -313,13 +313,15 @@ void KviMessageColorListBoxItem::paint(QPainter * p) { QColor clr; + const KviTalListBox * lb = (const KviTalListBox *)listBox(); + if((m_iClrIdx >= 0) && (m_iClrIdx <= 15)) { - clr = listBox()->isEnabled() ? KVI_OPTION_MIRCCOLOR(m_iClrIdx) : Qt::gray; - p->fillRect(0,0,width(listBox()),height(listBox()),clr); + clr = lb->isEnabled() ? KVI_OPTION_MIRCCOLOR(m_iClrIdx) : Qt::gray; + p->fillRect(0,0,width(lb),height(lb),clr); } else { clr = listBox()->colorGroup().background(); - QListBoxText::paint(p); + KviTalListBoxText::paint(p); } #if QT_VERSION >= 300 if(isSelected()) @@ -327,13 +329,13 @@ void KviMessageColorListBoxItem::paint(QPainter * p) if(selected()) #endif { - p->drawWinFocusRect(0,0,width(listBox()),height(listBox()),clr); - p->drawWinFocusRect(1,1,width(listBox()) - 2,height(listBox()) - 2,clr); - p->drawWinFocusRect(2,2,width(listBox()) - 4,height(listBox()) - 4,clr); + p->drawWinFocusRect(0,0,width(lb),height(lb),clr); + p->drawWinFocusRect(1,1,width(lb) - 2,height(lb) - 2,clr); + p->drawWinFocusRect(2,2,width(lb) - 4,height(lb) - 4,clr); } } /* -int KviMessageColorListBoxItem::width(const QListBox * lb) const +int KviMessageColorListBoxItem::width(const KviTalListBox * lb) const { int w = lb->width(); if(w < 30)w = 30; @@ -341,7 +343,7 @@ int KviMessageColorListBoxItem::width(const QListBox * lb) const return w; } -int KviMessageColorListBoxItem::height(const QListBox *) const +int KviMessageColorListBoxItem::height(const KviTalListBox *) const { return 30; } @@ -374,7 +376,7 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent) m_pListView = new KviMessageListView(this); m_pListView->addColumn(__tr2qs_ctx("Message Type","options")); m_pListView->setAllColumnsShowFocus(true); - m_pListView->setSelectionMode(QListView::Single); + m_pListView->setSelectionMode(KviTalListView::Single); m_pListView->setFont(KVI_OPTION_FONT(KviOption_fontIrcView)); m_pListView->setStaticBackground(true); m_pListView->viewport()->setBackgroundMode(QWidget::NoBackground); @@ -386,7 +388,7 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent) QLabel * l = new QLabel(__tr2qs_ctx("Background:","options"),box); - m_pBackListBox = new QListBox(box); + m_pBackListBox = new KviTalListBox(box); m_pBackItems[16] = new KviMessageColorListBoxItem(m_pBackListBox,Qt::gray,KVI_TRANSPARENT); for(i=0;i<16;i++) { @@ -395,7 +397,7 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent) l = new QLabel(__tr2qs_ctx("Foreground:","options"),box); - m_pForeListBox = new QListBox(box); + m_pForeListBox = new KviTalListBox(box); for(i=0;i<16;i++) { m_pForeItems[i] = new KviMessageColorListBoxItem(m_pForeListBox,KVI_OPTION_MIRCCOLOR(i),i); @@ -403,13 +405,13 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent) l = new QLabel(__tr2qs_ctx("Alert level:","options"),box); - m_pLevelListBox = new QListBox(box); - QListBoxText * lbt; + m_pLevelListBox = new KviTalListBox(box); + KviTalListBoxText * lbt; for(i=0;i<6;i++) { QString tmpn; tmpn.setNum(i); - lbt = new QListBoxText(m_pLevelListBox,tmpn); + lbt = new KviTalListBoxText(m_pLevelListBox,tmpn); } m_pIconButton = new KviStyledToolButton(box); @@ -441,9 +443,9 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent) layout()->setRowStretch(0,1); layout()->setColStretch(0,1); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(itemChanged(QListViewItem *))); - connect(m_pForeListBox,SIGNAL(selectionChanged(QListBoxItem *)),this,SLOT(colorChanged(QListBoxItem *))); - connect(m_pBackListBox,SIGNAL(selectionChanged(QListBoxItem *)),this,SLOT(colorChanged(QListBoxItem *))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(itemChanged(KviTalListViewItem *))); + connect(m_pForeListBox,SIGNAL(selectionChanged(KviTalListBoxItem *)),this,SLOT(colorChanged(KviTalListBoxItem *))); + connect(m_pBackListBox,SIGNAL(selectionChanged(KviTalListBoxItem *)),this,SLOT(colorChanged(KviTalListBoxItem *))); itemChanged(0); } @@ -487,7 +489,7 @@ void KviMessageColorsOptionsWidget::saveLastItem() m_pListView->repaintItem(m_pLastItem); } -void KviMessageColorsOptionsWidget::itemChanged(QListViewItem * it) +void KviMessageColorsOptionsWidget::itemChanged(KviTalListViewItem * it) { //debug("Item changed","options"); if(m_pLastItem)saveLastItem(); @@ -524,7 +526,7 @@ void KviMessageColorsOptionsWidget::itemChanged(QListViewItem * it) } -void KviMessageColorsOptionsWidget::colorChanged(QListBoxItem *) +void KviMessageColorsOptionsWidget::colorChanged(KviTalListBoxItem *) { if(m_pLastItem)saveLastItem(); } diff --git a/src/modules/options/optw_messages.h b/src/modules/options/optw_messages.h index 4f6d59652..0219d74cd 100644 --- a/src/modules/options/optw_messages.h +++ b/src/modules/options/optw_messages.h @@ -27,8 +27,8 @@ #include "kvi_msgtype.h" -#include <qlistview.h> -#include <qlistbox.h> +#include "kvi_tal_listview.h" +#include "kvi_tal_listbox.h" #include <qcheckbox.h> #include <qtoolbutton.h> #include "kvi_tal_popupmenu.h" @@ -76,7 +76,7 @@ protected slots: #define KVI_OPTIONS_WIDGET_PARENT_KviMessageColorsOptionsWidget KviMessageOptionsWidget #define KVI_OPTIONS_WIDGET_PRIORITY_KviMessageColorsOptionsWidget 30 -class KviMessageListView : public QListView +class KviMessageListView : public KviTalListView { Q_OBJECT public: @@ -89,10 +89,10 @@ public: }; -class KviMessageListViewItem : public QListViewItem +class KviMessageListViewItem : public KviTalListViewItem { public: - KviMessageListViewItem(QListView * l,int optId); + KviMessageListViewItem(KviTalListView * l,int optId); ~KviMessageListViewItem(); private: int m_iOptId; @@ -104,17 +104,17 @@ public: }; -class KviMessageColorListBoxItem : public QListBoxText +class KviMessageColorListBoxItem : public KviTalListBoxText { public: - KviMessageColorListBoxItem(QListBox * b,const QColor & clr,int idx); + KviMessageColorListBoxItem(KviTalListBox * b,const QColor & clr,int idx); ~KviMessageColorListBoxItem(); public: int m_iClrIdx; QColor m_clr; public: virtual void paint(QPainter * p); - virtual int width(const QListBox * lv) const { return 120; }; + virtual int width(const KviTalListBox * lv) const { return 120; }; }; @@ -128,9 +128,9 @@ public: ~KviMessageColorsOptionsWidget(); public: KviMessageListView * m_pListView; - QListBox * m_pForeListBox; - QListBox * m_pBackListBox; - QListBox * m_pLevelListBox; + KviTalListBox * m_pForeListBox; + KviTalListBox * m_pBackListBox; + KviTalListBox * m_pLevelListBox; KviMessageColorListBoxItem * m_pForeItems[16]; KviMessageColorListBoxItem * m_pBackItems[17]; KviMessageListViewItem * m_pLastItem; @@ -140,8 +140,8 @@ public: public: void saveLastItem(); protected slots: - void itemChanged(QListViewItem * it); - void colorChanged(QListBoxItem *); + void itemChanged(KviTalListViewItem * it); + void colorChanged(KviTalListBoxItem *); void iconButtonClicked(); void newIconSelected(int iconId); virtual void commit(); diff --git a/src/modules/options/optw_nickserv.cpp b/src/modules/options/optw_nickserv.cpp index c7e6ce7a9..41f2a6d38 100644 --- a/src/modules/options/optw_nickserv.cpp +++ b/src/modules/options/optw_nickserv.cpp @@ -26,7 +26,7 @@ #include <qlayout.h> #include <qtooltip.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qlineedit.h> #include <qpushbutton.h> #include <qcheckbox.h> @@ -249,8 +249,8 @@ KviNickServOptionsWidget::KviNickServOptionsWidget(QWidget * parent) #endif m_pNickServCheck->setChecked(bNickServEnabled); - m_pNickServListView = new QListView(this); - m_pNickServListView->setSelectionMode(QListView::Single); + m_pNickServListView = new KviTalListView(this); + m_pNickServListView->setSelectionMode(KviTalListView::Single); m_pNickServListView->setAllColumnsShowFocus(true); m_pNickServListView->addColumn(__tr2qs_ctx("Nickname","options")); m_pNickServListView->addColumn(__tr2qs_ctx("Server mask","options")); @@ -292,7 +292,7 @@ KviNickServOptionsWidget::KviNickServOptionsWidget(QWidget * parent) KviPtrList<KviNickServRule> * ll = rs->rules(); for(KviNickServRule * rule = ll->first();rule;rule = ll->next()) { - (void)new QListViewItem(m_pNickServListView,rule->registeredNick(),rule->serverMask(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand()); + (void)new KviTalListViewItem(m_pNickServListView,rule->registeredNick(),rule->serverMask(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand()); } } @@ -309,7 +309,7 @@ KviNickServOptionsWidget::~KviNickServOptionsWidget() void KviNickServOptionsWidget::editNickServRule() { - QListViewItem * it = m_pNickServListView->currentItem(); + KviTalListViewItem * it = m_pNickServListView->currentItem(); if(!it)return; KviNickServRule r(it->text(0),it->text(2),it->text(3),it->text(4),it->text(1)); KviNickServRuleEditor ed(this,true); @@ -328,12 +328,12 @@ void KviNickServOptionsWidget::addNickServRule() KviNickServRule r; KviNickServRuleEditor ed(this,true); if(ed.editRule(&r)) - (void)new QListViewItem(m_pNickServListView,r.registeredNick(),r.serverMask(),r.nickServMask(),r.messageRegexp(),r.identifyCommand()); + (void)new KviTalListViewItem(m_pNickServListView,r.registeredNick(),r.serverMask(),r.nickServMask(),r.messageRegexp(),r.identifyCommand()); } void KviNickServOptionsWidget::delNickServRule() { - QListViewItem * it = m_pNickServListView->currentItem(); + KviTalListViewItem * it = m_pNickServListView->currentItem(); if(!it)return; delete it; enableDisableNickServControls(); @@ -355,7 +355,7 @@ void KviNickServOptionsWidget::commit() if(m_pNickServListView->childCount() > 0) { g_pNickServRuleSet->setEnabled(m_pNickServCheck->isChecked()); - QListViewItem * it = m_pNickServListView->firstChild(); + KviTalListViewItem * it = m_pNickServListView->firstChild(); while(it) { g_pNickServRuleSet->addRule(KviNickServRule::createInstance(it->text(0),it->text(2),it->text(3),it->text(4),it->text(1))); diff --git a/src/modules/options/optw_nickserv.h b/src/modules/options/optw_nickserv.h index a0b1c4780..346955c4c 100644 --- a/src/modules/options/optw_nickserv.h +++ b/src/modules/options/optw_nickserv.h @@ -41,7 +41,7 @@ class QLineEdit; class QPushButton; class KviNickServRule; -class QListView; +class KviTalListView; class QCheckBox; class KviNickServRuleEditor : public QDialog @@ -72,7 +72,7 @@ public: KviNickServOptionsWidget(QWidget * parent); ~KviNickServOptionsWidget(); protected: - QListView * m_pNickServListView; + KviTalListView * m_pNickServListView; QCheckBox * m_pNickServCheck; QPushButton * m_pAddRuleButton; QPushButton * m_pDelRuleButton; diff --git a/src/modules/options/optw_proxy.cpp b/src/modules/options/optw_proxy.cpp index 9af3b7d6f..3aeb8dfc9 100644 --- a/src/modules/options/optw_proxy.cpp +++ b/src/modules/options/optw_proxy.cpp @@ -41,8 +41,8 @@ #include <qtoolbutton.h> -KviProxyOptionsListViewItem::KviProxyOptionsListViewItem(QListView *parent,const QPixmap &pm,KviProxy * prx) -: QListViewItem(parent,prx->m_szHostname.ptr()) +KviProxyOptionsListViewItem::KviProxyOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,KviProxy * prx) +: KviTalListViewItem(parent,prx->m_szHostname.ptr()) { setPixmap(0,pm); m_pProxyData = new KviProxy(*prx); @@ -60,17 +60,17 @@ KviProxyOptionsWidget::KviProxyOptionsWidget(QWidget * parent) addBoolSelector(0,0,1,0,__tr2qs_ctx("Use proxy","options"),KviOption_boolUseProxyHost); - m_pListView = new QListView(this); + m_pListView = new KviTalListView(this); addWidgetToLayout(m_pListView,0,1,0,1); m_pListView->addColumn(__tr2qs_ctx("Proxy","options")); m_pListView->setRootIsDecorated(true); m_pListView->setAllColumnsShowFocus(true); - m_pListView->setSelectionMode(QListView::Single); + m_pListView->setSelectionMode(KviTalListView::Single); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)), - this,SLOT(listViewItemSelectionChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(listViewRightButtonPressed(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)), + this,SLOT(listViewItemSelectionChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(listViewRightButtonPressed(KviTalListViewItem *,const QPoint &,int))); #ifdef COMPILE_INFO_TIPS QString tiptxt = __tr2qs_ctx("<center>This is the list of available proxy servers.<br>" \ @@ -183,7 +183,7 @@ void KviProxyOptionsWidget::fillProxyList() if(!(g_pProxyDataBase->currentProxy()))listViewItemSelectionChanged(0); } -void KviProxyOptionsWidget::listViewItemSelectionChanged(QListViewItem *it) +void KviProxyOptionsWidget::listViewItemSelectionChanged(KviTalListViewItem *it) { if(m_pLastEditedItem)saveLastItem(); m_pLastEditedItem = (KviProxyOptionsListViewItem *)it; @@ -330,7 +330,7 @@ void KviProxyOptionsWidget::commit() KviOptionsWidget::commit(); } -void KviProxyOptionsWidget::listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviProxyOptionsWidget::listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { m_pContextPopup->clear(); m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_PROXY)),__tr2qs_ctx("&New Proxy","options"),this,SLOT(newProxy())); @@ -353,7 +353,7 @@ void KviProxyOptionsWidget::removeCurrent() { delete m_pLastEditedItem; m_pLastEditedItem = 0; - QListViewItem * it = m_pListView->firstChild(); + KviTalListViewItem * it = m_pListView->firstChild(); if(it) { m_pListView->setSelected(it,true); diff --git a/src/modules/options/optw_proxy.h b/src/modules/options/optw_proxy.h index fe188869b..e39c31b2f 100644 --- a/src/modules/options/optw_proxy.h +++ b/src/modules/options/optw_proxy.h @@ -24,7 +24,7 @@ // #include "kvi_optionswidget.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" class KviProxy; @@ -32,10 +32,10 @@ class KviProxyDataBase; extern KVIRC_API KviProxyDataBase * g_pProxyDataBase; -class KviProxyOptionsListViewItem : public QListViewItem +class KviProxyOptionsListViewItem : public KviTalListViewItem { public: - KviProxyOptionsListViewItem(QListView *parent,const QPixmap &pm,KviProxy * prx); + KviProxyOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,KviProxy * prx); ~KviProxyOptionsListViewItem(); public: KviProxy * m_pProxyData; @@ -61,7 +61,7 @@ public: KviProxyOptionsWidget(QWidget * parent); ~KviProxyOptionsWidget(); protected: - QListView * m_pListView; + KviTalListView * m_pListView; QLabel * m_pProxyLabel; QLineEdit * m_pProxyEdit; QLabel * m_pIpLabel; @@ -82,8 +82,8 @@ private: void fillProxyList(); void saveLastItem(); protected slots: - void listViewItemSelectionChanged(QListViewItem *it); - void listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col); + void listViewItemSelectionChanged(KviTalListViewItem *it); + void listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col); void newProxy(); void removeCurrent(); void ipV6CheckToggled(bool bEnabled); diff --git a/src/modules/options/optw_servers.cpp b/src/modules/options/optw_servers.cpp index 11ca4ac6e..c2ffae5e8 100644 --- a/src/modules/options/optw_servers.cpp +++ b/src/modules/options/optw_servers.cpp @@ -270,8 +270,8 @@ KviNetworkDetailsWidget::KviNetworkDetailsWidget(QWidget * par,KviIrcNetwork * n #endif m_pNickServCheck->setChecked(bNickServEnabled); - m_pNickServListView = new QListView(tab); - m_pNickServListView->setSelectionMode(QListView::Single); + m_pNickServListView = new KviTalListView(tab); + m_pNickServListView->setSelectionMode(KviTalListView::Single); m_pNickServListView->setAllColumnsShowFocus(true); m_pNickServListView->addColumn(__tr2qs_ctx("Nickname","options")); m_pNickServListView->addColumn(__tr2qs_ctx("NickServ Mask","options")); @@ -310,7 +310,7 @@ KviNetworkDetailsWidget::KviNetworkDetailsWidget(QWidget * par,KviIrcNetwork * n KviPtrList<KviNickServRule> * ll = rs->rules(); for(KviNickServRule * rule = ll->first();rule;rule = ll->next()) { - (void)new QListViewItem(m_pNickServListView,rule->registeredNick(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand()); + (void)new KviTalListViewItem(m_pNickServListView,rule->registeredNick(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand()); } } @@ -348,7 +348,7 @@ KviNetworkDetailsWidget::~KviNetworkDetailsWidget() void KviNetworkDetailsWidget::editNickServRule() { - QListViewItem * it = m_pNickServListView->currentItem(); + KviTalListViewItem * it = m_pNickServListView->currentItem(); if(!it)return; KviNickServRule r(it->text(0),it->text(1),it->text(2),it->text(3)); KviNickServRuleEditor ed(this,false); @@ -366,12 +366,12 @@ void KviNetworkDetailsWidget::addNickServRule() KviNickServRule r; KviNickServRuleEditor ed(this,false); if(ed.editRule(&r)) - (void)new QListViewItem(m_pNickServListView,r.registeredNick(),r.nickServMask(),r.messageRegexp(),r.identifyCommand()); + (void)new KviTalListViewItem(m_pNickServListView,r.registeredNick(),r.nickServMask(),r.messageRegexp(),r.identifyCommand()); } void KviNetworkDetailsWidget::delNickServRule() { - QListViewItem * it = m_pNickServListView->currentItem(); + KviTalListViewItem * it = m_pNickServListView->currentItem(); if(!it)return; delete it; enableDisableNickServControls(); @@ -411,7 +411,7 @@ void KviNetworkDetailsWidget::fillData(KviIrcNetwork * n) { KviNickServRuleSet * rs = KviNickServRuleSet::createInstance(); rs->setEnabled(m_pNickServCheck->isChecked()); - QListViewItem * it = m_pNickServListView->firstChild(); + KviTalListViewItem * it = m_pNickServListView->firstChild(); while(it) { rs->addRule(KviNickServRule::createInstance(it->text(0),it->text(1),it->text(2),it->text(3))); @@ -973,8 +973,8 @@ void KviServerDetailsWidget::useDefaultInitUModeToggled(bool b) // kvi_app.cpp extern KVIRC_API KviIrcServerDataBase * g_pIrcServerDataBase; -KviServerOptionsListViewItem::KviServerOptionsListViewItem(QListView *parent,const QPixmap &pm,const KviIrcNetwork *n) - : QListViewItem(parent) +KviServerOptionsListViewItem::KviServerOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,const KviIrcNetwork *n) + : KviTalListViewItem(parent) { setPixmap(0,pm); m_pServerData = 0; @@ -983,8 +983,8 @@ KviServerOptionsListViewItem::KviServerOptionsListViewItem(QListView *parent,con setText(1,n->description()); } -KviServerOptionsListViewItem::KviServerOptionsListViewItem(QListViewItem *parent,const QPixmap &pm,const KviIrcServer *s) - : QListViewItem(parent) +KviServerOptionsListViewItem::KviServerOptionsListViewItem(KviTalListViewItem *parent,const QPixmap &pm,const KviIrcServer *s) + : KviTalListViewItem(parent) { setPixmap(0,pm); m_pServerData = new KviIrcServer(*s); @@ -1036,18 +1036,18 @@ KviServerOptionsWidget::KviServerOptionsWidget(QWidget * parent) m_pNetworkDetailsDialog = 0; m_pImportFilter = 0; - m_pListView = new QListView(this); + m_pListView = new KviTalListView(this); addWidgetToLayout(m_pListView,0,0,0,0); m_pListView->addColumn(__tr2qs_ctx("Server","options")); m_pListView->addColumn(__tr2qs_ctx("Description","options")); m_pListView->setRootIsDecorated(true); m_pListView->setAllColumnsShowFocus(true); - m_pListView->setSelectionMode(QListView::Single); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)), - this,SLOT(listViewItemSelectionChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(listViewRightButtonPressed(QListViewItem *,const QPoint &,int))); - connect(m_pListView,SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int )), + m_pListView->setSelectionMode(KviTalListView::Single); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)), + this,SLOT(listViewItemSelectionChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(listViewRightButtonPressed(KviTalListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem*, const QPoint&, int )), this,SLOT(detailsClicked())); #ifdef COMPILE_INFO_TIPS @@ -1232,12 +1232,12 @@ void KviServerOptionsWidget::recentServersPopupClicked(int id) kvi_u32_t uPort = port.toUInt(&bOk); // we have the port too - QListViewItem * pFoundNet = 0; - QListViewItem * pFoundSrv = 0; + KviTalListViewItem * pFoundNet = 0; + KviTalListViewItem * pFoundSrv = 0; - for(QListViewItem * net = m_pListView->firstChild();net;net = net->nextSibling()) + for(KviTalListViewItem * net = m_pListView->firstChild();net;net = net->nextSibling()) { - for(QListViewItem * srv = net->firstChild();srv;srv = srv->nextSibling()) + for(KviTalListViewItem * srv = net->firstChild();srv;srv = srv->nextSibling()) { KviStr tmp = ((KviServerOptionsListViewItem *)srv)->m_pServerData->hostName(); if(kvi_strEqualCI(tmp.ptr(),data.ptr())) @@ -1311,7 +1311,7 @@ void KviServerOptionsWidget::fillServerList() if(cur)m_pListView->ensureItemVisible(cur); } -void KviServerOptionsWidget::listViewItemSelectionChanged(QListViewItem *it) +void KviServerOptionsWidget::listViewItemSelectionChanged(KviTalListViewItem *it) { saveLastItem(); m_pLastEditedItem = (KviServerOptionsListViewItem *)it; @@ -1421,7 +1421,7 @@ void KviServerOptionsWidget::commit() KviOptionsWidget::commit(); } -void KviServerOptionsWidget::listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviServerOptionsWidget::listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { int id; bool bServer = (it && ((KviServerOptionsListViewItem *)it)->m_pServerData); @@ -1626,7 +1626,7 @@ void KviServerOptionsWidget::removeCurrent() { if(m_pLastEditedItem) { - QListViewItem * it = m_pLastEditedItem->itemAbove(); + KviTalListViewItem * it = m_pLastEditedItem->itemAbove(); if(!it)it = m_pLastEditedItem->firstChild() ? m_pLastEditedItem->nextSibling() : m_pLastEditedItem->itemBelow(); delete m_pLastEditedItem; m_pLastEditedItem = 0; diff --git a/src/modules/options/optw_servers.h b/src/modules/options/optw_servers.h index 17595b938..7fc996249 100644 --- a/src/modules/options/optw_servers.h +++ b/src/modules/options/optw_servers.h @@ -26,7 +26,7 @@ //============================================================================= #include "kvi_optionswidget.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qdialog.h> #include <qbuttongroup.h> #include <qtabwidget.h> @@ -38,11 +38,11 @@ class KviMexServerImport; -class KviServerOptionsListViewItem : public QListViewItem +class KviServerOptionsListViewItem : public KviTalListViewItem { public: - KviServerOptionsListViewItem(QListView *parent,const QPixmap &pm,const KviIrcNetwork *n); - KviServerOptionsListViewItem(QListViewItem *parent,const QPixmap &pm,const KviIrcServer *s); + KviServerOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,const KviIrcNetwork *n); + KviServerOptionsListViewItem(KviTalListViewItem *parent,const QPixmap &pm,const KviIrcServer *s); ~KviServerOptionsListViewItem(); public: KviIrcServer * m_pServerData; @@ -85,7 +85,7 @@ protected: QCheckBox * m_pAutoConnectCheck; - QListView * m_pNickServListView; + KviTalListView * m_pNickServListView; QCheckBox * m_pNickServCheck; QPushButton * m_pAddRuleButton; QPushButton * m_pDelRuleButton; @@ -158,7 +158,7 @@ public: KviServerOptionsWidget(QWidget * parent); ~KviServerOptionsWidget(); protected: - QListView * m_pListView; + KviTalListView * m_pListView; QLabel * m_pSrvNetLabel; QLineEdit * m_pSrvNetEdit; //QLabel * m_pPortLabel; @@ -190,8 +190,8 @@ protected slots: void importerDead(); void importServer(const KviIrcServer & s,const char * network); void importPopupAboutToShow(); - void listViewItemSelectionChanged(QListViewItem *it); - void listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col); + void listViewItemSelectionChanged(KviTalListViewItem *it); + void listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col); void newNetwork(); void removeCurrent(); void newServer(); diff --git a/src/modules/options/optw_transport.h b/src/modules/options/optw_transport.h index 9e5c20d5c..d0b17210b 100644 --- a/src/modules/options/optw_transport.h +++ b/src/modules/options/optw_transport.h @@ -24,6 +24,6 @@ // #include "kvi_optionswidget.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #endif //!_OPTW_TRANSPORT_H_ diff --git a/src/modules/popupeditor/popupeditor.cpp b/src/modules/popupeditor/popupeditor.cpp index 21d4fef81..06478ff3e 100644 --- a/src/modules/popupeditor/popupeditor.cpp +++ b/src/modules/popupeditor/popupeditor.cpp @@ -55,15 +55,15 @@ extern KviPopupEditorWindow * g_pPopupEditorWindow; //KviPopupEntryItem -KviPopupListViewItem::KviPopupListViewItem(QListView * pListView,KviPopupListViewItem * after,Type t) -: QListViewItem(pListView,after) +KviPopupListViewItem::KviPopupListViewItem(KviTalListView * pListView,KviPopupListViewItem * after,Type t) +: KviTalListViewItem(pListView,after) { m_type = t; init(); } KviPopupListViewItem::KviPopupListViewItem(KviPopupListViewItem * parent,KviPopupListViewItem * after,Type t) -: QListViewItem(parent,after) +: KviTalListViewItem(parent,after) { m_type = t; init(); @@ -205,7 +205,7 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par) QSplitter * spl = new QSplitter(QSplitter::Vertical,this); - m_pListView = new QListView(spl); + m_pListView = new KviTalListView(spl); m_pListView->addColumn(__tr2qs("Item")); m_pListView->addColumn(__tr2qs("Type")); m_pListView->setMultiSelection(false); @@ -215,9 +215,9 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par) m_pListView->setSorting(-1); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(selectionChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); m_pEditor = KviScriptEditor::createInstance(spl); @@ -366,7 +366,7 @@ void KviSinglePopupEditor::testModeMenuItemClicked(KviKvsPopupMenuItem * it) } -void KviSinglePopupEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviSinglePopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { m_pContextPopup->clear(); @@ -799,7 +799,7 @@ KviKvsPopupMenu * KviSinglePopupEditor::getMenu() return p; } -void KviSinglePopupEditor::selectionChanged(QListViewItem * it) +void KviSinglePopupEditor::selectionChanged(KviTalListViewItem * it) { saveLastSelectedItem(); @@ -1000,8 +1000,8 @@ void KviSinglePopupEditor::edit(KviMenuListViewItem * it) -KviMenuListViewItem::KviMenuListViewItem(QListView * par,KviKvsPopupMenu * popup) -: QListViewItem(par) +KviMenuListViewItem::KviMenuListViewItem(KviTalListView * par,KviKvsPopupMenu * popup) +: KviTalListViewItem(par) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_POPUP))); setText(0,popup->name()); @@ -1030,9 +1030,9 @@ KviPopupEditor::KviPopupEditor(QWidget * par) KviTalVBox * box = new KviTalVBox(spl); - m_pListView = new QListView(box); + m_pListView = new KviTalListView(box); m_pListView->addColumn(__tr2qs("Popup")); - m_pListView->setSelectionMode(QListView::Extended); + m_pListView->setSelectionMode(KviTalListView::Extended); m_pListView->setShowSortIndicator(true); QPushButton * pb = new QPushButton(__tr2qs("&Export All To..."),box); @@ -1075,13 +1075,13 @@ void KviPopupEditor::oneTimeSetup() ++it; } - connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentItemChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); } -void KviPopupEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviPopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { __range_valid(m_bOneTimeSetupDone); m_pContextPopup->clear(); @@ -1154,7 +1154,7 @@ void KviPopupEditor::exportPopups(bool bSelectedOnly) QString out; int count=0; - QListViewItemIterator itv( m_pListView ); + KviTalListViewItemIterator itv( m_pListView ); while( itv.current() ) { if ( (itv.current()->isSelected()) || (bSelectedOnly == true) ) @@ -1221,7 +1221,7 @@ void KviPopupEditor::saveLastEditedItem() m_pLastEditedItem->setText(0,m->popupName()); } -void KviPopupEditor::currentItemChanged(QListViewItem *it) +void KviPopupEditor::currentItemChanged(KviTalListViewItem *it) { saveLastEditedItem(); diff --git a/src/modules/popupeditor/popupeditor.h b/src/modules/popupeditor/popupeditor.h index d2795b961..d2047eca2 100644 --- a/src/modules/popupeditor/popupeditor.h +++ b/src/modules/popupeditor/popupeditor.h @@ -27,7 +27,7 @@ #include <qwidget.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qlineedit.h> #include "kvi_tal_popupmenu.h" #include <qpushbutton.h> @@ -36,12 +36,12 @@ class KviKvsPopupMenu; class KviKvsPopupMenuItem; // KviPopupListViewItem -class KviPopupListViewItem : public QListViewItem +class KviPopupListViewItem : public KviTalListViewItem { public: enum Type { Item , Menu , Separator , Label , Epilogue , Prologue , ExtMenu }; public: - KviPopupListViewItem(QListView * pListView,KviPopupListViewItem * after,Type t); + KviPopupListViewItem(KviTalListView * pListView,KviPopupListViewItem * after,Type t); KviPopupListViewItem(KviPopupListViewItem * parent,KviPopupListViewItem * after,Type t); public: Type m_type; @@ -77,7 +77,7 @@ protected: KviKvsPopupMenu * m_pClipboard; KviKvsPopupMenu * m_pTestPopup; KviPopupListViewItem * m_pLastSelectedItem; - QListView * m_pListView; + KviTalListView * m_pListView; QLineEdit * m_pNameEditor; KviScriptEditor * m_pEditor; QLineEdit * m_pTextEditor; @@ -125,18 +125,18 @@ protected slots: void contextNewLabelInside(); void contextNewPrologue(); void contextNewEpilogue(); - void selectionChanged(QListViewItem * it); - void itemPressed(QListViewItem *it,const QPoint &pnt,int col); + void selectionChanged(KviTalListViewItem * it); + void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col); void testPopup(); void testModeMenuItemClicked(KviKvsPopupMenuItem * it); }; -class KviMenuListViewItem : public QListViewItem +class KviMenuListViewItem : public KviTalListViewItem { public: - KviMenuListViewItem(QListView * par,KviKvsPopupMenu * popup); + KviMenuListViewItem(KviTalListView * par,KviKvsPopupMenu * popup); ~KviMenuListViewItem(); public: KviKvsPopupMenu * m_pPopup; @@ -155,7 +155,7 @@ public: ~KviPopupEditor(); public: KviSinglePopupEditor * m_pEditor; - QListView * m_pListView; + KviTalListView * m_pListView; KviMenuListViewItem * m_pLastEditedItem; bool m_bOneTimeSetupDone; KviTalPopupMenu * m_pContextPopup; @@ -163,13 +163,13 @@ public: void commit(); void exportPopups(bool); protected slots: - void currentItemChanged(QListViewItem *it); + void currentItemChanged(KviTalListViewItem *it); void newPopup(); void exportAll(); void exportSelected(); void exportCurrentPopup(); void removeCurrentPopup(); - void itemPressed(QListViewItem *it,const QPoint &pnt,int col); + void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col); protected: void showEvent(QShowEvent *e); void getExportPopupBuffer(QString &buffer,KviMenuListViewItem * it); diff --git a/src/modules/raweditor/raweditor.cpp b/src/modules/raweditor/raweditor.cpp index 7a3189a4f..3b2d2fdcd 100644 --- a/src/modules/raweditor/raweditor.cpp +++ b/src/modules/raweditor/raweditor.cpp @@ -49,8 +49,8 @@ extern KviRawEditorWindow * g_pRawEditorWindow; -KviRawListViewItem::KviRawListViewItem(QListView *par,int idx) -: QListViewItem(par) +KviRawListViewItem::KviRawListViewItem(KviTalListView *par,int idx) +: KviTalListViewItem(par) { m_iIdx = idx; m_szName.setNum(idx); @@ -80,7 +80,7 @@ KviRawEditor::KviRawEditor(QWidget * par) l->addWidget(spl,0,0); KviTalVBox * boxi = new KviTalVBox(spl); - m_pListView = new QListView(boxi); + m_pListView = new KviTalListView(boxi); m_pListView->addColumn(__tr2qs("Raw Event")); m_pListView->setMultiSelection(false); m_pListView->setShowSortIndicator(true); @@ -132,12 +132,12 @@ void KviRawEditor::oneTimeSetup() m_pContextPopup = new KviTalPopupMenu(this); - connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(selectionChanged(QListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(QListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *))); + connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), + this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); } -void KviRawEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviRawEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { __range_valid(m_bOneTimeSetupDone); m_pContextPopup->clear(); @@ -239,14 +239,14 @@ void KviRawEditor::addHandlerForCurrentRaw() { __range_valid(m_pOneTimeSetupDone); - QListViewItem * it = m_pListView->selectedItem(); + KviTalListViewItem * it = m_pListView->selectedItem(); if(it) { if(it->parent() == 0) { QString buffer = __tr2qs("default"); getUniqueHandlerName((KviRawListViewItem *)it,buffer); - QListViewItem * ch = new KviRawHandlerListViewItem(it,buffer,"",true); + KviTalListViewItem * ch = new KviRawHandlerListViewItem(it,buffer,"",true); it->setOpen(true); m_pListView->setSelected(ch,true); } @@ -258,7 +258,7 @@ void KviRawEditor::removeCurrentHandler() __range_valid(m_pOneTimeSetupDone); if(m_pLastEditedItem) { - QListViewItem * it = m_pLastEditedItem; + KviTalListViewItem * it = m_pLastEditedItem; m_pLastEditedItem = 0; delete it; m_pEditor->setEnabled(false); @@ -283,12 +283,12 @@ void KviRawEditor::commit() saveLastEditedItem(); KviKvsEventManager::instance()->removeAllScriptRawHandlers(); - for(QListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling()) + for(KviTalListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling()) { if(it->firstChild()) { QString szContext; - for(QListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling()) + for(KviTalListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling()) { KviQString::sprintf(szContext,"RawEvent%d::%Q",&(((KviRawListViewItem *)it)->m_iIdx),&(((KviRawHandlerListViewItem *)ch)->m_szName)); @@ -325,7 +325,7 @@ void KviRawEditor::saveLastEditedItem() m_pLastEditedItem->m_szBuffer = tmp; } -void KviRawEditor::selectionChanged(QListViewItem * it) +void KviRawEditor::selectionChanged(KviTalListViewItem * it) { __range_valid(m_bOneTimeSetupDone); saveLastEditedItem(); diff --git a/src/modules/raweditor/raweditor.h b/src/modules/raweditor/raweditor.h index 8e5759ef1..a228ab17b 100644 --- a/src/modules/raweditor/raweditor.h +++ b/src/modules/raweditor/raweditor.h @@ -26,29 +26,29 @@ #include "kvi_qstring.h" #include <qwidget.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qlineedit.h> class KviScriptEditor; -class KviRawListViewItem : public QListViewItem +class KviRawListViewItem : public KviTalListViewItem { public: int m_iIdx; QString m_szName; public: - KviRawListViewItem(QListView * par,int idx); + KviRawListViewItem(KviTalListView * par,int idx); ~KviRawListViewItem() {}; public: virtual QString text(int col) const { return m_szName; }; virtual const QPixmap * pixmap(int col) const; }; -class KviRawHandlerListViewItem : public QListViewItem +class KviRawHandlerListViewItem : public KviTalListViewItem { public: - KviRawHandlerListViewItem(QListViewItem * par,const QString & name,const QString & buffer,bool bEnabled) - : QListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {}; + KviRawHandlerListViewItem(KviTalListViewItem * par,const QString & name,const QString & buffer,bool bEnabled) + : KviTalListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {}; ~KviRawHandlerListViewItem() {}; public: QString m_szName; @@ -68,7 +68,7 @@ public: ~KviRawEditor(); public: KviScriptEditor * m_pEditor; - QListView * m_pListView; + KviTalListView * m_pListView; QLineEdit * m_pNameEditor; KviTalPopupMenu * m_pContextPopup; KviRawHandlerListViewItem * m_pLastEditedItem; @@ -79,8 +79,8 @@ public: void getUniqueHandlerName(KviRawListViewItem *it,QString &buffer); void getExportEventBuffer(QString &szBuffer,KviRawHandlerListViewItem * it); protected slots: - void selectionChanged(QListViewItem *it); - void itemPressed(QListViewItem *it,const QPoint &pnt,int col); + void selectionChanged(KviTalListViewItem *it); + void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col); void toggleCurrentHandlerEnabled(); void removeCurrentHandler(); void addHandlerForCurrentRaw(); diff --git a/src/modules/reguser/edituser.cpp b/src/modules/reguser/edituser.cpp index 60e1cfeec..c923bdb36 100644 --- a/src/modules/reguser/edituser.cpp +++ b/src/modules/reguser/edituser.cpp @@ -343,8 +343,8 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste l = new QLabel(__tr2qs("Masks:"),p1); g->addMultiCellWidget(l,3,3,0,1); - m_pMaskListBox = new QListBox(p1); - connect(m_pMaskListBox,SIGNAL(currentChanged(QListBoxItem *)),this,SLOT(maskCurrentChanged(QListBoxItem *))); + m_pMaskListBox = new KviTalListBox(p1); + connect(m_pMaskListBox,SIGNAL(currentChanged(KviTalListBoxItem *)),this,SLOT(maskCurrentChanged(KviTalListBoxItem *))); m_pMaskListBox->setMinimumSize(300,200); g->addMultiCellWidget(m_pMaskListBox,4,4,0,1); @@ -548,7 +548,7 @@ KviRegisteredUserEntryDialog::~KviRegisteredUserEntryDialog() delete m_pCustomColor; } -void KviRegisteredUserEntryDialog::maskCurrentChanged(QListBoxItem *it) +void KviRegisteredUserEntryDialog::maskCurrentChanged(KviTalListBoxItem *it) { m_pDelMaskButton->setEnabled(it); m_pEditMaskButton->setEnabled(it); @@ -773,7 +773,7 @@ void KviRegisteredUserEntryDialog::editAllPropertiesClicked() } -KviRegisteredUsersDialogItem::KviRegisteredUsersDialogItem(QListViewItem * par,KviRegisteredUser * u) +KviRegisteredUsersDialogItem::KviRegisteredUsersDialogItem(KviTalListViewItem * par,KviRegisteredUser * u) : KviRegisteredUsersDialogItemBase(User,par), m_pUser(u) { setText(0,u->name()); @@ -783,7 +783,7 @@ void KviRegisteredUsersDialogItem::paintCell(QPainter * p,const QColorGroup &cg, { if(column == 1) { - QListView *lv = listView(); + KviTalListView *lv = (KviTalListView *)listView(); const BackgroundMode bgmode = lv->viewport()->backgroundMode(); const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode ); p->fillRect(0,0,width,height(),isSelected() ? cg.brush(QColorGroup::Highlight) : cg.brush(crole)); @@ -810,7 +810,7 @@ void KviRegisteredUsersDialogItem::paintCell(QPainter * p,const QColorGroup &cg, } return; } - QListViewItem::paintCell(p,cg,column,width,align); + KviTalListViewItem::paintCell(p,cg,column,width,align); } @@ -828,14 +828,14 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par) QGridLayout * g = new QGridLayout(this,4,3,4,4); - m_pListView = new QListView(this); + m_pListView = new KviTalListView(this); m_pListView->addColumn(__tr2qs("Name"),200); m_pListView->addColumn(__tr2qs("Notify"),130); m_pListView->setAllColumnsShowFocus(true); - m_pListView->setSelectionMode(QListView::Extended); + m_pListView->setSelectionMode(KviTalListView::Extended); m_pListView->setRootIsDecorated(TRUE); #ifdef COMPILE_INFO_TIPS @@ -846,8 +846,8 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par) "Notify list fine-tuning can be performed by editing the entry properties.</center>")); #endif // COMPILE_INFO_TIPS - connect(m_pListView,SIGNAL(pressed(QListViewItem *,const QPoint &,int)),this,SLOT(itemPressed(QListViewItem *,const QPoint &,int))); - connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(itemDoubleClicked(QListViewItem *))); + connect(m_pListView,SIGNAL(pressed(KviTalListViewItem *,const QPoint &,int)),this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); + connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *)),this,SLOT(itemDoubleClicked(KviTalListViewItem *))); g->addMultiCellWidget(m_pListView,0,1,0,1); @@ -938,7 +938,7 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par) g->setRowStretch(1,1); connect(m_pListView,SIGNAL(selectionChanged()),this,SLOT(selectionChanged())); - connect(m_pListView,SIGNAL(rightButtonClicked ( QListViewItem *, const QPoint &, int ) ),this,SLOT(listViewRightButtonClicked ( QListViewItem *, const QPoint &, int ))); + connect(m_pListView,SIGNAL(rightButtonClicked ( KviTalListViewItem *, const QPoint &, int ) ),this,SLOT(listViewRightButtonClicked ( KviTalListViewItem *, const QPoint &, int ))); fillList(); @@ -971,7 +971,7 @@ KviRegisteredUsersDialog::~KviRegisteredUsersDialog() g_pLocalRegisteredUserDataBase = 0; } -void KviRegisteredUsersDialog::itemPressed(QListViewItem *it,const QPoint &pnt,int c) +void KviRegisteredUsersDialog::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int c) { if(!it)return; KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)it; @@ -1017,7 +1017,7 @@ void KviRegisteredUsersDialog::itemPressed(QListViewItem *it,const QPoint &pnt,i } } -void KviRegisteredUsersDialog::itemDoubleClicked(QListViewItem *it) +void KviRegisteredUsersDialog::itemDoubleClicked(KviTalListViewItem *it) { if(!it)return; KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)it; @@ -1071,7 +1071,7 @@ void KviRegisteredUsersDialog::editGroup(KviRegisteredUserGroup* group) } } -void KviRegisteredUsersDialog::listViewRightButtonClicked ( QListViewItem * pItem, const QPoint & point, int ) +void KviRegisteredUsersDialog::listViewRightButtonClicked ( KviTalListViewItem * pItem, const QPoint & point, int ) { if(pItem) { @@ -1102,7 +1102,7 @@ void KviRegisteredUsersDialog::listViewRightButtonClicked ( QListViewItem * pIte void KviRegisteredUsersDialog::moveToGroupMenuClicked(int id) { QString szGroup=m_TmpDict.find(id)->name(); - QListViewItemIterator it( m_pListView, QListViewItemIterator::Selected ); + KviTalListViewItemIterator it( m_pListView, KviTalListViewItemIterator::Selected ); while ( it.current() ) { KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)(it.current()); if(b->type()==KviRegisteredUsersDialogItemBase::User) @@ -1207,7 +1207,7 @@ void KviRegisteredUsersDialog::addWizardClicked() void KviRegisteredUsersDialog::removeClicked() { - QListViewItemIterator it( m_pListView, QListViewItemIterator::Selected ); + KviTalListViewItemIterator it( m_pListView, KviTalListViewItemIterator::Selected ); while ( it.current() ) { KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)(it.current()); if(b->type()==KviRegisteredUsersDialogItemBase::User) @@ -1274,7 +1274,7 @@ void KviRegisteredUsersDialog::editItem(KviRegisteredUsersDialogItem * i) fillList(); // select the last edited item - QListViewItem * i = m_pListView->firstChild(); + KviTalListViewItem * i = m_pListView->firstChild(); while(i) { QString szTmp = i->text(0); @@ -1319,7 +1319,7 @@ void KviRegisteredUsersDialog::exportClicked() { unsigned int nEntries = 0; - QListViewItem * it; + KviTalListViewItem * it; for(it = m_pListView->firstChild();it;it = it->nextSibling()) { diff --git a/src/modules/reguser/edituser.h b/src/modules/reguser/edituser.h index 2a98cffe5..5fa2af4be 100644 --- a/src/modules/reguser/edituser.h +++ b/src/modules/reguser/edituser.h @@ -31,8 +31,8 @@ #include <qwidget.h> #include <qlineedit.h> #include <qpushbutton.h> -#include <qlistview.h> -#include <qlistbox.h> +#include "kvi_tal_listview.h" +#include "kvi_tal_listbox.h" #include "kvi_dict.h" #include <qtabdialog.h> #include <qtable.h> @@ -79,17 +79,17 @@ protected slots: void okClicked(); }; -class KviRegisteredUsersDialogItemBase : public QListViewItem +class KviRegisteredUsersDialogItemBase : public KviTalListViewItem { public: enum Types { User,Group }; protected: - KviRegisteredUsersDialogItemBase(Types type,QListView * par) - :QListViewItem(par),m_iType(type) + KviRegisteredUsersDialogItemBase(Types type,KviTalListView * par) + :KviTalListViewItem(par),m_iType(type) { }; - KviRegisteredUsersDialogItemBase(Types type,QListViewItem * par) - :QListViewItem(par),m_iType(type) + KviRegisteredUsersDialogItemBase(Types type,KviTalListViewItem * par) + :KviTalListViewItem(par),m_iType(type) { }; ~KviRegisteredUsersDialogItemBase() @@ -107,7 +107,7 @@ class KviRegisteredUsersGroupItem : public KviRegisteredUsersDialogItemBase protected: KviRegisteredUserGroup * m_pGroup; public: - KviRegisteredUsersGroupItem(QListView * par,KviRegisteredUserGroup * g) + KviRegisteredUsersGroupItem(KviTalListView * par,KviRegisteredUserGroup * g) :KviRegisteredUsersDialogItemBase(Group,par), m_pGroup(g) { setText(0,m_pGroup->name()); @@ -123,7 +123,7 @@ class KviRegisteredUsersDialogItem : public KviRegisteredUsersDialogItemBase protected: KviRegisteredUser * m_pUser; public: - KviRegisteredUsersDialogItem(QListViewItem * par,KviRegisteredUser * u); + KviRegisteredUsersDialogItem(KviTalListViewItem * par,KviRegisteredUser * u); public: KviRegisteredUser * user(){ return m_pUser; }; @@ -145,7 +145,7 @@ protected: QLineEdit * m_pNameEdit; QLineEdit * m_pCommentEdit; - QListBox * m_pMaskListBox; + KviTalListBox * m_pMaskListBox; QPushButton * m_pDelMaskButton; QPushButton * m_pEditMaskButton; @@ -181,7 +181,7 @@ protected slots: void delMaskClicked(); void editMaskClicked(); void editAllPropertiesClicked(); - void maskCurrentChanged(QListBoxItem *it); + void maskCurrentChanged(KviTalListBoxItem *it); }; @@ -192,7 +192,7 @@ public: KviRegisteredUsersDialog(QWidget * par = 0); ~KviRegisteredUsersDialog(); public: - QListView * m_pListView; + KviTalListView * m_pListView; QPushButton * m_pAddButton; QPushButton * m_pWizardAddButton; QPushButton * m_pRemoveButton; @@ -203,8 +203,8 @@ public: QIntDict<KviRegisteredUserGroup> m_TmpDict; protected slots: - void itemPressed(QListViewItem *it,const QPoint &pnt,int c); - void itemDoubleClicked(QListViewItem *it); + void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int c); + void itemDoubleClicked(KviTalListViewItem *it); protected: void fillList(); protected: @@ -222,7 +222,7 @@ protected slots: void exportClicked(); void addWizardClicked(); void addGroupClicked(); - void listViewRightButtonClicked ( QListViewItem *, const QPoint &, int ); + void listViewRightButtonClicked ( KviTalListViewItem *, const QPoint &, int ); void moveToGroupMenuClicked(int); }; diff --git a/src/modules/sharedfileswindow/sharedfileswindow.cpp b/src/modules/sharedfileswindow/sharedfileswindow.cpp index 874a54f61..119ab0dc2 100644 --- a/src/modules/sharedfileswindow/sharedfileswindow.cpp +++ b/src/modules/sharedfileswindow/sharedfileswindow.cpp @@ -181,8 +181,8 @@ void KviSharedFileEditDialog::okClicked() } -KviSharedFilesListViewItem::KviSharedFilesListViewItem(QListView * lv,KviSharedFile * f) -: QListViewItem(lv,f->name()) +KviSharedFilesListViewItem::KviSharedFilesListViewItem(KviTalListView * lv,KviSharedFile * f) +: KviTalListViewItem(lv,f->name()) { setText(1,f->absFilePath()); setText(2,f->userMask()); @@ -211,14 +211,14 @@ KviSharedFilesWindow::KviSharedFilesWindow(KviModuleExtensionDescriptor * d,KviF KviTalVBox * vbox = new KviTalVBox(m_pSplitter); - m_pListView = new QListView(vbox); + m_pListView = new KviTalListView(vbox); //m_pListView->header()->hide(); m_pListView->setAllColumnsShowFocus(true); m_pListView->addColumn(__tr2qs_ctx("Name","sharedfileswindow"),200); m_pListView->addColumn(__tr2qs_ctx("Filename","sharedfileswindow"),300); m_pListView->addColumn(__tr2qs_ctx("Mask","sharedfileswindow"),200); m_pListView->addColumn(__tr2qs_ctx("Expires","sharedfileswindow"),200); - m_pListView->setSelectionMode(QListView::Single); + m_pListView->setSelectionMode(KviTalListView::Single); connect(m_pListView,SIGNAL(selectionChanged()),this,SLOT(enableButtons())); connect(g_pSharedFilesManager,SIGNAL(sharedFilesChanged()),this,SLOT(fillFileView())); @@ -244,7 +244,7 @@ KviSharedFilesWindow::~KviSharedFilesWindow() void KviSharedFilesWindow::enableButtons() { - QListViewItem * it = m_pListView->currentItem(); + KviTalListViewItem * it = m_pListView->currentItem(); m_pEditButton->setEnabled(it); m_pRemoveButton->setEnabled(it); } @@ -311,7 +311,7 @@ void KviSharedFilesWindow::sharedFileAdded(KviSharedFile * f) void KviSharedFilesWindow::sharedFileRemoved(KviSharedFile * f) { - QListViewItem * it = m_pListView->firstChild(); + KviTalListViewItem * it = m_pListView->firstChild(); while(it) { if(((KviSharedFilesListViewItem *)it)->readOnlySharedFilePointer() == f) @@ -374,7 +374,7 @@ void KviSharedFilesWindow::transferUnregistering(KviSharedFiles * t) if(it)delete it; } -void KviSharedFilesWindow::rightButtonPressed(QListViewItem *it,const QPoint &pnt,int col) +void KviSharedFilesWindow::rightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { if(!m_pContextPopup)m_pContextPopup = new KviTalPopupMenu(this); if(!m_pLocalFilePopup)m_pLocalFilePopup = new KviTalPopupMenu(this); @@ -487,7 +487,7 @@ void KviSharedFilesWindow::rightButtonPressed(QListViewItem *it,const QPoint &pn KviSharedFiles * KviSharedFilesWindow::selectedTransfer() { - QListViewItem * it = m_pListView->selectedItem(); + KviTalListViewItem * it = m_pListView->selectedItem(); if(!it)return 0; KviSharedFilesItem * i = (KviSharedFilesItem *)it; return i->transfer(); @@ -623,8 +623,8 @@ void KviSharedFilesWindow::heartbeat() { if(m_pListView->childCount() < 1)return; - QListViewItem * i1; - QListViewItem * i2; + KviTalListViewItem * i1; + KviTalListViewItem * i2; i1 = m_pListView->itemAt(QPoint(1,1)); if(!i1) diff --git a/src/modules/sharedfileswindow/sharedfileswindow.h b/src/modules/sharedfileswindow/sharedfileswindow.h index 663223e5b..23e941a3f 100644 --- a/src/modules/sharedfileswindow/sharedfileswindow.h +++ b/src/modules/sharedfileswindow/sharedfileswindow.h @@ -31,7 +31,7 @@ #include "kvi_moduleextension.h" #include "kvi_sharedfiles.h" -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qdialog.h> class QGridLayout; @@ -41,10 +41,10 @@ class QLineEdit; class QPushButton; class KviStyledCheckBox; -class KviSharedFilesListViewItem : public QListViewItem +class KviSharedFilesListViewItem : public KviTalListViewItem { public: - KviSharedFilesListViewItem(QListView * lv,KviSharedFile * f); + KviSharedFilesListViewItem(KviTalListView * lv,KviSharedFile * f); ~KviSharedFilesListViewItem(); protected: KviSharedFile * m_pSharedFilePointer; // THIS IS READ ONLY! @@ -87,7 +87,7 @@ public: protected: QSplitter * m_pVertSplitter; - QListView * m_pListView; + KviTalListView * m_pListView; QPushButton * m_pRemoveButton; QPushButton * m_pEditButton; diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp index d385e4746..a3c004c34 100644 --- a/src/modules/theme/managementdialog.cpp +++ b/src/modules/theme/managementdialog.cpp @@ -39,7 +39,7 @@ #include <qlayout.h> #include <qpushbutton.h> -#include <qlistbox.h> +#include "kvi_tal_listbox.h" #include <qlineedit.h> #include <qtextedit.h> #include <qregexp.h> @@ -78,8 +78,8 @@ extern QRect g_rectManagementDialogGeometry; -KviThemeListBoxItem::KviThemeListBoxItem(QListBox * box,KviThemeInfo * inf) -: QListBoxText(box) +KviThemeListBoxItem::KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf) +: KviTalListBoxText(box) { m_pThemeInfo = inf; QString t; @@ -120,7 +120,7 @@ KviThemeListBoxItem::~KviThemeListBoxItem() void KviThemeListBoxItem::paint(QPainter * p) { - QListBoxText::paint(p); + KviTalListBoxText::paint(p); p->drawPixmap(LVI_BORDER,LVI_BORDER, *(g_pIconManager->getBigIcon(QString(KVI_BIGICON_THEME))) ); int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING; int www = p->window().width() - (afterIcon + LVI_BORDER); @@ -128,7 +128,7 @@ void KviThemeListBoxItem::paint(QPainter * p) m_pText->draw(p,afterIcon,LVI_BORDER,QRect(afterIcon,LVI_BORDER,www,p->window().height() - (LVI_BORDER * 2)),listBox()->viewport()->colorGroup()); } -int KviThemeListBoxItem::height(const QListBox * lb) const +int KviThemeListBoxItem::height(const KviTalListBox * lb) const { int iHeight = m_pText->height() + (2 * LVI_BORDER); if(iHeight < (LVI_ICON_SIZE + (2 * LVI_BORDER)))iHeight = LVI_ICON_SIZE + (2 * LVI_BORDER); @@ -197,13 +197,13 @@ KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent) QWidget *w= new QWidget(hb); w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); - m_pListBox = new QListBox(this); + m_pListBox = new KviTalListBox(this); m_pListBox->setMinimumHeight(400); m_pListBox->setMinimumWidth(400); - m_pListBox->setSelectionMode(QListBox::Extended); - connect(m_pListBox,SIGNAL(doubleClicked(QListBoxItem *)),this,SLOT(applyTheme(QListBoxItem *))); - connect(m_pListBox,SIGNAL(contextMenuRequested(QListBoxItem *,const QPoint &)), - this,SLOT(contextMenuRequested(QListBoxItem *,const QPoint &))); + m_pListBox->setSelectionMode(KviTalListBox::Extended); + connect(m_pListBox,SIGNAL(doubleClicked(KviTalListBoxItem *)),this,SLOT(applyTheme(KviTalListBoxItem *))); + connect(m_pListBox,SIGNAL(contextMenuRequested(KviTalListBoxItem *,const QPoint &)), + this,SLOT(contextMenuRequested(KviTalListBoxItem *,const QPoint &))); connect(m_pListBox,SIGNAL(selectionChanged()),this,SLOT(enableDisableButtons())); g->addMultiCellWidget(m_pListBox,1,1,0,1); @@ -274,7 +274,7 @@ void KviThemeManagementDialog::packTheme() } -void KviThemeManagementDialog::contextMenuRequested(QListBoxItem * it,const QPoint & pos) +void KviThemeManagementDialog::contextMenuRequested(KviTalListBoxItem * it,const QPoint & pos) { if(it) { @@ -286,7 +286,7 @@ void KviThemeManagementDialog::contextMenuRequested(QListBoxItem * it,const QPoi } } -void KviThemeManagementDialog::applyTheme ( QListBoxItem * it) +void KviThemeManagementDialog::applyTheme ( KviTalListBoxItem * it) { if(it)m_pListBox->setCurrentItem(it); applyCurrentTheme(); @@ -407,7 +407,7 @@ void KviThemeManagementDialog::fillThemeBox() bool KviThemeManagementDialog::hasSelectedItems() { - for(QListBoxItem * it = m_pListBox->firstItem();it;it = it->next()) + for(KviTalListBoxItem * it = m_pListBox->firstItem();it;it = it->next()) { if(it->isSelected())return true; } diff --git a/src/modules/theme/managementdialog.h b/src/modules/theme/managementdialog.h index 25658a9dc..ef2fc37ec 100644 --- a/src/modules/theme/managementdialog.h +++ b/src/modules/theme/managementdialog.h @@ -30,7 +30,7 @@ #include <qdialog.h> #include <qsimplerichtext.h> -#include <qlistbox.h> +#include "kvi_tal_listbox.h" #include <qcombobox.h> #include "kvi_tal_popupmenu.h" #include <qcursor.h> @@ -48,17 +48,17 @@ class KviDynamicToolTip; class KviStyledToolButton; -class KviThemeListBoxItem : public QListBoxText +class KviThemeListBoxItem : public KviTalListBoxText { public: - KviThemeListBoxItem(QListBox * box,KviThemeInfo * inf); + KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf); virtual ~KviThemeListBoxItem(); public: KviThemeInfo * m_pThemeInfo; QSimpleRichText * m_pText; public: KviThemeInfo * themeInfo(){ return m_pThemeInfo; }; - virtual int height ( const QListBox * lb ) const ; + virtual int height ( const KviTalListBox * lb ) const ; protected: virtual void paint ( QPainter * painter ); }; @@ -72,7 +72,7 @@ public: virtual ~KviThemeManagementDialog(); protected: static KviThemeManagementDialog * m_pInstance; - QListBox * m_pListBox; + KviTalListBox * m_pListBox; KviTalPopupMenu * m_pContextPopup; KviStyledToolButton * m_pDeleteThemeButton; KviStyledToolButton * m_pPackThemeButton; @@ -92,10 +92,10 @@ protected slots: void deleteTheme(); void closeClicked(); void packTheme(); - void applyTheme(QListBoxItem *); + void applyTheme(KviTalListBoxItem *); void applyCurrentTheme(); void enableDisableButtons(); - void contextMenuRequested(QListBoxItem * item, const QPoint & pos); + void contextMenuRequested(KviTalListBoxItem * item, const QPoint & pos); void tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt); }; diff --git a/src/modules/torrent/.svnignore b/src/modules/torrent/.svnignore new file mode 100644 index 000000000..3ebe7fb0c --- /dev/null +++ b/src/modules/torrent/.svnignore @@ -0,0 +1,10 @@ +Makefile.in +Makefile +.deps +*.o +*.lo +*.la +*.moc +.libs +.mospics +.pics
\ No newline at end of file diff --git a/src/modules/torrent/Makefile.am b/src/modules/torrent/Makefile.am new file mode 100644 index 000000000..c835d3ece --- /dev/null +++ b/src/modules/torrent/Makefile.am @@ -0,0 +1,27 @@ +############################################################################### +# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it> +############################################################################### + +AM_CPPFLAGS = -I$(SS_TOPSRCDIR)/src/kvilib/include/ -I$(SS_TOPSRCDIR)/src/kvirc/include/ \ +$(SS_INCDIRS) $(SS_CPPFLAGS) -DGLOBAL_KVIRC_DIR=\"$(globalkvircdir)\" + +pluglib_LTLIBRARIES = libkvitorrent.la + +#%.moc: %.h +# $(SS_QT_MOC) $< -o $@ + +libkvitorrent_la_LDFLAGS = -avoid-version -module + +libkvitorrent_la_SOURCES = libkvitorrent.cpp \ + tc_interface.cpp \ + tc_ktorrentdcopinterface.cpp + +libkvitorrent_la_LIBADD = $(SS_LIBLINK) ../../kvilib/build/libkvilib.la + +noinst_HEADERS = tc_interface.h \ + tc_ktorrentdcopinterface.h + +%.moc: %.h + $(SS_QT_MOC) $< -o $@ + +tc_ktorrentdcopinterface.cpp: tc_ktorrentdcopinterface.moc diff --git a/src/modules/torrent/libkvitorrent.cpp b/src/modules/torrent/libkvitorrent.cpp new file mode 100644 index 000000000..fd516f1ac --- /dev/null +++ b/src/modules/torrent/libkvitorrent.cpp @@ -0,0 +1,832 @@ +//============================================================================= +// +// File : libkvitorrent.cpp +// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2007 Alexander Stillich (torque at pltn dot org) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "kvi_module.h" +#include "kvi_options.h" + +#include "tc_interface.h" +#include "tc_ktorrentdcopinterface.h" + +#include "kvi_locale.h" +#include "kvi_out.h" + + +static KviPtrList<KviTorrentInterfaceDescriptor> * g_pDescriptorList = 0; + +// selected torrent interface +static KviTorrentInterface *g_pTcInterface = 0; + +//static KviMediaPlayerInterface * g_pMPInterface = 0; + + +static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0) +{ + int iBest = 0; + KviTorrentInterface * pBest = 0; + KviTorrentInterfaceDescriptor * d; + KviTorrentInterfaceDescriptor * pDBest = 0; + + for (d=g_pDescriptorList->first(); d!=0; d=g_pDescriptorList->next()) + { +// printf("detect %s\n%s\n", d->name().ascii(), d->description().ascii()); + + // instance gets deleted by descriptor later + KviTorrentInterface *i = d->instance(); + if(i) + { +// printf("detect %p\n", i); + int iScore = i->detect(); + if(iScore > iBest) + { + iBest = iScore; + pBest = i; + pDBest = d; + } + + if(pOut) + { + pOut->output(KVI_OUT_TORRENT, + __tr2qs_ctx("Trying torrent client interface \"%Q\": score %d", "torrent"), + &d->name(), + iScore); + } + } + } + +/* if(iBest < 90) + { + if(pOut) + pOut->outputNoFmt(KVI_OUT_MULTIMEDIA,__tr2qs_ctx("Not sure about the results, trying a second, more agressive detection pass","mediaplayer")); + // no sure player found... try again with a destructive test + for(d = g_pDescriptorList->first();d;d = g_pDescriptorList->next()) + { + KviMediaPlayerInterface * i = d->instance(); + if(i) + { + int iScore = i->detect(true); + if(iScore > iBest) + { + iBest = iScore; + pBest = i; + pDBest = d; + } + if(pOut) + { + QString szOut; + QString szNam = d->name(); + KviQString::sprintf(szOut,__tr2qs_ctx("Trying media player interface \"%Q\": score %d","mediaplayer"),&(szNam),iScore); + pOut->output(KVI_OUT_MULTIMEDIA,szOut); + } + } + } + } +*/ + if(pDBest) + { + // TODO: what's this? +// KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer) = pDBest->name(); + if(pOut) + pOut->output(KVI_OUT_TORRENT, + __tr2qs_ctx("Choosing torrent client interface \"%Q\"", "torrent"), + &pDBest->name()); + + } else { + if(pOut) + pOut->outputNoFmt(KVI_OUT_TORRENT, + __tr2qs_ctx("Seems that there is no usable torrent client on this machine", "torrent")); + + } + + return pBest; +} + + +static bool torrent_test(KviKvsModuleCommandCall *c) +{ +/* kvs_real_t dReal; \ + KVSM_PARAMETERS_BEGIN(c) \ + KVSM_PARAMETER("test1", KVS_PT_REAL, 0, dReal) \ + KVSM_PARAMETERS_END(c) \ + c->returnValue()->setReal(dReal); \ + + printf("test called %f\n", dReal); +*/ + if (!g_pTcInterface) + return false; + + int count = g_pTcInterface->count(); + for (int i=0; i<count; i++) + { + QString n = g_pTcInterface->name(i); + debug("%d: %s [%s]", i, n.ascii(), g_pTcInterface->state(i).ascii()); + } + + return true; +} + +#define TC_KVS_FAIL_ON_NO_INTERFACE \ + if (!g_pTcInterface) \ + { \ + c->warning(__tr2qs_ctx("No torrent client interface selected. Try /torrent.detect", "torrent")); \ + return true; \ + } + +#define TC_KVS_COMMAND(__name) static bool torrent_kvs_cmd_ ## __name (KviKvsModuleCommandCall * c) +#define TC_KVS_FUNCTION(__name) static bool torrent_kvs_fnc_ ## __name (KviKvsModuleFunctionCall * c) + +#define TC_KVS_COMMAND_ERROR \ + if (!c->hasSwitch('q',"quiet")) \ + { \ + c->warning(__tr2qs_ctx("The selected torrent client interface failed to execute the requested function", "torrent")); \ + QString tmp = __tr2qs_ctx("Last interface error: ", "torrent"); \ + tmp += g_pTcInterface->lastError(); \ + c->warning(tmp); \ + } \ + +#define TC_KVS_SIMPLE_COMMAND(__name, __ifacecommand) \ + TC_KVS_COMMAND(__name) \ + { \ + KVSM_PARAMETERS_BEGIN(c) \ + KVSM_PARAMETERS_END(c) \ + \ + TC_KVS_FAIL_ON_NO_INTERFACE \ + \ + if (!g_pTcInterface->__ifacecommand()) \ + { \ + TC_KVS_COMMAND_ERROR \ + } \ + return true; \ + } + +#define TC_KVS_INT_COMMAND(__name, __ifacecommand, __argname) \ + TC_KVS_COMMAND(__name) \ + { \ + debug("TC_KVS_INT_COMMAND"); \ + kvs_int_t arg; \ + KVSM_PARAMETERS_BEGIN(c) \ + KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \ + KVSM_PARAMETERS_END(c) \ + debug("TC_KVS_INT_COMMAND 2"); \ + TC_KVS_FAIL_ON_NO_INTERFACE \ + \ + if (!g_pTcInterface->__ifacecommand(arg)) \ + { \ + debug("TC_KVS_INT_COMMAND 3"); \ + TC_KVS_COMMAND_ERROR \ + } \ + debug("TC_KVS_INT_COMMAND 4"); \ + return true; \ + } + +#define TC_KVS_STRINGRET_FUNCTION(__name, __ifacecommand) \ + TC_KVS_FUNCTION(__name) \ + { \ + TC_KVS_FAIL_ON_NO_INTERFACE \ + QString szRet = g_pTcInterface->__ifacecommand(); \ + c->returnValue()->setString(szRet); \ + return true; \ + } + +#define TC_KVS_INTRET_FUNCTION(__name, __ifacecommand) \ + TC_KVS_FUNCTION(__name) \ + { \ + TC_KVS_FAIL_ON_NO_INTERFACE \ + kvs_int_t ret = g_pTcInterface->__ifacecommand(); \ + c->returnValue()->setInteger(ret); \ + return true; \ + } + +#define TC_KVS_FLOATRET_FUNCTION(__name, __ifacecommand) \ + TC_KVS_FUNCTION(__name) \ + { \ + TC_KVS_FAIL_ON_NO_INTERFACE \ + kvs_real_t ret = g_pTcInterface->__ifacecommand(); \ + c->returnValue()->setReal(ret); \ + return true; \ + } + +#define TC_KVS_STRINGRET_INT_FUNCTION(__name, __ifacecommand, __argname) \ + TC_KVS_FUNCTION(__name) \ + { \ + kvs_int_t arg; \ + KVSM_PARAMETERS_BEGIN(c) \ + KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \ + KVSM_PARAMETERS_END(c) \ + TC_KVS_FAIL_ON_NO_INTERFACE \ + QString szRet = g_pTcInterface->__ifacecommand(arg); \ + c->returnValue()->setString(szRet); \ + return true; \ + } + +/* +#define MP_KVS_SIMPLE_INT_FUNCTION(__name,__ifacecommand) \ +MP_KVS_FUNCTION(__name) \ +{ \ + MP_KVS_FAIL_ON_NO_INTERFACE \ + int iRet = g_pMPInterface->__ifacecommand(); \ + c->returnValue()->setInteger(iRet); \ + return true; \ +} +// FINDME! +#define MP_KVS_SIMPLE_BOOL_FUNCTION(__name,__ifacecommand) \ +MP_KVS_FUNCTION(__name) \ +{ \ + MP_KVS_FAIL_ON_NO_INTERFACE \ + bool bRet = g_pMPInterface->__ifacecommand(); \ + c->returnValue()->setBoolean(bRet); \ + return true; \ +} +*/ + +TC_KVS_COMMAND(detect) +{ + g_pTcInterface = auto_detect_torrent_client(c->hasSwitch('q',"quiet") ? 0 : c->window()); + return true; +} + +/* + @doc: torrent.maxUploadSpeed + @type: + function + @title: + $torrent.maxUploadSpeed + @short: + Returns maximum upload speed set in client. + @syntax: + $torrent.maxUploadSpeed() + @description: + Returns maximum upload speed set in client. + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_INTRET_FUNCTION(maxUploadSpeed, maxUploadSpeed) + + +/* + @doc: torrent.maxDownloadSpeed + @type: + function + @title: + $torrent.maxDownloadSpeed + @short: + Returns maximum download speed set in client. + @syntax: + $torrent.maxDownloadSpeed() + @description: + Returns maximum download speed set in client. + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_INTRET_FUNCTION(maxDownloadSpeed, maxDownloadSpeed) + +/* + @doc: torrent.setMaxUploadSpeed + @type: + command + @title: + torrent.setMaxUploadSpeed + @short: + Sets maximum upload speed + @syntax: + torrent.setMaxUploadSpeed <kbytes_per_sec> + @description: + Sets maximum upload speed + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_INT_COMMAND(setMaxUploadSpeed, setMaxUploadSpeed, "kbytes_per_sec") + +/* + @doc: torrent.setMaxDownloadSpeed + @type: + command + @title: + torrent.setMaxDownloadSpeed + @short: + Sets maximum download speed + @syntax: + torrent.setMaxDownloadSpeed <kbytes_per_sec> + @description: + Sets maximum download speed + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_INT_COMMAND(setMaxDownloadSpeed, setMaxDownloadSpeed, "kbytes_per_sec") + +/* + @doc: torrent.speedUp + @type: + function + @title: + $torrent.speedUp + @short: + Returns current total upload speed + @syntax: + $torrent.speedUp() + @description: + Returns current total upload speed + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_FLOATRET_FUNCTION(speedUp, speedUp) + +/* + @doc: torrent.speedDown + @type: + function + @title: + $torrent.speedDown + @short: + Returns current total download speed + @syntax: + $torrent.speedDown() + @description: + Returns current total download speed + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_FLOATRET_FUNCTION(speedDown, speedDown) + +/* + @doc: torrent.count + @type: + function + @title: + $torrent.count + @short: + Returns number of torrents in client + @syntax: + $torrent.name() + @description: + Returns number of torrents in client + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_INTRET_FUNCTION(count, count) + +/* + @doc: torrent.name + @type: + function + @title: + $torrent.name + @short: + Returns torrent name as displayed in client + @syntax: + $torrent.name(torrent_number) + @description: + Returns torrent name as displayed in client + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_STRINGRET_INT_FUNCTION(name, name, "torrent_number") + +/* + @doc: torrent.start + @type: + command + @title: + torrent.start + @short: + Starts downloading of torrent <torrent_number> + @syntax: + torrent.start <torrent_number> + @description: + Starts downloading of torrent <torrent_number> + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.stop[/cmd], [cmd]torrent.stopAll[/cmd], [cmd]torrent.startAll[/cmd] +*/ +TC_KVS_INT_COMMAND(start, start, "torrent_number") + +/* + @doc: torrent.stop + @type: + command + @title: + torrent.stop + @short: + Stops downloading of torrent <torrent_number> + @syntax: + torrent.stop <torrent_number> + @description: + Stops downloading of torrent <torrent_number> + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.stopAll[/cmd], [cmd]torrent.startAll[/cmd], [cmd]torrent.start[/cmd] +*/ +TC_KVS_INT_COMMAND(stop, stop, "torrent_number") + +/* + @doc: torrent.announce + @type: + command + @title: + torrent.announce + @short: + Manually announces torrent to tracker + @syntax: + torrent.announce <torrent_number> + @description: + Manually announces torrent to tracker + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_INT_COMMAND(announce, announce, "torrent_number") + +/* + @doc: torrent.startAll + @type: + command + @title: + torrent.startAll + @short: + Starts downloading of all torrents + @syntax: + torrent.startAll + @description: + Starts downloading of all torrents + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.stopAll[/cmd], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd] +*/ + +TC_KVS_SIMPLE_COMMAND(startAll, startAll) + +/* + @doc: torrent.stopAll + @type: + command + @title: + torrent.stopAll + @short: + Stops downloading of all torrents + @syntax: + torrent.stopAll + @description: + Stops downloading of all torrents + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.startAll[/cmd], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd] +*/ + +TC_KVS_SIMPLE_COMMAND(stopAll, stopAll) + + +/* + @doc: torrent.list + @type: + function + @title: + torrent.list + @short: + Returns a list of all torrents + @syntax: + $torrent.list() + @description: + Returns a list of all torrents + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.startAll[/cmd], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd] +*/ + +//MP_KVS_SIMPLE_COMMAND(list,list) + +/* + @doc: torrent.status + @type: + function + @title: + torrent.status + @short: + Returns status of a torrent + @syntax: + $torrent.status(<torrent_number>) + @description: + Returns the status of torrent <torrent_number> + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [fnc]torrent.list[/fnc], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd], [cmd]torrent.startAll[/cmd], [cmd]torrent.stopAll[/cmd] +*/ + +//MP_KVS_SIMPLE_COMMAND(list,list) + +/* + @doc: torrent.setClient + @type: + command + @title: + torrent.setClient + @short: + Sets the torrent client interface + @syntax: + torrent.setClient <client_name> + @description: + Sets the torrent client interface to be used by the + torrent interface module. <interface_name> must be one + of the client names returned by [cmd]torrent.clientList[/cmd] + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.detect[/cmd], [fnc]$torrent.client()[/fnc] +*/ +/* +MP_KVS_COMMAND(setClient) +{ + QString szPlayer; + + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("player",KVS_PT_STRING,0,szPlayer) + KVSM_PARAMETERS_END(c) + + for(KviMediaPlayerInterfaceDescriptor * d = g_pDescriptorList->first();d;d = g_pDescriptorList->next()) + { + if(d->name() == szPlayer) + { + g_pMPInterface = d->instance(); + KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer) = szPlayer; + return true; + } + } + + return true; +} +*/ +/* + @doc: torrent.client + @type: + function + @title: + $torrent.client + @short: + Returns the currently set torrent client interface + @syntax: + $torrent.client() + @description: + Returns the currently set torrent client interface. + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.detect[/cmd], [cmd]torrent.setClient[/cmd] +*/ + +/*MP_KVS_FUNCTION(client) +{ + c->returnValue()->setString(KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer)); + return true; +} +*/ +/* + @doc: torrent.clientList + @type: + command + @title: + torrent.clientList + @short: + Returns a list of all supported clients + @syntax: + torrent.clientList + @description: + Returns a list of all supported clients + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], + [cmd]torrent.detect[/cmd], [cmd]torrent.setClient[/cmd], [cmd]torrent.client[/cmd] +*/ +/*MP_KVS_FUNCTION(clientList) +{ + //c->returnValue()->setString(KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer)); + return true; +} +*/ + +/* + @doc: torrent.state + @type: + function + @title: + $torrent.state + @short: + Returns state of torrent (Stopped, Stalled, Seeding, Downloading) + @syntax: + $torrent.state <torrent_number> + @description: + Returns state of torrent (Stopped, Stalled, Seeding, Downloading) + Take a look at the [module:torrent]torrent client documentation[/module] + for more details about how it works.[br] + @seealso: + [module:torrent]torrent client documentation[/module], +*/ +TC_KVS_STRINGRET_INT_FUNCTION(state, state, "torrent_number") + +static bool torrent_module_init(KviModule *m) +{ + #define TC_KVS_REGCMD(__name,__stringname) KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, torrent_kvs_cmd_ ## __name) + #define TC_KVS_REGFNC(__name,__stringname) KVSM_REGISTER_FUNCTION(m, __stringname, torrent_kvs_fnc_ ## __name) + + KVSM_REGISTER_SIMPLE_COMMAND(m, "test", torrent_test); + TC_KVS_REGCMD(detect, "detect"); + TC_KVS_REGCMD(start, "start") + TC_KVS_REGCMD(stop, "stop") + TC_KVS_REGCMD(announce, "announce") + TC_KVS_REGCMD(startAll, "startAll") + TC_KVS_REGCMD(stopAll, "stopAll") + TC_KVS_REGCMD(setMaxUploadSpeed, "setMaxUploadSpeed") + TC_KVS_REGCMD(setMaxDownloadSpeed, "setMaxDownloadSpeed") + TC_KVS_REGFNC(maxUploadSpeed, "maxUploadSpeed") + TC_KVS_REGFNC(maxDownloadSpeed, "maxDownloadSpeed") + TC_KVS_REGFNC(speedUp, "speedUp") + TC_KVS_REGFNC(speedDown, "speedDown") + TC_KVS_REGFNC(count, "count") + TC_KVS_REGFNC(name, "name") + TC_KVS_REGFNC(state, "state") + + g_pDescriptorList = new KviPtrList<KviTorrentInterfaceDescriptor>; + g_pDescriptorList->setAutoDelete(true); + +#ifdef COMPILE_KDE_SUPPORT + g_pDescriptorList->append(new KviKTorrentDCOPInterfaceDescriptor); +#endif // COMPILE_KDE_SUPPORT + + g_pTcInterface = 0; + +/* if(KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer) == "auto") + { + g_pMPInterface = auto_detect_player(); + + } else + { + for (KviMediaPlayerInterfaceDescriptor *d=g_pDescriptorList->first(); d; d=g_pDescriptorList->next()) + { + if (d->name() == KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer)) + { + g_pMPInterface = d->instance(); + } + } + } + + // check for "auto" interface too! + + + #define MP_KVS_REGCMD(__name,__stringname) KVSM_REGISTER_SIMPLE_COMMAND(m,__stringname,mediaplayer_kvs_cmd_ ## __name) + #define MP_KVS_REGFNC(__name,__stringname) KVSM_REGISTER_FUNCTION(m,__stringname,mediaplayer_kvs_fnc_ ## __name) + + MP_KVS_REGCMD(play,"play"); + MP_KVS_REGCMD(stop,"stop"); + MP_KVS_REGCMD(next,"next"); + MP_KVS_REGCMD(prev,"prev"); + MP_KVS_REGCMD(quit,"quit"); + MP_KVS_REGCMD(pause,"pause"); + MP_KVS_REGCMD(detect,"detect"); + MP_KVS_REGCMD(playMrl,"playMrl"); + MP_KVS_REGCMD(hide,"hide"); + MP_KVS_REGCMD(show,"show"); + MP_KVS_REGCMD(minimize,"minimize"); + MP_KVS_REGCMD(jumpTo,"jumpTo"); + MP_KVS_REGCMD(setPlayer,"setPlayer"); + MP_KVS_REGCMD(setVol,"setVol"); + MP_KVS_REGCMD(mute,"mute"); + MP_KVS_REGCMD(setRepeat,"setRepeat"); + MP_KVS_REGCMD(setShuffle,"setShuffle"); + MP_KVS_REGCMD(setPlayListPos,"setPlayListPos"); + MP_KVS_REGCMD(setEqData,"setEqData"); + + MP_KVS_REGFNC(nowPlaying,"nowPlaying"); + MP_KVS_REGFNC(mrl,"mrl"); + MP_KVS_REGFNC(title,"title"); + MP_KVS_REGFNC(artist,"artist"); + MP_KVS_REGFNC(genre,"genre"); + MP_KVS_REGFNC(year,"year"); + MP_KVS_REGFNC(comment,"comment"); + MP_KVS_REGFNC(album,"album"); + MP_KVS_REGFNC(mediaType,"mediaType"); + MP_KVS_REGFNC(bitRate,"bitRate"); + MP_KVS_REGFNC(sampleRate,"sampleRate"); + MP_KVS_REGFNC(length,"length"); + MP_KVS_REGFNC(position,"position"); + MP_KVS_REGFNC(status,"status"); + MP_KVS_REGFNC(player,"player"); + MP_KVS_REGFNC(playerList,"playerList"); + MP_KVS_REGFNC(localFile,"localFile"); + MP_KVS_REGFNC(channels,"channels"); + MP_KVS_REGFNC(getListLength,"getListLength"); + MP_KVS_REGFNC(getPlayListPos,"getPlayListPos"); + MP_KVS_REGFNC(getEqData,"getEqData"); + MP_KVS_REGFNC(getRepeat,"getRepeat"); + MP_KVS_REGFNC(getShuffle,"getShuffle"); + MP_KVS_REGFNC(getVol,"getVol"); + +*/ +/* + // Crissi + m->registerFunction( "getmp3tag_date", mediaplayer_fnc_getmp3tag_date ); + m->registerFunction( "getmp3tag_version", mediaplayer_fnc_getmp3tag_version ); + m->registerFunction( "getmp3tag_layer", mediaplayer_fnc_getmp3tag_layer ); + m->registerFunction( "getmp3tag_crc", mediaplayer_fnc_getmp3tag_crc ); + m->registerFunction( "getmp3tag_copyright", mediaplayer_fnc_getmp3tag_copyright ); + m->registerFunction( "getmp3tag_original", mediaplayer_fnc_getmp3tag_original ); + m->registerFunction( "getmp3tag_emphasis", mediaplayer_fnc_getmp3tag_emphasis ); + m->registerFunction( "getmp3tag_tracknumber", mediaplayer_fnc_getmp3tag_tracknumber ); +*/ + return true; +} + +static bool torrent_module_cleanup( KviModule * m ) +{ + delete g_pDescriptorList; + return true; +} + +static bool torrent_module_can_unload( KviModule * m ) +{ + return true; +} + +static bool torrent_module_ctrl(KviModule * m,const char * operation,void * param) +{ +/* if(kvi_strEqualCI(operation,"getAvailableMediaPlayers")) + { + // we expect param to be a pointer to QStringList + QStringList * l = (QStringList *)param; + for(KviMediaPlayerInterfaceDescriptor * d = g_pDescriptorList->first();d;d = g_pDescriptorList->next()) + { + l->append(d->name()); + } + return true; + } + if(kvi_strEqualCI(operation,"detectMediaPlayer")) + { + auto_detect_player(0); + return true; + } +*/ + return false; +} + + + +KVIRC_MODULE( + "torrent", + "1.0.0", + "Copyright (C) 2007 Alexander Stillich (torque at pltn dot org)", + "Interface to various torrent clients", + torrent_module_init, + torrent_module_can_unload, + torrent_module_ctrl, + torrent_module_cleanup +) diff --git a/src/modules/torrent/tc_interface.cpp b/src/modules/torrent/tc_interface.cpp new file mode 100644 index 000000000..b035a66ba --- /dev/null +++ b/src/modules/torrent/tc_interface.cpp @@ -0,0 +1,30 @@ +//============================================================================= +// +// Common interface for BitTorrent clients. +// +// File : tc_interface.cpp +// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2007 Alexander Stillich (torque at pltn dot org) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "tc_interface.h" +#include "kvi_locale.h" + diff --git a/src/modules/torrent/tc_interface.h b/src/modules/torrent/tc_interface.h new file mode 100644 index 000000000..ecf586b60 --- /dev/null +++ b/src/modules/torrent/tc_interface.h @@ -0,0 +1,160 @@ +#ifndef _TC_INTERFACE_H_ +#define _TC_INTERFACE_H_ + +//============================================================================= +// +// Common interface for BitTorrent clients. +// +// File : tc_interface.h +// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2007 Alexander Stillich (torque at pltn dot org) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "kvi_settings.h" +#include "kvi_qstring.h" +#include <qobject.h> + +class KviTorrentInterface : public QObject +{ + +public: + + KviTorrentInterface() {} + virtual ~KviTorrentInterface() {} + + virtual int detect() = 0; + + // returns number of torrents in client + virtual int count()=0; + +/* + // path of torrent file + virtual QCString getTorrentFile(int i)=0; + + // directory where data is downloaded to + virtual QCString getTorrentDataDir(int i)=0; + + // number of files in torrent + virtual QCString getTorrentFileCount(int i)=0; + // name of file in torrent + virtual QCString getTorrentFileName(int i)=0; + virtual int getTorrentFilePriority(int i)=0; + virtual void setTorrentFilePriority(int i, int prio)=0; +*/ + virtual bool start(int i)=0; + virtual bool stop(int i)=0; + + virtual bool announce(int i)=0; + + virtual bool startAll()=0; + virtual bool stopAll()=0; +/* + // manual announce to tracker + virtual bool announceTorrent(int i)=0; + // remove torrent from client + virtual bool removeTorrent(int i)=0; + + virtual bool addTorrent(const QCString &mrl); +*/ + // returns state of torrent number i (Stopped, Stalled, Seeding, Downloading) + // this uses getTorrentInfo() to obtain the state and then + // returns it as string + virtual QString state(int i)=0; + + // name of torrent as displayed in client + // uses getTorrentInfo() + virtual QString name(int i)=0; + + virtual float speedUp()=0; + virtual float speedDown()=0; + + virtual float trafficUp()=0; + virtual float trafficDown()=0; + + virtual int maxUploadSpeed()=0; + virtual int maxDownloadSpeed()=0; + + virtual bool setMaxUploadSpeed(int kbytes_per_sec)=0; + virtual bool setMaxDownloadSpeed(int kbytes_per_sec)=0; + + QString lastError() { return m_lastError; } + +protected: + + QString m_lastError; + +}; + +class KviTorrentInterfaceDescriptor +{ +public: + KviTorrentInterfaceDescriptor() {}; + virtual ~KviTorrentInterfaceDescriptor() {}; +public: + virtual const QString & name() = 0; + virtual const QString & description() = 0; + virtual KviTorrentInterface * instance() = 0; +}; + +#define TORR_DECLARE_DESCRIPTOR(_interfaceclass) \ + class _interfaceclass ## Descriptor : public KviTorrentInterfaceDescriptor \ + { \ + public: \ + _interfaceclass ## Descriptor(); \ + virtual ~_interfaceclass ## Descriptor(); \ + protected: \ + _interfaceclass * m_pInstance; \ + QString m_szName; \ + QString m_szDescription; \ + public: \ + virtual const QString & name(); \ + virtual const QString & description(); \ + virtual KviTorrentInterface * instance(); \ + }; + +#define TORR_IMPLEMENT_DESCRIPTOR(_interfaceclass,_name,_description) \ + _interfaceclass ## Descriptor::_interfaceclass ## Descriptor() \ + : KviTorrentInterfaceDescriptor() \ + { \ + m_pInstance = 0; \ + m_szName = _name; \ + m_szDescription = _description; \ + } \ + _interfaceclass ## Descriptor::~_interfaceclass ## Descriptor() \ + { \ + delete m_pInstance; \ + } \ + const QString & _interfaceclass ## Descriptor::name() \ + { \ + return m_szName; \ + } \ + const QString & _interfaceclass ## Descriptor::description() \ + { \ + return m_szDescription; \ + } \ + KviTorrentInterface * _interfaceclass ## Descriptor::instance() \ + { \ + if (!m_pInstance) m_pInstance = new _interfaceclass(); \ + return m_pInstance; \ + } + +#endif // _TC_INTERFACE_H_ + diff --git a/src/modules/torrent/tc_ktorrentdcopinterface.cpp b/src/modules/torrent/tc_ktorrentdcopinterface.cpp new file mode 100644 index 000000000..a76e3baa6 --- /dev/null +++ b/src/modules/torrent/tc_ktorrentdcopinterface.cpp @@ -0,0 +1,508 @@ +//============================================================================= +// +// Common interface for BitTorrent clients. +// +// File : torr_ktorrentdcopinterface.cpp +// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2007 Alexander Stillich (torque at pltn dot org) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "kvi_app.h" +#include "dcopclient.h" + +#include "tc_ktorrentdcopinterface.h" + +#ifdef COMPILE_KDE_SUPPORT + +#include "kvi_locale.h" +#include <qtimer.h> + +TORR_IMPLEMENT_DESCRIPTOR( + KviKTorrentDCOPInterface, + "ktorrentdcop", + __tr2qs_ctx( + "An interface to KDE's excellent KTorrent client.\n" \ + "Download it from http://www.ktorrent.org\n", + "torrent" + ) +) + +#define ERROR_MSG \ + QCString msg; \ + if (!findRunningApp(m_szAppId)) \ + msg = "KTorrent's isn't running!"; \ + else \ + msg = "Something's wrong here! KTorrent's DCOP interface has probably changed."; \ + m_lastError = __tr2qs_ctx(QString(msg), "torrent"); \ + debug("%s (%s:%d): %s", __PRETTY_FUNCTION__, __FILE__, __LINE__, (const char*)msg); \ + +#define ERROR_MSG_RANGE \ + KviQString::sprintf(m_lastError, __tr2qs_ctx("Index out of range: %d [0-%d]!", "torrent"), i, (m_ti.size()>0)?(m_ti.size()-1):0); \ + debug("%s (%s:%d): Index out of range: %d [0-%d]!", __PRETTY_FUNCTION__ , __FILE__, __LINE__, i, (m_ti.size()>0)?(m_ti.size()-1):0); + +#define ERROR_RET_BOOL \ + { \ + ERROR_MSG \ + return false; \ + } + +#define ERROR_RET_NUM \ + { \ + ERROR_MSG \ + return -1; \ + } + +// TODO: unused? +#define ERROR_RET_STRING \ + { \ + ERROR_MSG \ + return ""; \ + } + +#define ERROR_RET_VOID \ + { \ + ERROR_MSG \ + return; \ + } + +#define CHECK_RANGE_BOOL \ + if (i<0 || i>=m_ti.size()) \ + { \ + ERROR_MSG_RANGE \ + return false; \ + } + +#define CHECK_RANGE_STRING \ + if (i<0 || i>=m_ti.size()) \ + { \ + ERROR_MSG_RANGE \ + return ""; \ + } + + +KviKTorrentDCOPInterface::KviKTorrentDCOPInterface() + : KviDCOPHelper(false, "ktorrent") +{ + printf("KviKTorrentDCOPInterface\n"); + + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(slotTimer())); + timer->start(250, FALSE); +} + +KviKTorrentDCOPInterface::~KviKTorrentDCOPInterface() +{ + printf("~KviKTorrentDCOPInterface\n"); +} + +void KviKTorrentDCOPInterface::slotTimer() +{ + if (!findRunningApp(m_szAppId)) + return; +// debug("timer"); + + m_ti.clear(); + + KviValueList<int> ret; + if (!qvalueListIntRetIntDCOPCall("KTorrent", "getTorrentNumbers(int)", ret, 0)) + ERROR_RET_VOID + + for (int i=0; i<ret.size(); i++) + { + KviQCStringList info; + if (!qcstringListRetIntDCOPCall("KTorrent", "getTorrentInfo(int)", info, ret[i])) + ERROR_RET_VOID + + if (info.size() == 0) + continue; + +// debug("i: %d, %d, %s %s", i, info.size(), (const char *)info[0], (const char*)info[1]); + + TorrentInfo item; + if (!makeTorrentInfo(item, info)) + return; +// item.ti.name.sprintf("%s [%d]", (const char*)info[0], ret[i]); + item.num = ret[i]; + m_ti.append(item); + } + + qHeapSort(m_ti); + + +/* for (int i=0; i<m_ti.size(); i++) + { + debug("sorted: %s", (const char *)m_ti[i].name); + } +*/ +} + +int KviKTorrentDCOPInterface::detect() +{ + if (!findRunningApp(m_szAppId)) + return 0; +/* + ClientInfo ci; + if (getClientInfo(ci)) + { + debug("tup: %f, tdown: %f\n" + "sup: %f, sdown: %f\n", + ci.transferredUp, ci.transferredDown, + ci.speedUp, ci.speedDown); + } else + { + debug("error\n"); + } + + TorrentInfo ti; + if (getTorrentInfo(0, ti)) + { + debug("name: %s\n" + "state: %d\n" + "size: %f\n" + "tup: %f\n" + "tdown: %f\n" + "sup: %f\n" + "sdown: %f\n" + "perc: %f\n" + "peers: %d\n", + (const char *)ti.name, + ti.state, + ti.size, + ti.transferredUp, + ti.transferredDown, + ti.speedUp, + ti.speedDown, + ti.percent, + ti.peers); + } else + { + debug("error\n"); + } +*/ + + return 100; +} + +bool makeSize(float &sz, const QString &s, const QString &u) +{ + bool ok; + sz = s.toFloat(&ok); + if (!ok) + return false; + + if (u == "B") + ; + else + if (u == "KB") + sz = sz * 1024.0; + else + if (u == "MB") + sz = sz * 1024.0 * 1024.0; + else + if (u == "GB") + sz = sz * 1024.0 * 1024.0 * 1024.0; + else + return false; + + return true; +} + +/*bool KviKTorrentDCOPInterface::getClientInfo(ClientInfo &ci) +{ + KviQCStringList ret; + if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) + ERROR_RET_BOOL + + bool ok; + QStringList tmp; + + tmp = QStringList::split(" ", ret[1]); + if (tmp.size() != 8) + ERROR_RET_BOOL + + if (!makeSize(ci.trafficDown, tmp[2], tmp[3])) + ERROR_RET_BOOL + if (!makeSize(ci.trafficUp, tmp[6], tmp[7])) + ERROR_RET_BOOL + + tmp = QStringList::split(" ", ret[2]); + if (tmp.size() != 8) + ERROR_RET_BOOL + + ci.speedDown = tmp[2].toFloat(&ok); + if (!ok) + ERROR_RET_BOOL + ci.speedUp = tmp[6].toFloat(&ok); + if (!ok) + ERROR_RET_BOOL + + return true; +} + +/* +bool KviKTorrentDCOPInterface::getTorrentInfo(int i, TorrentInfo &ti) +{ + CHECK_RANGE + + ti = m_ti[i]; + return true; +} +*/ + +bool KviKTorrentDCOPInterface::start(int i) +{ + CHECK_RANGE_BOOL + + debug("starting %s [%d]", (const char*)m_ti[i].name, m_ti[i].num); + if (!voidRetIntDCOPCall("KTorrent", "start(int)", m_ti[i].num)) + ERROR_RET_BOOL + + return true; +} + +bool KviKTorrentDCOPInterface::stop(int i) +{ + CHECK_RANGE_BOOL + + debug("stopping %s [%d]", (const char*)m_ti[i].name, m_ti[i].num); + if (!voidRetIntBoolDCOPCall("KTorrent", "stop(int, bool)", m_ti[i].num, true)) + ERROR_RET_BOOL + + return true; +} + +bool KviKTorrentDCOPInterface::announce(int i) +{ + CHECK_RANGE_BOOL + + debug("announcing %s [%d]", (const char*)m_ti[i].name, m_ti[i].num); + if (!voidRetIntDCOPCall("KTorrent", "announce(int)", m_ti[i].num)) + ERROR_RET_BOOL + return true; +} + +QString KviKTorrentDCOPInterface::state(int i) +{ + CHECK_RANGE_STRING + + return m_ti[i].state; +} + +QString KviKTorrentDCOPInterface::name(int i) +{ + CHECK_RANGE_STRING + + return m_ti[i].name; +} + +bool KviKTorrentDCOPInterface::startAll() +{ + if (!voidRetIntDCOPCall("KTorrent", "startAll(int)", 3)) + ERROR_RET_BOOL + + return true; +} + +bool KviKTorrentDCOPInterface::stopAll() +{ + if (!voidRetIntDCOPCall("KTorrent", "stopAll(int)", 3)) + ERROR_RET_BOOL + + return true; +} + +int KviKTorrentDCOPInterface::count() +{ + return m_ti.size(); +} + +float KviKTorrentDCOPInterface::speedUp() +{ + KviQCStringList ret; + if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) + ERROR_RET_NUM + + QStringList tmp = QStringList::split(" ", ret[2]); + if (tmp.size() != 8) + ERROR_RET_NUM + + bool ok; + float f = tmp[6].toFloat(&ok); + if (!ok) + ERROR_RET_NUM + + return f; +} + +float KviKTorrentDCOPInterface::speedDown() +{ + KviQCStringList ret; + if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) + ERROR_RET_NUM + + QStringList tmp = QStringList::split(" ", ret[2]); + if (tmp.size() != 8) + ERROR_RET_NUM + + bool ok; + float f = tmp[2].toFloat(&ok); + if (!ok) + ERROR_RET_NUM + + return f; +} + +float KviKTorrentDCOPInterface::trafficUp() +{ + KviQCStringList ret; + if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) + ERROR_RET_NUM + + QStringList tmp = QStringList::split(" ", ret[1]); + if (tmp.size() != 8) + ERROR_RET_NUM + + float f; + if (!makeSize(f, tmp[6], tmp[7])) + ERROR_RET_NUM + + return f; +} + +float KviKTorrentDCOPInterface::trafficDown() +{ + KviQCStringList ret; + if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret)) + ERROR_RET_NUM + + QStringList tmp = QStringList::split(" ", ret[1]); + if (tmp.size() != 8) + ERROR_RET_NUM + + float f; + if (!makeSize(f, tmp[2], tmp[3])) + ERROR_RET_NUM + + return f; +} + +bool KviKTorrentDCOPInterface::makeTorrentInfo(TorrentInfo &ti, const KviQCStringList &ret) +{ + if (ret.size() != 10) + ERROR_RET_BOOL + + ti.name = ret[0]; + if (ret[1] == "Seeding") + ti.state = "Seeding"; + else + if (ret[1] == "Stalled") + ti.state = "Stalled"; + else + if (ret[1] == "Downloading") + ti.state = "Downloading"; + else + ti.state = "Stopped"; + + + QStringList tmp; + tmp = QStringList::split(" ", ret[2]); + if (tmp.size()!=2 || !makeSize(ti.trafficDown, tmp[0], tmp[1])) + ERROR_RET_BOOL + + tmp = QStringList::split(" ", ret[3]); + if (tmp.size()!=2 || !makeSize(ti.size, tmp[0], tmp[1])) + ERROR_RET_BOOL + + tmp = QStringList::split(" ", ret[4]); + if (tmp.size()!=2 || !makeSize(ti.trafficUp, tmp[0], tmp[1])) + ERROR_RET_BOOL + + + bool ok; + tmp = QStringList::split(" ", ret[5]); + if (tmp.size()!=2) + ERROR_RET_BOOL + ti.speedDown = tmp[0].toFloat(&ok); + if (!ok) + ERROR_RET_BOOL + + tmp = QStringList::split(" ", ret[6]); + if (tmp.size()!=2) + ERROR_RET_BOOL + ti.speedUp = tmp[0].toFloat(&ok); + if (!ok) + ERROR_RET_BOOL + + + // torrent name, status, downloaded, size, uploaded, down spd, up spd, none, peers, % complete + ti.peers = ret[8].toInt(&ok); + if (!ok) + ERROR_RET_BOOL + + tmp = QStringList::split(" ", ret[9]); + if (tmp.size()!=2) + ERROR_RET_BOOL + ti.percent = tmp[0].toFloat(&ok); + if (!ok) + ERROR_RET_BOOL + + return true; +} + +int KviKTorrentDCOPInterface::maxUploadSpeed() +{ + int ret; + if (!intRetVoidDCOPCall("KTorrent", "maxUploadRate()", ret)) + { + ERROR_MSG + return -1; + } + return ret; +} + +int KviKTorrentDCOPInterface::maxDownloadSpeed() +{ + int ret; + if (!intRetVoidDCOPCall("KTorrent", "maxDownloadRate()", ret)) + { + ERROR_MSG + return -1; + } + return ret; +} + +bool KviKTorrentDCOPInterface::setMaxUploadSpeed(int kbytes_per_sec) +{ + if (!voidRetIntDCOPCall("KTorrent", "setMaxUploadSpeed(int)", kbytes_per_sec)) + ERROR_RET_BOOL + return true; +} + +bool KviKTorrentDCOPInterface::setMaxDownloadSpeed(int kbytes_per_sec) +{ + if (!voidRetIntDCOPCall("KTorrent", "setMaxDownloadSpeed(int)", kbytes_per_sec)) + ERROR_RET_BOOL + return true; +} + +#endif // COMPILE_KDE_SUPPORT + +#include "tc_ktorrentdcopinterface.moc" diff --git a/src/modules/torrent/tc_ktorrentdcopinterface.h b/src/modules/torrent/tc_ktorrentdcopinterface.h new file mode 100644 index 000000000..d752fcfea --- /dev/null +++ b/src/modules/torrent/tc_ktorrentdcopinterface.h @@ -0,0 +1,126 @@ +#ifndef _TC_KTORRENTDCOPINTERFACE_H_ +#define _TC_KTORRENTDCOPINTERFACE_H_ + +//============================================================================= +// +// DCOP interface for KTorrent client. +// +// File : torr_ktorrentdcopinterface.h +// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2007 Alexander Stillich (torque at pltn dot org) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + + +#include "tc_interface.h" + +#ifdef COMPILE_KDE_SUPPORT + +#include <kvi_dcophelper.h> + +// DCOP interface to KTorrent. this has 'DCOP' in its name +// because in kde4 there will be a D-BUS interface. +class KviKTorrentDCOPInterface : public KviTorrentInterface, + private KviDCOPHelper +{ + Q_OBJECT + +public: + + KviKTorrentDCOPInterface(); + virtual ~KviKTorrentDCOPInterface(); + + virtual int detect(); + + virtual int count(); + + virtual bool start(int i); + virtual bool stop(int i); + virtual bool announce(int i); + virtual QString state(int i); + virtual QString name(int i); + + virtual bool startAll(); + virtual bool stopAll(); + + virtual int maxUploadSpeed(); + virtual int maxDownloadSpeed(); + + virtual bool setMaxUploadSpeed(int kbytes_per_sec); + virtual bool setMaxDownloadSpeed(int kbytes_per_sec); + + virtual float speedUp(); + virtual float speedDown(); + + virtual float trafficUp(); + virtual float trafficDown(); + +private slots: + + // polls client and extracts information. + // this is done because the order of torrents returned changes + // each time a torrent's state changes. + // we want to present a consistent list (in terms of indices) to + // the user, so we extract the info and sort it by name. + // otherwise the user would have a hard time figuring out what's + // going on. we could sort each time a function working with + // torrents is called, but this would be horribly slow ... + void slotTimer(); + +private: + + struct TorrentInfo + { + // internal number + int num; + // name displayed in ktorrent + QString name; + // state of torrent + QString state; + // bytes + float size; + // bytes + float trafficUp; + // bytes + float trafficDown; + // KB/s + float speedUp; + // KB/s + float speedDown; + // percent complete + float percent; + // number of peers + int peers; + + bool operator<(const TorrentInfo &ti) { return name < ti.name; } + }; + + QValueList<TorrentInfo> m_ti; + +private: + + bool makeTorrentInfo(TorrentInfo &ti, const KviQCStringList &ret); +}; + +TORR_DECLARE_DESCRIPTOR(KviKTorrentDCOPInterface) + +#endif // COMPILE_KDE_SUPPORT + +#endif // _TC_KTORRENTDCOPINTERFACE_H_ diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index 32ca7759d..9cff780f8 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -110,7 +110,7 @@ UrlDialog::UrlDialog(KviPtrList<KviUrl> *g_pList) :KviWindow(KVI_WINDOW_TYPE_TOOL,g_pFrame,"URL List") { m_pMenuBar = new KviTalMenuBar(this,"url menu"); - m_pUrlList = new QListView(this,"list"); + m_pUrlList = new KviTalListView(this); //m_pUrlList = new KviListView(this,"list"); KviConfig cfg(szConfigPath.ptr(),KviConfig::Read); @@ -140,8 +140,8 @@ UrlDialog::UrlDialog(KviPtrList<KviUrl> *g_pList) m_pUrlList->setColumnWidth(2,cfg.readIntEntry("Count",70)); m_pUrlList->setColumnWidth(3,cfg.readIntEntry("Timestamp",70)); - connect(m_pUrlList,SIGNAL(doubleClicked(QListViewItem *)),SLOT(dblclk_url(QListViewItem *))); - connect(m_pUrlList,SIGNAL(rightButtonPressed(QListViewItem *, const QPoint &, int)),SLOT(popup(QListViewItem *, const QPoint &, int))); + connect(m_pUrlList,SIGNAL(doubleClicked(KviTalListViewItem *)),SLOT(dblclk_url(KviTalListViewItem *))); + connect(m_pUrlList,SIGNAL(rightButtonPressed(KviTalListViewItem *, const QPoint &, int)),SLOT(popup(KviTalListViewItem *, const QPoint &, int))); // setFocusHandlerNoChildren(m_pUrlList); m_pUrlList->setFocusPolicy(QWidget::StrongFocus); @@ -245,14 +245,14 @@ void UrlDialog::findtext() */ } -void UrlDialog::dblclk_url(QListViewItem *item) +void UrlDialog::dblclk_url(KviTalListViewItem *item) { QString cmd="openurl "; cmd.append(item->text(0)); KviKvsScript::run(cmd,this); } -void UrlDialog::popup(QListViewItem *item, const QPoint &point, int col) +void UrlDialog::popup(KviTalListViewItem *item, const QPoint &point, int col) { if (col == 0) { m_szUrl = item->text(0); @@ -295,7 +295,7 @@ QPixmap *UrlDialog::myIconPtr() void UrlDialog::addUrl(QString url, QString window, QString count, QString timestamp) { - QListViewItem *UrlItem = new QListViewItem(m_pUrlList); + KviTalListViewItem *UrlItem = new KviTalListViewItem(m_pUrlList); UrlItem->setText(0, url); UrlItem->setText(1, window); @@ -417,7 +417,7 @@ BanFrame::BanFrame(QWidget *parent, const char *name, bool banEnabled) m_pEnable->setChecked(banEnabled); g->addMultiCellWidget(m_pEnable,0,0,0,1); - m_pBanList = new QListBox(this,"listbox"); + m_pBanList = new KviTalListBox(this); m_pBanList->setMinimumHeight(100); loadBanList(); for(KviStr *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) m_pBanList->insertItem(tmp->ptr()); // load ban list into listbox @@ -705,7 +705,7 @@ int check_url(KviWindow *w,const QString &szUrl) // return 0 if no occurence of for (UrlDlgList *tmpitem=g_pUrlDlgList->first();tmpitem;tmpitem=g_pUrlDlgList->next()) { if (tmpitem->dlg) { - QListViewItemIterator lvi(tmpitem->dlg->m_pUrlList); + KviTalListViewItemIterator lvi(tmpitem->dlg->m_pUrlList); for(;lvi.current();++lvi) { if (lvi.current()->text(0) == szUrl) { diff --git a/src/modules/url/libkviurl.h b/src/modules/url/libkviurl.h index 56d635084..80e39697c 100644 --- a/src/modules/url/libkviurl.h +++ b/src/modules/url/libkviurl.h @@ -23,13 +23,13 @@ #include <qdialog.h> #include <qlayout.h> -#include <qlistview.h> +#include "kvi_tal_listview.h" #include <qstring.h> #include <qpushbutton.h> #include <qfile.h> #include <qtextstream.h> #include <qcheckbox.h> -#include <qlistbox.h> +#include "kvi_tal_listbox.h" #include <qmenubar.h> #include <qinputdialog.h> #include <qtoolbutton.h> @@ -69,7 +69,7 @@ protected: QPixmap *myIconPtr(); void resizeEvent(QResizeEvent *); public: - QListView *m_pUrlList; + KviTalListView *m_pUrlList; void addUrl(QString url, QString window, QString count, QString timestamp); // void saveProperties(); protected slots: @@ -81,8 +81,8 @@ protected slots: void close_slot(); void remove(); void findtext(); - void dblclk_url(QListViewItem *item); - void popup(QListViewItem *item, const QPoint &p, int col); + void dblclk_url(KviTalListViewItem *item); + void popup(KviTalListViewItem *item, const QPoint &p, int col); void sayToWin(int); }; @@ -95,7 +95,7 @@ public: void saveBans(); private: KviStyledCheckBox *m_pEnable; - QListBox *m_pBanList; + KviTalListBox *m_pBanList; QPushButton *m_pAddBtn; QPushButton *m_pRemoveBtn; protected slots: |
