summaryrefslogtreecommitdiffstats
path: root/kexi/widget/pixmapcollection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/widget/pixmapcollection.cpp')
-rw-r--r--kexi/widget/pixmapcollection.cpp224
1 files changed, 112 insertions, 112 deletions
diff --git a/kexi/widget/pixmapcollection.cpp b/kexi/widget/pixmapcollection.cpp
index 7f9718d6..fbcf91de 100644
--- a/kexi/widget/pixmapcollection.cpp
+++ b/kexi/widget/pixmapcollection.cpp
@@ -17,12 +17,12 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qpixmap.h>
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qstringlist.h>
-#include <qtoolbutton.h>
-#include <qdom.h>
+#include <tqpixmap.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqstringlist.h>
+#include <tqtoolbutton.h>
+#include <tqdom.h>
#include <kapplication.h>
#include <kiconloader.h>
@@ -40,61 +40,61 @@
#include "pixmapcollection.h"
/// Pixmap Collection
-PixmapCollection::PixmapCollection(const QString &collectionName, QObject *parent, const char *name)
- : QObject(parent, name)
+PixmapCollection::PixmapCollection(const TQString &collectionName, TQObject *tqparent, const char *name)
+ : TQObject(tqparent, name)
{
m_name = collectionName;
}
-QString
+TQString
PixmapCollection::addPixmapPath(const KURL &url)
{
- QString name = url.filename();
- while(m_pixmaps.contains(name))
+ TQString name = url.filename();
+ while(m_pixmaps.tqcontains(name))
{
bool ok;
int num = name.right(1).toInt(&ok, 10);
if(ok)
- name = name.left(name.length()-1) + QString::number(num+1);
+ name = name.left(name.length()-1) + TQString::number(num+1);
else
name += "2";
}
- m_pixmaps.insert(name, qMakePair(url.path(), 0));
+ m_pixmaps.insert(name, tqMakePair(url.path(), 0));
return name;
}
-QString
-PixmapCollection::addPixmapName(const QString &icon, int size)
+TQString
+PixmapCollection::addPixmapName(const TQString &icon, int size)
{
- QString name = icon;
- while(m_pixmaps.contains(name))
+ TQString name = icon;
+ while(m_pixmaps.tqcontains(name))
{
bool ok;
int num = name.right(1).toInt(&ok, 10);
if(ok)
- name = name.left(name.length()-1) + QString::number(num+1);
+ name = name.left(name.length()-1) + TQString::number(num+1);
else
name += "2";
}
- m_pixmaps.insert(name, qMakePair(icon, size));
+ m_pixmaps.insert(name, tqMakePair(icon, size));
return name;
}
void
-PixmapCollection::removePixmap(const QString &name)
+PixmapCollection::removePixmap(const TQString &name)
{
m_pixmaps.remove(name);
}
-QPixmap
-PixmapCollection::getPixmap(const QString &name)
+TQPixmap
+PixmapCollection::getPixmap(const TQString &name)
{
- if(!m_pixmaps.contains(name))
+ if(!m_pixmaps.tqcontains(name))
{
kdDebug() << " The icon " << name << " you requested is not in the collection" << endl;
- return QPixmap();
+ return TQPixmap();
}
if(m_pixmaps[name].second != 0)
@@ -102,81 +102,81 @@ PixmapCollection::getPixmap(const QString &name)
return kapp->iconLoader()->loadIcon(m_pixmaps[name].first, KIcon::NoGroup, m_pixmaps[name].second);
}
else
- return QPixmap(m_pixmaps[name].first);
+ return TQPixmap(m_pixmaps[name].first);
}
bool
-PixmapCollection::contains(const QString &name)
+PixmapCollection::tqcontains(const TQString &name)
{
- return m_pixmaps.contains(name);
+ return m_pixmaps.tqcontains(name);
}
void
-PixmapCollection::save(QDomNode parentNode)
+PixmapCollection::save(TQDomNode tqparentNode)
{
if(m_pixmaps.isEmpty())
return;
- QDomDocument domDoc = parentNode.ownerDocument();
- QDomElement collection = domDoc.createElement("collection");
- parentNode.appendChild(collection);
+ TQDomDocument domDoc = tqparentNode.ownerDocument();
+ TQDomElement collection = domDoc.createElement("collection");
+ tqparentNode.appendChild(collection);
PixmapMap::ConstIterator it;
PixmapMap::ConstIterator endIt = m_pixmaps.constEnd();
for(it = m_pixmaps.constBegin(); it != endIt; ++it)
{
- QDomElement item = domDoc.createElement("pixmap");
+ TQDomElement item = domDoc.createElement("pixmap");
collection.appendChild(item);
item.setAttribute("name", it.key());
if(it.data().second != 0)
- item.setAttribute("size", QString::number(it.data().second));
+ item.setAttribute("size", TQString::number(it.data().second));
- QString text = it.data().first;
- QDomText textNode = domDoc.createTextNode(text);
+ TQString text = it.data().first;
+ TQDomText textNode = domDoc.createTextNode(text);
item.appendChild(textNode);
}
}
void
-PixmapCollection::load(QDomNode node)
+PixmapCollection::load(TQDomNode node)
{
- QDomDocument domDoc = node.ownerDocument();
- for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
+ TQDomDocument domDoc = node.ownerDocument();
+ for(TQDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
{
- QDomElement el = n.toElement();
- QPair<QString, int> pair = qMakePair(el.text(), el.attribute("size").toInt());
+ TQDomElement el = n.toElement();
+ TQPair<TQString, int> pair = tqMakePair(el.text(), el.attribute("size").toInt());
m_pixmaps[el.attribute("name")] = pair;
}
}
//// A dialog to load a KDE icon by its name
-LoadIconDialog::LoadIconDialog(QWidget *parent)
-: KDialogBase(parent, "loadicon_dialog", true, i18n("Load KDE Icon by Name"), Ok|Cancel, Ok, false)
+LoadIconDialog::LoadIconDialog(TQWidget *tqparent)
+: KDialogBase(tqparent, "loadicon_dialog", true, i18n("Load KDE Icon by Name"), Ok|Cancel, Ok, false)
{
- QFrame *frame = makeMainWidget();
- QGridLayout *l = new QGridLayout(frame, 2, 3, 0, 6);
+ TQFrame *frame = makeMainWidget();
+ TQGridLayout *l = new TQGridLayout(frame, 2, 3, 0, 6);
// Name input
- QLabel *name = new QLabel(i18n("&Name:"), frame);
+ TQLabel *name = new TQLabel(i18n("&Name:"), frame);
l->addWidget(name, 0, 0);
- name->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ name->tqsetAlignment(TQt::AlignRight|TQt::AlignVCenter);
m_nameInput = new KLineEdit("kexi", frame);
l->addWidget(m_nameInput, 0, 1);
name->setBuddy(m_nameInput);
// Choose size
- QLabel *size = new QLabel(i18n("&Size:"), frame);
+ TQLabel *size = new TQLabel(i18n("&Size:"), frame);
l->addWidget(size, 1, 0);
- size->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ size->tqsetAlignment(TQt::AlignRight|TQt::AlignVCenter);
KComboBox *combo = new KComboBox(frame);
l->addWidget(combo, 1, 1);
size->setBuddy(combo);
- QStringList list;
+ TQStringList list;
list << i18n("Small") << i18n("Medium") << i18n("Large") << i18n("Huge");
combo->insertStringList(list);
combo->setCurrentItem(2);
- connect(combo, SIGNAL(activated(int)), this, SLOT(changeIconSize(int)));
+ connect(combo, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeIconSize(int)));
// Icon chooser button
@@ -184,18 +184,18 @@ LoadIconDialog::LoadIconDialog(QWidget *parent)
m_button->setIcon("kexi");
m_button->setIconSize(KIcon::SizeMedium);
l->addMultiCellWidget(m_button, 0, 1, 2, 2);
- connect(m_button, SIGNAL(iconChanged(QString)), this, SLOT(updateIconName(QString)));
- connect(m_nameInput, SIGNAL(textChanged(const QString &)), this, SLOT(setIcon(const QString &)));
+ connect(m_button, TQT_SIGNAL(iconChanged(TQString)), this, TQT_SLOT(updateIconName(TQString)));
+ connect(m_nameInput, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(setIcon(const TQString &)));
}
void
-LoadIconDialog::updateIconName(QString icon)
+LoadIconDialog::updateIconName(TQString icon)
{
m_nameInput->setText(icon);
}
void
-LoadIconDialog::setIcon(const QString &icon)
+LoadIconDialog::setIcon(const TQString &icon)
{
m_button->setIcon(icon);
}
@@ -210,7 +210,7 @@ LoadIconDialog::changeIconSize(int index)
//case 1: size = KIcon::SizeSmallMedium; break;
case 1: size = KIcon::SizeMedium; break;
case 2: size = KIcon::SizeLarge; break;
-#if !defined(Q_WS_WIN) && KDE_IS_VERSION(3,1,9)
+#if !defined(TQ_WS_WIN) && KDE_IS_VERSION(3,1,9)
case 3: size = KIcon::SizeHuge; break;
#endif
default:;
@@ -224,54 +224,54 @@ int LoadIconDialog::iconSize()
return m_button->iconSize();
}
-QString LoadIconDialog::iconName()
+TQString LoadIconDialog::iconName()
{
return m_button->icon();
}
/// Pixmap Collection Editor Dialog
-PixmapCollectionEditor::PixmapCollectionEditor(PixmapCollection *collection, QWidget *parent)
-: KDialogBase(parent, "pixcollection_dialog", true,
- i18n("Edit Pixmap Collection: %1").arg(collection->collectionName()), Close, Close, false)
+PixmapCollectionEditor::PixmapCollectionEditor(PixmapCollection *collection, TQWidget *tqparent)
+: KDialogBase(tqparent, "pixcollection_dialog", true,
+ i18n("Edit Pixmap Collection: %1").tqarg(collection->collectionName()), Close, Close, false)
{
m_collection = collection;
- QFrame *frame = makeMainWidget();
- QHBoxLayout *l = new QHBoxLayout(frame, 0, 6);
- setInitialSize(QSize(400, 200), true);
+ TQFrame *frame = makeMainWidget();
+ TQHBoxLayout *l = new TQHBoxLayout(frame, 0, 6);
+ setInitialSize(TQSize(400, 200), true);
//// Setup the icon toolbar /////////////////
- QVBoxLayout *vlayout = new QVBoxLayout(l, 3);
- QToolButton *newItemPath = new QToolButton(frame);
+ TQVBoxLayout *vtqlayout = new TQVBoxLayout(l, 3);
+ TQToolButton *newItemPath = new TQToolButton(frame);
newItemPath->setIconSet(BarIconSet("fileopen"));
newItemPath->setTextLabel(i18n("&Add File"), true);
- vlayout->addWidget(newItemPath);
+ vtqlayout->addWidget(newItemPath);
m_buttons.insert(BNewItemPath, newItemPath);
- connect(newItemPath, SIGNAL(clicked()), this, SLOT(newItemByPath()));
+ connect(newItemPath, TQT_SIGNAL(clicked()), this, TQT_SLOT(newItemByPath()));
- QToolButton *newItemName = new QToolButton(frame);
+ TQToolButton *newItemName = new TQToolButton(frame);
newItemName->setIconSet(BarIconSet("icons"));
newItemName->setTextLabel(i18n("&Add an Icon"), true);
- vlayout->addWidget(newItemName);
+ vtqlayout->addWidget(newItemName);
m_buttons.insert(BNewItemName, newItemName);
- connect(newItemName, SIGNAL(clicked()), this, SLOT(newItemByName()));
+ connect(newItemName, TQT_SIGNAL(clicked()), this, TQT_SLOT(newItemByName()));
- QToolButton *delItem = new QToolButton(frame);
+ TQToolButton *delItem = new TQToolButton(frame);
delItem->setIconSet(BarIconSet("edit_remove"));
delItem->setTextLabel(i18n("&Remove Selected Item"), true);
- vlayout->addWidget(delItem);
+ vtqlayout->addWidget(delItem);
m_buttons.insert(BDelItem, delItem);
- connect(delItem, SIGNAL(clicked()), this, SLOT(removeItem()));
- vlayout->addStretch();
+ connect(delItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(removeItem()));
+ vtqlayout->addStretch();
// Setup the iconView
m_iconView = new KIconView(frame, "pixcollection_iconView");
m_iconView->resize(100,100);
- m_iconView->setArrangement(QIconView::LeftToRight);
+ m_iconView->setArrangement(TQIconView::LeftToRight);
m_iconView->setAutoArrange(true);
m_iconView->setMode(KIconView::Select);
l->addWidget(m_iconView);
- connect(m_iconView, SIGNAL(contextMenuRequested(QIconViewItem*, const QPoint&)), this, SLOT(displayMenu(QIconViewItem*, const QPoint&)));
- connect(m_iconView, SIGNAL(itemRenamed(QIconViewItem*, const QString &)), this, SLOT(renameCollectionItem(QIconViewItem*, const QString&)));
+ connect(m_iconView, TQT_SIGNAL(contextMenuRequested(TQIconViewItem*, const TQPoint&)), this, TQT_SLOT(displayMenu(TQIconViewItem*, const TQPoint&)));
+ connect(m_iconView, TQT_SIGNAL(itemRenamed(TQIconViewItem*, const TQString &)), this, TQT_SLOT(renameCollectionItem(TQIconViewItem*, const TQString&)));
PixmapMap::ConstIterator it;
PixmapMap::ConstIterator endIt = collection->m_pixmaps.end();
@@ -282,13 +282,13 @@ PixmapCollectionEditor::PixmapCollectionEditor(PixmapCollection *collection, QWi
void
PixmapCollectionEditor::newItemByName()
{
- LoadIconDialog d(parentWidget());
- if(d.exec()== QDialog::Accepted)
+ LoadIconDialog d(tqparentWidget());
+ if(d.exec()== TQDialog::Accepted)
{
if(d.iconName().isEmpty())
return;
- QString name = m_collection->addPixmapName(d.iconName(), d.iconSize());
+ TQString name = m_collection->addPixmapName(d.iconName(), d.iconSize());
createIconViewItem(name);
}
}
@@ -296,23 +296,23 @@ PixmapCollectionEditor::newItemByName()
void
PixmapCollectionEditor::newItemByPath()
{
- KURL url = KFileDialog::getImageOpenURL("::kexi", parentWidget());
+ KURL url = KFileDialog::getImageOpenURL("::kexi", tqparentWidget());
if(url.isEmpty())
return;
- QString name = m_collection->addPixmapPath(url);
+ TQString name = m_collection->addPixmapPath(url);
createIconViewItem(name);
}
void
PixmapCollectionEditor::removeItem()
{
- QIconViewItem *item = m_iconView->currentItem();
+ TQIconViewItem *item = m_iconView->currentItem();
if( !item )
return;
- int confirm = KMessageBox::questionYesNo(parentWidget(), QString("<qt>")+
+ int confirm = KMessageBox::questionYesNo(tqparentWidget(), TQString("<qt>")+
i18n("Do you want to remove item \"%1\" from collection \"%2\"?")
- .arg(item->text()).arg(m_collection->collectionName()) + "</qt>");
+ .tqarg(item->text()).tqarg(m_collection->collectionName()) + "</qt>");
if(confirm == KMessageBox::No)
return;
@@ -328,60 +328,60 @@ PixmapCollectionEditor::renameItem()
}
void
-PixmapCollectionEditor::createIconViewItem(const QString &name)
+PixmapCollectionEditor::createIconViewItem(const TQString &name)
{
PixmapIconViewItem *item = new PixmapIconViewItem(m_iconView, name, getPixmap(name));
item->setRenameEnabled(true);
}
-QPixmap
-PixmapCollectionEditor::getPixmap(const QString &name)
+TQPixmap
+PixmapCollectionEditor::getPixmap(const TQString &name)
{
- QPixmap pixmap = m_collection->getPixmap(name);
+ TQPixmap pixmap = m_collection->getPixmap(name);
if((pixmap.width() <= 48) && (pixmap.height() <= 48))
return pixmap;
KPixmapIO io;
- QImage image = io.convertToImage(pixmap);
- pixmap = io.convertToPixmap(image.scale(48, 48, QImage::ScaleMin));
+ TQImage image = io.convertToImage(pixmap);
+ pixmap = io.convertToPixmap(image.scale(48, 48, TQ_ScaleMin));
return pixmap;
}
void
-PixmapCollectionEditor::renameCollectionItem(QIconViewItem *it, const QString &name)
+PixmapCollectionEditor::renameCollectionItem(TQIconViewItem *it, const TQString &name)
{
PixmapIconViewItem *item = static_cast<PixmapIconViewItem*>(it);
- if(!m_collection->m_pixmaps.contains(item->name()))
+ if(!m_collection->m_pixmaps.tqcontains(item->name()))
return;
// We just rename the collection item
- QPair<QString, int> pair = m_collection->m_pixmaps[item->name()];
+ TQPair<TQString, int> pair = m_collection->m_pixmaps[item->name()];
m_collection->m_pixmaps.remove(item->name());
m_collection->m_pixmaps[name] = pair;
item->setName(name);
}
void
-PixmapCollectionEditor::displayMenu(QIconViewItem *it, const QPoint &p)
+PixmapCollectionEditor::displayMenu(TQIconViewItem *it, const TQPoint &p)
{
if(!it) return;
KPopupMenu *menu = new KPopupMenu();
- menu->insertItem(SmallIconSet("edit"), i18n("Rename Item"), this, SLOT(renameItem()));
- menu->insertItem(SmallIconSet("remove"), i18n("Remove Item"), this, SLOT(removeItem()));
+ menu->insertItem(SmallIconSet("edit"), i18n("Rename Item"), this, TQT_SLOT(renameItem()));
+ menu->insertItem(SmallIconSet("remove"), i18n("Remove Item"), this, TQT_SLOT(removeItem()));
menu->exec(p);
}
//// A Dialog to choose a pixmap from the PixmapCollection
-PixmapCollectionChooser::PixmapCollectionChooser(PixmapCollection *collection, const QString &selectedItem, QWidget *parent)
-: KDialogBase(parent, "pixchoose_dialog", true, i18n("Select Pixmap From %1").arg(collection->collectionName()),
+PixmapCollectionChooser::PixmapCollectionChooser(PixmapCollection *collection, const TQString &selectedItem, TQWidget *tqparent)
+: KDialogBase(tqparent, "pixchoose_dialog", true, i18n("Select Pixmap From %1").tqarg(collection->collectionName()),
User1|Ok|Cancel, Ok, false, KGuiItem(i18n("Edit Collection...")))
{
m_collection = collection;
- setInitialSize(QSize(400, 200), true);
+ setInitialSize(TQSize(400, 200), true);
m_iconView = new KIconView(this, "pixchooser_iconView");
setMainWidget(m_iconView);
- m_iconView->setArrangement(QIconView::LeftToRight);
+ m_iconView->setArrangement(TQIconView::LeftToRight);
m_iconView->setAutoArrange(true);
m_iconView->setMode(KIconView::Select);
@@ -390,44 +390,44 @@ PixmapCollectionChooser::PixmapCollectionChooser(PixmapCollection *collection, c
for(it = collection->m_pixmaps.constBegin(); it != endIt; ++it)
new PixmapIconViewItem(m_iconView, it.key(), getPixmap(it.key()));
- QIconViewItem *item = m_iconView->findItem(selectedItem, Qt::ExactMatch);
+ TQIconViewItem *item = m_iconView->tqfindItem(selectedItem, TQt::ExactMatch);
if(item && !selectedItem.isEmpty())
m_iconView->setCurrentItem(item);
}
-QPixmap
+TQPixmap
PixmapCollectionChooser::pixmap()
{
if(! m_iconView->currentItem())
- return QPixmap();
- QString name = m_iconView->currentItem()->text();
+ return TQPixmap();
+ TQString name = m_iconView->currentItem()->text();
return m_collection->getPixmap(name);
}
-QString
+TQString
PixmapCollectionChooser::pixmapName()
{
- return m_iconView->currentItem() ? m_iconView->currentItem()->text() : QString("");
+ return m_iconView->currentItem() ? m_iconView->currentItem()->text() : TQString("");
}
-QPixmap
-PixmapCollectionChooser::getPixmap(const QString &name)
+TQPixmap
+PixmapCollectionChooser::getPixmap(const TQString &name)
{
- QPixmap pixmap = m_collection->getPixmap(name);
+ TQPixmap pixmap = m_collection->getPixmap(name);
if((pixmap.width() <= 48) && (pixmap.height() <= 48))
return pixmap;
// We scale the pixmap down to 48x48 to fit in the iconView
KPixmapIO io;
- QImage image = io.convertToImage(pixmap);
- pixmap = io.convertToPixmap(image.scale(48, 48, QImage::ScaleMin));
+ TQImage image = io.convertToImage(pixmap);
+ pixmap = io.convertToPixmap(image.scale(48, 48, TQ_ScaleMin));
return pixmap;
}
void
PixmapCollectionChooser::slotUser1()
{
- PixmapCollectionEditor dialog(m_collection, parentWidget());
+ PixmapCollectionEditor dialog(m_collection, tqparentWidget());
dialog.exec();
m_iconView->clear();