summaryrefslogtreecommitdiffstats
path: root/src/libgui/editor_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libgui/editor_manager.cpp')
-rw-r--r--src/libgui/editor_manager.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/libgui/editor_manager.cpp b/src/libgui/editor_manager.cpp
index 2a42554..a9d6a24 100644
--- a/src/libgui/editor_manager.cpp
+++ b/src/libgui/editor_manager.cpp
@@ -9,9 +9,9 @@
***************************************************************************/
#include "editor_manager.h"
-#include <qiconset.h>
-#include <qdragobject.h>
-#include <qpainter.h>
+#include <tqiconset.h>
+#include <tqdragobject.h>
+#include <tqpainter.h>
#include <klocale.h>
#include <kiconloader.h>
@@ -33,43 +33,43 @@
#include "project.h"
//-----------------------------------------------------------------------------
-SwitchToDialog::SwitchToDialog(const QStringList &names, QWidget *parent)
- : Dialog(parent, "switch_to_dialog", true, i18n("Switch to editor"), Ok | Cancel, Ok, false)
+SwitchToDialog::SwitchToDialog(const TQStringList &names, TQWidget *tqparent)
+ : Dialog(tqparent, "switch_to_dialog", true, i18n("Switch to editor"), Ok | Cancel, Ok, false)
{
- QVBoxLayout *top = new QVBoxLayout(mainWidget(), 10, 10);
+ TQVBoxLayout *top = new TQVBoxLayout(mainWidget(), 10, 10);
_edit = new KLineEdit(mainWidget());
_edit->setCompletedItems(names);
top->addWidget(_edit);
}
//-----------------------------------------------------------------------------
-void EditorTabBar::paintLabel(QPainter *p, const QRect &br, QTab *t, bool has_focus) const
+void EditorTabBar::paintLabel(TQPainter *p, const TQRect &br, TQTab *t, bool has_focus) const
{
- QFont f = p->font();
+ TQFont f = p->font();
f.setItalic(_readOnly[t]);
p->setFont(f);
- QTabBar::paintLabel(p, br, t, has_focus);
+ TQTabBar::paintLabel(p, br, t, has_focus);
}
//-----------------------------------------------------------------------------
-QString EditorHistory::goBack()
+TQString EditorHistory::goBack()
{
- if ( !hasBack() ) return QString::null;
+ if ( !hasBack() ) return TQString();
_current--;
return _names[_current];
}
-QString EditorHistory::goForward()
+TQString EditorHistory::goForward()
{
- if ( !hasForward() ) return QString::null;
+ if ( !hasForward() ) return TQString();
_current++;
return _names[_current];
}
-void EditorHistory::add(const QString &name)
+void EditorHistory::add(const TQString &name)
{
if ( _names.count()!=0 ) {
- _current = QMIN(_current, _names.count()-1);
+ _current = TQMIN(_current, _names.count()-1);
if ( _names[_current]==name ) return;
if ( _current!=0 && _names[_current-1]==name ) {
_current--;
@@ -92,11 +92,11 @@ void EditorHistory::closedLast()
//-----------------------------------------------------------------------------
const char * const EditorManager::EDITOR_TAGS[Nb_EditorTypes] = { "device", "registers" };
-EditorManager::EditorManager(QWidget *parent)
- : TabWidget(parent, "editor_manager"), _current(0)
+EditorManager::EditorManager(TQWidget *tqparent)
+ : TabWidget(tqparent, "editor_manager"), _current(0)
{
setTabBar(new EditorTabBar(this));
- connect(this, SIGNAL(currentChanged(QWidget *)), SLOT(showEditor(QWidget *)));
+ connect(this, TQT_SIGNAL(currentChanged(TQWidget *)), TQT_SLOT(showEditor(TQWidget *)));
setHoverCloseButton(readConfigEntry(BaseGlobalConfig::ShowTabCloseButton).toBool());
setHoverCloseButtonDelayed(false);
}
@@ -106,7 +106,7 @@ bool EditorManager::openFile(const PURL::Url &url)
if ( url.isEmpty() ) return false;
Editor *e = findEditor(url);
if (e) { // document already loaded
- if ( !MessageBox::askContinue(i18n("File \"%1\" already loaded. Reload?").arg(url.kurl().prettyURL()),
+ if ( !MessageBox::askContinue(i18n("File \"%1\" already loaded. Reload?").tqarg(url.kurl().prettyURL()),
i18n("Warning"), i18n("Reload")) ) return true;
if ( !e->slotLoad() ) {
closeEditor(e, false);
@@ -127,10 +127,10 @@ void EditorManager::connectEditor(Editor *editor)
disconnectEditor(currentEditor());
if ( editor==0 ) return;
editor->addGui();
- connect(editor, SIGNAL(modified()), SLOT(modifiedSlot()));
- connect(editor, SIGNAL(guiChanged()), SIGNAL(guiChanged()));
- connect(editor, SIGNAL(dropEventPass(QDropEvent *)), SLOT(slotDropEvent(QDropEvent *)));
- connect(editor, SIGNAL(statusTextChanged(const QString &)), SIGNAL(statusChanged(const QString &)));
+ connect(editor, TQT_SIGNAL(modified()), TQT_SLOT(modifiedSlot()));
+ connect(editor, TQT_SIGNAL(guiChanged()), TQT_SIGNAL(guiChanged()));
+ connect(editor, TQT_SIGNAL(dropEventPass(TQDropEvent *)), TQT_SLOT(slotDropEvent(TQDropEvent *)));
+ connect(editor, TQT_SIGNAL(statusTextChanged(const TQString &)), TQT_SIGNAL(statusChanged(const TQString &)));
}
void EditorManager::modifiedSlot()
@@ -145,7 +145,7 @@ void EditorManager::disconnectEditor(Editor *editor)
editor->removeGui();
}
-QString EditorManager::title(const Editor &e) const
+TQString EditorManager::title(const Editor &e) const
{
return (e.url().isEmpty() ? "<" + e.name() + ">" : e.url().filename());
}
@@ -153,15 +153,15 @@ QString EditorManager::title(const Editor &e) const
void EditorManager::updateTitles()
{
KIconLoader loader;
- QPixmap def = loader.loadIcon("piklab", KIcon::Small);
- QPixmap modified = loader.loadIcon("filesave", KIcon::Small);
- QPixmap chip = loader.loadIcon("piklab_chip", KIcon::Small);
- QValueList<Editor *>::iterator it = _editors.begin();
+ TQPixmap def = loader.loadIcon("piklab", KIcon::Small);
+ TQPixmap modified = loader.loadIcon("filesave", KIcon::Small);
+ TQPixmap chip = loader.loadIcon("piklab_chip", KIcon::Small);
+ TQValueList<Editor *>::iterator it = _editors.begin();
for (; it!=_editors.end(); ++it) {
static_cast<EditorTabBar *>(tabBar())->setReadOnly(indexOf(*it), (*it)->isReadOnly());
- QPixmap pixmap;
+ TQPixmap pixmap;
if ( (*it)->isModified() ) pixmap = modified;
- else if ( ::qt_cast< ::DeviceEditor *>(*it)==0 ) pixmap = PURL::icon((*it)->fileType());
+ else if ( ::tqqt_cast< ::DeviceEditor *>(*it)==0 ) pixmap = PURL::icon((*it)->fileType());
else pixmap = chip;
changeTab(*it, pixmap.isNull() ? def : pixmap, title(**it));
}
@@ -186,9 +186,9 @@ bool EditorManager::closeAllEditors()
bool EditorManager::closeAllOtherEditors()
{
if ( nbEditors()==1 ) return true;
- QValueList<Editor *> list = _editors;
+ TQValueList<Editor *> list = _editors;
list.remove(currentEditor());
- QValueList<Editor *>::iterator it = list.begin();
+ TQValueList<Editor *>::iterator it = list.begin();
bool ok = true;
for (; it!=list.end(); ++it) {
if ( !closeEditor(*it, true) ) {
@@ -231,14 +231,14 @@ bool EditorManager::closeEditor(Editor *e, bool ask)
void EditorManager::saveBookmarks(const Editor &e)
{
if ( Main::project()==0 ) return;
- QValueList<uint> lines = e.bookmarkLines();
+ TQValueList<uint> lines = e.bookmarkLines();
Main::project()->setBookmarkLines(e.url(), lines);
}
void EditorManager::restoreBookmarks(Editor &e)
{
if ( Main::project()==0 ) return;
- QValueList<uint> lines = Main::project()->bookmarkLines(e.url());
+ TQValueList<uint> lines = Main::project()->bookmarkLines(e.url());
e.setBookmarkLines(lines);
}
@@ -260,21 +260,21 @@ void EditorManager::changeToEditor(Editor *e)
e->statusChanged();
_history.add(name(*e));
} else {
- emit statusChanged(QString::null);
+ emit statusChanged(TQString());
_history.closedLast();
}
}
-Editor *EditorManager::findEditor(const QString &tag)
+Editor *EditorManager::findEditor(const TQString &tag)
{
- QValueList<Editor *>::iterator it = _editors.begin();
+ TQValueList<Editor *>::iterator it = _editors.begin();
for (; it!=_editors.end(); ++it) if ( (*it)->tag()==tag ) return *it;
return 0;
}
Editor *EditorManager::findEditor(const PURL::Url &url)
{
- QValueList<Editor *>::iterator it = _editors.begin();
+ TQValueList<Editor *>::iterator it = _editors.begin();
for (; it!=_editors.end(); ++it) if ( (*it)->url()==url ) return *it;
return 0;
}
@@ -334,20 +334,20 @@ Editor *EditorManager::createEditor(PURL::FileType type, const PURL::Url &url)
void EditorManager::addEditor(Editor *e)
{
- QValueList<Editor *>::iterator it = _editors.begin();
+ TQValueList<Editor *>::iterator it = _editors.begin();
for (; it!=_editors.end(); ++it) if ( *it==e ) return;
_editors.append(e);
- addTab(e, QString::null);
+ addTab(e, TQString());
setTabEnabled(e, true);
restoreBookmarks(*e);
showEditor(e);
}
-void EditorManager::slotDropEvent(QDropEvent *event)
+void EditorManager::slotDropEvent(TQDropEvent *event)
{
- QStringList urls;
- if ( !QUriDrag::decodeLocalFiles(event, urls)) return;
- QStringList::const_iterator it = urls.begin();
+ TQStringList urls;
+ if ( !TQUriDrag::decodeLocalFiles(event, urls)) return;
+ TQStringList::const_iterator it = urls.begin();
for(; it!=urls.end(); ++it) openEditor(PURL::Url::fromPathOrUrl(*it));
}
@@ -368,7 +368,7 @@ Editor *EditorManager::openEditor(const PURL::Url &url)
void EditorManager::saveAllFiles()
{
- QValueList<Editor *>::iterator it = _editors.begin();
+ TQValueList<Editor *>::iterator it = _editors.begin();
for (; it!=_editors.end(); ++it) {
if ( !(*it)->isModified() ) continue;
(*it)->save();
@@ -379,7 +379,7 @@ void EditorManager::saveAllFiles()
PURL::UrlList EditorManager::files() const
{
PURL::UrlList names;
- QValueList<Editor *>::const_iterator it = _editors.begin();
+ TQValueList<Editor *>::const_iterator it = _editors.begin();
for(; it!=_editors.end(); ++it) {
if ( (*it)->url().isEmpty() ) continue;
names.push_back((*it)->url());
@@ -387,16 +387,16 @@ PURL::UrlList EditorManager::files() const
return names;
}
-void EditorManager::contextMenu(int i, const QPoint &p)
+void EditorManager::contextMenu(int i, const TQPoint &p)
{
Editor *editor = static_cast<Editor *>(page(i));
if ( editor==0 ) return;
KIconLoader loader;
- QPixmap closeIcon = loader.loadIcon("fileclose", KIcon::Small);
- QPixmap saveIcon = loader.loadIcon("filesave", KIcon::Small);
- QPixmap saveAsIcon = loader.loadIcon("filesaveas", KIcon::Small);
- QPixmap reloadIcon = loader.loadIcon("reload", KIcon::Small);
+ TQPixmap closeIcon = loader.loadIcon("fileclose", KIcon::Small);
+ TQPixmap saveIcon = loader.loadIcon("filesave", KIcon::Small);
+ TQPixmap saveAsIcon = loader.loadIcon("filesaveas", KIcon::Small);
+ TQPixmap reloadIcon = loader.loadIcon("reload", KIcon::Small);
KPopupMenu *popup = new KPopupMenu;
popup->insertTitle(title(*editor));
popup->insertItem(closeIcon, i18n("Close"), 1);
@@ -434,18 +434,18 @@ void EditorManager::switchHeaderImplementation()
void EditorManager::switchToEditor()
{
- QStringList names;
+ TQStringList names;
for (uint i=0; i<_editors.count(); i++) names.append(title(*_editors[i]));
SwitchToDialog dialog(names, this);
- if ( dialog.exec()!=QDialog::Accepted ) return;
+ if ( dialog.exec()!=TQDialog::Accepted ) return;
for (uint i=0; i<names.count(); i++) {
- if ( dialog.name()!=names[i] && dialog.name()!=QString("%1").arg(i+1) ) continue;
+ if ( dialog.name()!=names[i] && dialog.name()!=TQString("%1").tqarg(i+1) ) continue;
showEditor(_editors[i]);
return;
}
}
-QString EditorManager::name(const Editor &e) const
+TQString EditorManager::name(const Editor &e) const
{
return (!e.name().isEmpty() ? e.name() : e.url().filepath());
}
@@ -453,7 +453,7 @@ QString EditorManager::name(const Editor &e) const
void EditorManager::goBack()
{
Q_ASSERT( _history.hasBack() );
- QString s = _history.goBack();
+ TQString s = _history.goBack();
for (uint i=0; i<_editors.count(); i++)
if ( s==name(*_editors[i]) ) showEditor(_editors[i]);
}
@@ -461,7 +461,7 @@ void EditorManager::goBack()
void EditorManager::goForward()
{
Q_ASSERT( _history.hasForward() );
- QString s = _history.goForward();
+ TQString s = _history.goForward();
for (uint i=0; i<_editors.count(); i++)
if ( s==name(*_editors[i]) ) showEditor(_editors[i]);
}
@@ -470,7 +470,7 @@ Editor *EditorManager::openEditor(EditorType type)
{
bool created = false;
Editor *e = 0;
- QString tag = EDITOR_TAGS[type];
+ TQString tag = EDITOR_TAGS[type];
switch (type) {
case DeviceEditor: {
e = findEditor(tag);
@@ -485,7 +485,7 @@ Editor *EditorManager::openEditor(EditorType type)
case RegisterEditor: {
e = findEditor(tag);
if ( e==0 ) {
- ::BusyCursor bc;
+ ::PBusyCursor bc;
e = new Register::MainView(i18n("Registers"), tag);
static_cast<Debugger::GuiManager *>(Debugger::manager)->addRegisterView(*static_cast<Register::MainView *>(e));
created = true;