diff options
Diffstat (limited to 'src/libgui/project_manager.cpp')
-rw-r--r-- | src/libgui/project_manager.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/src/libgui/project_manager.cpp b/src/libgui/project_manager.cpp index dcc4941..e606370 100644 --- a/src/libgui/project_manager.cpp +++ b/src/libgui/project_manager.cpp @@ -9,11 +9,11 @@ ***************************************************************************/ #include "project_manager.h" -#include <qdragobject.h> -#include <qpainter.h> -#include <qstyle.h> -#include <qtimer.h> -#include <qheader.h> +#include <tqdragobject.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqtimer.h> +#include <tqheader.h> #include <klocale.h> #include <kiconloader.h> @@ -35,26 +35,26 @@ #include "device_gui.h" //---------------------------------------------------------------------------- -ProjectManager::View::View(QWidget *parent) - : ListView(parent, "project_manager"), _project(0), _modified(false) +ProjectManager::View::View(TQWidget *tqparent) + : ListView(tqparent, "project_manager"), _project(0), _modified(false) { - connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem *, const QPoint &, int)), - SLOT(clicked(int, QListViewItem *, const QPoint &, int))); - connect(this, SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)), - SLOT(contextMenu(QListViewItem *, const QPoint &, int))); - connect(this, SIGNAL(itemRenamed(QListViewItem *, int, const QString &)), - SLOT(renamed(QListViewItem *, int, const QString &))); - connect(this, SIGNAL(moved()), SLOT(filesReordered())); + connect(TQT_TQOBJECT(this), TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(clicked(int, TQListViewItem *, const TQPoint &, int))); + connect(TQT_TQOBJECT(this), TQT_SIGNAL(contextMenuRequested(TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(contextMenu(TQListViewItem *, const TQPoint &, int))); + connect(TQT_TQOBJECT(this), TQT_SIGNAL(itemRenamed(TQListViewItem *, int, const TQString &)), + TQT_SLOT(renamed(TQListViewItem *, int, const TQString &))); + connect(TQT_TQOBJECT(this), TQT_SIGNAL(moved()), TQT_SLOT(filesReordered())); header()->hide(); setSorting(-1); - addColumn(QString::null, 170); + addColumn(TQString(), 170); setFullWidth(true); setRootIsDecorated(false); setAcceptDrops(true); setDragEnabled(true); setDropVisualizer(true); - QTimer::singleShot(0, this, SLOT(init()));; + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(init()));; } ProjectManager::View::~View() @@ -77,7 +77,7 @@ void ProjectManager::View::init() ProjectManager::HeaderItem *ProjectManager::View::findHeaderItem(Group group) const { - QListViewItemIterator it(const_cast<View *>(this)); + TQListViewItemIterator it(const_cast<View *>(this)); for(; it.current(); ++it) { if ( it.current()->rtti()!=HeaderRtti ) continue; HeaderItem *hi = static_cast<HeaderItem *>(it.current()); @@ -106,7 +106,7 @@ ProjectManager::HeaderItem *ProjectManager::View::headerItem(Group group) ProjectManager::FileItem *ProjectManager::View::findFileItem(const PURL::Url &url) const { - QListViewItemIterator it(const_cast<View *>(this)); + TQListViewItemIterator it(const_cast<View *>(this)); for(; it.current(); ++it) { if ( it.current()->rtti()!=FileRtti ) continue; FileItem *fi = static_cast<FileItem *>(it.current()); @@ -117,7 +117,7 @@ ProjectManager::FileItem *ProjectManager::View::findFileItem(const PURL::Url &ur ProjectManager::FileItem *ProjectManager::View::findFileItem(PURL::FileType type) const { - QListViewItemIterator it(const_cast<View *>(this)); + TQListViewItemIterator it(const_cast<View *>(this)); for(; it.current(); ++it) { if ( it.current()->rtti()!=FileRtti ) continue; FileItem *fi = static_cast<FileItem *>(it.current()); @@ -126,9 +126,9 @@ ProjectManager::FileItem *ProjectManager::View::findFileItem(PURL::FileType type return 0; } -QListViewItem *ProjectManager::View::findItem(const QString &tag) const +TQListViewItem *ProjectManager::View::findItem(const TQString &tag) const { - QListViewItemIterator it(const_cast<View *>(this)); + TQListViewItemIterator it(const_cast<View *>(this)); for(; it.current(); ++it) { switch (Rtti(it.current()->rtti())) { case RootRtti: @@ -145,14 +145,14 @@ QListViewItem *ProjectManager::View::findItem(const QString &tag) const void ProjectManager::View::select(const Editor *e) { - QListViewItem *item = 0; + TQListViewItem *item = 0; if ( e->url().isEmpty() ) item = findItem(e->tag()); else item = findFileItem(e->url()); if (item) setSelected(item, true); else clearSelection(); } -void ProjectManager::View::contextMenu(QListViewItem *item, const QPoint &p, int) +void ProjectManager::View::contextMenu(TQListViewItem *item, const TQPoint &p, int) { if ( item==0 ) return; @@ -178,8 +178,8 @@ void ProjectManager::View::contextMenu(QListViewItem *item, const QPoint &p, int RootItem *ri = static_cast<RootItem *>(item); if ( _project==0 ) { if ( ri->url().isEmpty() ) { - pop.insertItem("piklab_createproject", i18n("New Project..."), &Main::toplevel(), SLOT(newProject())); - pop.insertItem("piklab_openproject", i18n("Open Project..."), &Main::toplevel(), SLOT(openProject())); + pop.insertItem("piklab_createproject", i18n("New Project..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(newProject())); + pop.insertItem("piklab_openproject", i18n("Open Project..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(openProject())); pop.exec(p); } else { pop.insertTitle(i18n("Standalone File")); @@ -188,16 +188,16 @@ void ProjectManager::View::contextMenu(QListViewItem *item, const QPoint &p, int } } else { pop.insertTitle(i18n("Project")); - pop.insertItem("configure", i18n("Options..."), &Main::toplevel(), SLOT(configureProject())); - pop.insertItem("find", i18n("Find Files..."), &Main::toplevel(), SLOT(runKfind())); + pop.insertItem("configure", i18n("Options..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(configureProject())); + pop.insertItem("tqfind", i18n("Find Files..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(runKtqfind())); pop.insertSeparator(); - pop.insertItem("piklab_compile", i18n("Build Project"), &Main::toplevel(), SLOT(buildProject())); - pop.insertItem("trashcan_empty", i18n("Clean Project"), &Main::toplevel(), SLOT(cleanBuild())); + pop.insertItem("piklab_compile", i18n("Build Project"), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(buildProject())); + pop.insertItem("trashcan_empty", i18n("Clean Project"), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(cleanBuild())); pop.insertSeparator(); - pop.insertItem("filenew", i18n("New Source File..."), &Main::toplevel(), SLOT(newSourceFile())); - pop.insertItem("piklab_addfile", i18n("Add Source Files..."), this, SLOT(insertSourceFiles())); - pop.insertItem("piklab_addfile", i18n("Add Object Files..."), this, SLOT(insertObjectFiles())); - if ( Main::currentEditor() ) pop.insertItem("piklab_addcurrentfile", i18n("Add Current File"), this, SLOT(insertCurrentFile())); + pop.insertItem("filenew", i18n("New Source File..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(newSourceFile())); + pop.insertItem("piklab_addfile", i18n("Add Source Files..."), TQT_TQOBJECT(this), TQT_SLOT(insertSourceFiles())); + pop.insertItem("piklab_addfile", i18n("Add Object Files..."), TQT_TQOBJECT(this), TQT_SLOT(insertObjectFiles())); + if ( Main::currentEditor() ) pop.insertItem("piklab_addcurrentfile", i18n("Add Current File"), TQT_TQOBJECT(this), TQT_SLOT(insertCurrentFile())); pop.exec(p); } } else if ( item->rtti()==FileRtti ) { @@ -211,15 +211,15 @@ void ProjectManager::View::contextMenu(QListViewItem *item, const QPoint &p, int if ( _project==0 ) return; if ( group==LinkerObjectGroup ) { pop.insertTitle(i18n("Objects")); - pop.insertItem("piklab_addfile", i18n("Add Object Files..."), this, SLOT(insertObjectFiles())); + pop.insertItem("piklab_addfile", i18n("Add Object Files..."), TQT_TQOBJECT(this), TQT_SLOT(insertObjectFiles())); pop.exec(p); } else if ( group==SourceGroup || group==HeaderGroup ) { pop.insertTitle(i18n("Sources")); - pop.insertItem("filenew", i18n("New File..."), &Main::toplevel(), SLOT(newSourceFile())); - pop.insertItem("piklab_addfile", i18n("Add Source Files..."), this, SLOT(insertSourceFiles())); + pop.insertItem("filenew", i18n("New File..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(newSourceFile())); + pop.insertItem("piklab_addfile", i18n("Add Source Files..."), TQT_TQOBJECT(this), TQT_SLOT(insertSourceFiles())); pop.exec(p); } else if ( group==DeviceGroup ) { - pop.insertItem("filenew", i18n("Select Device..."), &Main::toplevel(), SLOT(showDeviceInfo())); + pop.insertItem("filenew", i18n("Select Device..."), TQT_TQOBJECT(&Main::toplevel()), TQT_SLOT(showDeviceInfo())); pop.exec(p); } } @@ -240,9 +240,9 @@ void ProjectManager::View::closeProject() _project->setOpenedFiles(opened); // save watched registers _project->setWatchedRegisters(Register::list().watched()); - QString error; + TQString error; if ( !_project->save(error) ) - MessageBox::detailedSorry(i18n("Could not save project file \"%1\".").arg(_project->url().pretty()), error, Log::Show); + MessageBox::detailedSorry(i18n("Could not save project file \"%1\".").tqarg(_project->url().pretty()), error, Log::Show); delete _project; _project = 0; } @@ -252,8 +252,8 @@ void ProjectManager::View::closeProject() void ProjectManager::View::addExternalFiles() { - const QMap<PURL::Url, FileOrigin> &ext = projectData().externals; - QMap<PURL::Url, FileOrigin>::const_iterator it; + const TQMap<PURL::Url, FileOrigin> &ext = projectData().externals; + TQMap<PURL::Url, FileOrigin>::const_iterator it; for (it=ext.begin(); it!=ext.end(); ++it) { if ( !it.key().exists() ) continue; addFile(it.key(), it.key().fileType(), it.data()); @@ -272,9 +272,9 @@ void ProjectManager::View::setStandalone(const PURL::Url &url, PURL::FileType ty PURL::Url ProjectManager::View::standaloneGenerator(const PURL::Url &url, PURL::FileType &type) const { - QMap<PURL::Url, ProjectData>::const_iterator it; + TQMap<PURL::Url, ProjectData>::const_iterator it; for (it=_standaloneData.begin(); it!=_standaloneData.end(); ++it) { - if ( !it.data().externals.contains(url) ) continue; + if ( !it.data().externals.tqcontains(url) ) continue; if ( !it.key().exists() ) continue; type = it.data().type; return it.key(); @@ -304,25 +304,25 @@ void ProjectManager::View::insertObjectFiles() void ProjectManager::View::insertFile(const PURL::Url &url) { if ( !url.exists() ) { - MessageBox::detailedSorry(i18n("Could not find file."), i18n("File: %1").arg(url.pretty()), Log::Show); + MessageBox::detailedSorry(i18n("Could not find file."), i18n("File: %1").tqarg(url.pretty()), Log::Show); return; } PURL::Url purl = url; MessageBox::Result copy = MessageBox::No; if ( !url.isInto(_project->directory()) ) { - copy = MessageBox::questionYesNoCancel(i18n("File \"%1\" is not inside the project directory. Do you want to copy the file to your project directory?").arg(url.pretty()), + copy = MessageBox::questionYesNoCancel(i18n("File \"%1\" is not inside the project directory. Do you want to copy the file to your project directory?").tqarg(url.pretty()), i18n("Copy and Add"), i18n("Add only")); if ( copy==MessageBox::Cancel ) return; if ( copy==MessageBox::Yes ) purl = PURL::Url(_project->directory(), url.filename()); } - if ( _project->absoluteFiles().contains(purl) ) { - MessageBox::detailedSorry(i18n("File is already in the project."), i18n("File: %1").arg(purl.pretty()), Log::Show); + if ( _project->absoluteFiles().tqcontains(purl) ) { + MessageBox::detailedSorry(i18n("File is already in the project."), i18n("File: %1").tqarg(purl.pretty()), Log::Show); return; } if ( copy==MessageBox::Yes ) { Log::StringView sview; if ( !url.copyTo(purl, sview) ) { - MessageBox::detailedSorry(i18n("Copying file to project directory failed."), i18n("File: %1\n").arg(url.pretty()) + sview.string(), Log::Show); + MessageBox::detailedSorry(i18n("Copying file to project directory failed."), i18n("File: %1\n").tqarg(url.pretty()) + sview.string(), Log::Show); return; } } @@ -356,8 +356,8 @@ ProjectManager::View::ProjectData &ProjectManager::View::projectData() void ProjectManager::View::addFile(const PURL::Url &url, PURL::FileType type, FileOrigin origin) { - if ( contains(url) ) return; - QMap<PURL::Url, FileOrigin> &ext = projectData().externals; + if ( tqcontains(url) ) return; + TQMap<PURL::Url, FileOrigin> &ext = projectData().externals; if ( type.data().group==PURL::LinkerScript && _linkerScriptItem ) { _linkerScriptItem->set(url); ext[url] = Included; @@ -371,12 +371,12 @@ void ProjectManager::View::addFile(const PURL::Url &url, PURL::FileType type, Fi case Included: grp = IncludedGroup; break; } HeaderItem *hitem = headerItem(grp); - QListViewItem *item = new FileItem(hitem, type, url, origin!=Intrinsic); + TQListViewItem *item = new FileItem(hitem, type, url, origin!=Intrinsic); item->moveItem(hitem->lastChild()); ensureItemVisible(item); if ( origin!=Intrinsic ) ext[url] = origin; if ( type==PURL::Hex && _project==0 ) { - QString extension = PURL::extension(PURL::AsmGPAsm); + TQString extension = PURL::extension(PURL::AsmGPAsm); PURL::Url durl = PURL::Url::fromPathOrUrl("<" + (url.isEmpty() ? i18n("Disassembly") : url.appendExtension(extension).filename()) + ">"); if ( findFileItem(durl)==0 ) { (void)new FileItem(headerItem(ViewGroup), PURL::Coff, durl, true); @@ -388,8 +388,8 @@ void ProjectManager::View::addFile(const PURL::Url &url, PURL::FileType type, Fi void ProjectManager::View::removeExternalFiles() { - QMap<PURL::Url, FileOrigin> &ext = projectData().externals; - QMap<PURL::Url, FileOrigin>::const_iterator it; + TQMap<PURL::Url, FileOrigin> &ext = projectData().externals; + TQMap<PURL::Url, FileOrigin>::const_iterator it; for (it=ext.begin(); it!=ext.end(); ++it) { Main::editorManager().closeEditor(it.key()); removeFile(it.key()); @@ -403,17 +403,17 @@ void ProjectManager::View::removeFile(const PURL::Url &url) if ( _project && !isExternalFile(url) ) _project->removeFile(url); FileItem *item = findFileItem(url); if ( item==0 ) return; - HeaderItem *group = static_cast<HeaderItem *>(item->parent()); + HeaderItem *group = static_cast<HeaderItem *>(item->tqparent()); delete item; if ( group->childCount()==0 ) delete group; _modified = true; emit guiChanged(); } -void ProjectManager::View::clicked(int button, QListViewItem *item, const QPoint &, int) +void ProjectManager::View::clicked(int button, TQListViewItem *item, const TQPoint &, int) { if ( item==0 ) return; - if ( button!=LeftButton ) return; + if ( button!=Qt::LeftButton ) return; const Device::Data *data = Main::deviceData(); Rtti rtti = Rtti(item->rtti()); if ( data==0 && rtti!=DeviceRtti && rtti!=RootRtti ) { @@ -421,7 +421,7 @@ void ProjectManager::View::clicked(int button, QListViewItem *item, const QPoint return; } Editor *e = 0; - ::BusyCursor bc; + ::PBusyCursor bc; switch (rtti) { case RootRtti: Main::toplevel().configureProject(); @@ -458,7 +458,7 @@ void ProjectManager::View::clicked(int button, QListViewItem *item, const QPoint if ( fi->ftype()==PURL::Coff && _project==0 && !fi->url().exists() ) { PURL::Url url = findFileItem(PURL::Hex)->url(); if ( url.isEmpty() ) { - HexEditor *he = ::qt_cast<HexEditor *>(Main::currentEditor()); + HexEditor *he = ::tqqt_cast<HexEditor *>(Main::currentEditor()); if ( he==0 ) break; e = new DisassemblyEditor(*he, *data, this); } else e = new DisassemblyEditor(url, *data, this); @@ -487,7 +487,7 @@ void ProjectManager::View::insertCurrentFile() bool ProjectManager::View::editProject() { ProjectEditor dialog(*_project, this); - if ( dialog.exec()!=QDialog::Accepted ) return false; + if ( dialog.exec()!=TQDialog::Accepted ) return false; _modified = true; if (_linkerScriptItem) _linkerScriptItem->init(); return true; @@ -496,9 +496,9 @@ bool ProjectManager::View::editProject() bool ProjectManager::View::newProject() { ProjectWizard wizard(this); - if ( wizard.exec()==QDialog::Rejected ) return false; + if ( wizard.exec()==TQDialog::Rejected ) return false; closeProject(); - QString error; + TQString error; if ( !wizard.project()->save(error) ) { MessageBox::detailedSorry(i18n("Failed to create new project file"), error, Log::Show); return false; @@ -526,7 +526,7 @@ bool ProjectManager::View::openProject(const PURL::Url &url) if ( reload && !MessageBox::askContinue(i18n("Project already loaded. Reload?"), i18n("Reload")) ) return false; static_cast< KRecentFilesAction *>(Main::action("project_open_recent"))->removeURL(url.kurl()); Project *p = new Project(url); - QString error; + TQString error; if ( !p->load(error) ) { MessageBox::detailedSorry(i18n("Could not open project file."), error, Log::Show); delete p; @@ -542,8 +542,8 @@ bool ProjectManager::View::openProject(const PURL::Url &url) files = _project->openedFiles(); for(it = files.begin(); it!=files.end(); ++it) Main::editorManager().openFile(*it); Register::list().init(); - QValueList<Register::TypeData> watched = _project->watchedRegisters(); - QValueList<Register::TypeData>::const_iterator wit; + TQValueList<Register::TypeData> watched = _project->watchedRegisters(); + TQValueList<Register::TypeData>::const_iterator wit; for (wit=watched.begin(); wit!=watched.end(); ++wit) Register::list().setWatched(*wit, true); return true; } @@ -551,7 +551,7 @@ bool ProjectManager::View::openProject(const PURL::Url &url) bool ProjectManager::View::isExternalFile(const PURL::Url &url) const { if ( projectUrl().isEmpty() ) return false; - return projectData().externals.contains(url); + return projectData().externals.tqcontains(url); } void ProjectManager::View::modified(const PURL::Url &url) @@ -560,7 +560,7 @@ void ProjectManager::View::modified(const PURL::Url &url) if ( item && !isExternalFile(url) ) _modified = true; } -void ProjectManager::View::renamed(QListViewItem *item, int, const QString &text) +void ProjectManager::View::renamed(TQListViewItem *item, int, const TQString &text) { Q_ASSERT ( item->rtti()==DeviceRtti ); Main::toplevel().setDevice(text); @@ -571,23 +571,23 @@ void ProjectManager::View::updateGUI() _deviceItem->updateText(); } -QDragObject *ProjectManager::View::dragObject() +TQDragObject *ProjectManager::View::dragObject() { if ( currentItem()==0 || currentItem()->rtti()!=FileRtti ) return 0; const FileItem *item = static_cast<const FileItem *>(currentItem()); - const HeaderItem *hitem = static_cast<const HeaderItem *>(item->parent()); + const HeaderItem *hitem = static_cast<const HeaderItem *>(item->tqparent()); if ( hitem->group()!=SourceGroup ) return 0; - QStrList uris; - uris.append(QUriDrag::localFileToUri(item->url().filepath())); - return new QUriDrag(uris, viewport()); + TQStrList uris; + uris.append(TQUriDrag::localFileToUri(item->url().filepath())); + return new TQUriDrag(uris, viewport()); } -bool ProjectManager::View::acceptDrag(QDropEvent* e) const +bool ProjectManager::View::acceptDrag(TQDropEvent* e) const { if ( e->source()!=viewport() ) return false; - const QListViewItem *item = itemAt(e->pos()); + const TQListViewItem *item = itemAt(e->pos()); if ( item==0 || item->rtti()!=FileRtti ) return false; - const HeaderItem *hitem = static_cast<const HeaderItem *>(item->parent()); + const HeaderItem *hitem = static_cast<const HeaderItem *>(item->tqparent()); return ( hitem->group()==SourceGroup ); } @@ -595,12 +595,12 @@ void ProjectManager::View::filesReordered() { if ( _project==0 ) return; _project->clearFiles(); - QListViewItem *item = headerItem(SourceGroup)->firstChild(); + TQListViewItem *item = headerItem(SourceGroup)->firstChild(); for (;item; item=item->nextSibling()) _project->addFile(static_cast<FileItem *>(item)->url()); } -QString ProjectManager::View::tooltip(QListViewItem *item, int) const +TQString ProjectManager::View::tooltip(TQListViewItem *item, int) const { switch (Rtti(item->rtti())) { case RootRtti: @@ -610,12 +610,12 @@ QString ProjectManager::View::tooltip(QListViewItem *item, int) const case RegisterRtti: case HeaderRtti: break; } - return QString::null; + return TQString(); } PURL::Url ProjectManager::View::linkerScriptUrl() const { - QListViewItemIterator it(const_cast<View *>(this)); + TQListViewItemIterator it(const_cast<View *>(this)); for(; it.current(); ++it) { if ( it.current()->rtti()!=LinkerScriptRtti ) continue; return static_cast<LinkerScriptItem *>(it.current())->url(); @@ -627,14 +627,14 @@ bool ProjectManager::View::needsRecompile() const { // ### this could be perfected... PURL::Url output = projectUrl().toFileType(PURL::Hex); - QDateTime outputLastModified; + TQDateTime outputLastModified; if ( !output.exists(&outputLastModified) ) return true; PURL::UrlList files; if ( Main::project() ) files = Main::project()->absoluteFiles(); else files.append(projectUrl()); PURL::UrlList::const_iterator it; for (it=files.begin(); it!=files.end(); ++it) { - QDateTime lastModified; + TQDateTime lastModified; if ( !(*it).exists(&lastModified) ) continue; if ( lastModified>outputLastModified ) return true; } @@ -643,7 +643,7 @@ bool ProjectManager::View::needsRecompile() const PURL::Url ProjectManager::View::selectedUrl() const { - QListViewItem *item = currentItem(); + TQListViewItem *item = currentItem(); if ( item==0 ) return PURL::Url(); Rtti rtti = Rtti(item->rtti()); if ( rtti!=FileRtti ) return PURL::Url(); |