From 84f5a315c3429b47a7eff15e626e2efdbe4f6e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Tue, 8 Oct 2013 00:13:25 +0200 Subject: Initial TQt conversion --- src/kscope.cpp | 166 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'src/kscope.cpp') diff --git a/src/kscope.cpp b/src/kscope.cpp index 3e4c134..5e56233 100644 --- a/src/kscope.cpp +++ b/src/kscope.cpp @@ -25,7 +25,7 @@ * ***************************************************************************/ -#include +#include #include #include #include @@ -71,7 +71,7 @@ * @param pParent The parent widget * @param szName The widget's name */ -KScope::KScope(QWidget* pParent, const char* szName) : +KScope::KScope(TQWidget* pParent, const char* szName) : KParts::DockMainWindow(pParent, szName), m_pCscopeBuild(NULL), m_sCurFilePath(""), @@ -82,7 +82,7 @@ KScope::KScope(QWidget* pParent, const char* szName) : m_bRebuildDB(false), m_pMakeDlg(NULL) { - QString sPath; + TQString sPath; // Load configuration Config().load(); @@ -93,8 +93,8 @@ KScope::KScope(QWidget* pParent, const char* szName) : m_pFileView = new FileView(this); m_pFileList = m_pFileView->getFileList(); m_pMsgDlg = new CscopeMsgDlg(this); - m_pQueryDock = createDockWidget("Query Window", QPixmap()); - m_pFileViewDock = createDockWidget("File List Window", QPixmap()); + m_pQueryDock = createDockWidget("Query Window", TQPixmap()); + m_pFileViewDock = createDockWidget("File List Window", TQPixmap()); // Connect menu and toolbar items with the object's slots m_pActions = new KScopeActions(this); @@ -121,23 +121,23 @@ KScope::KScope(QWidget* pParent, const char* szName) : // Open a file for editing when selected in the project's file list or the // file tree - connect(m_pFileView, SIGNAL(fileRequested(const QString&, uint)), this, - SLOT(slotShowEditor(const QString&, uint))); + connect(m_pFileView, SIGNAL(fileRequested(const TQString&, uint)), this, + SLOT(slotShowEditor(const TQString&, uint))); // Delete an editor page object after it is removed connect(m_pEditTabs, SIGNAL(editorRemoved(EditorPage*)), this, SLOT(slotDeleteEditor(EditorPage*))); - connect(m_pEditTabs, SIGNAL(filesDropped(QDropEvent*)), this, - SLOT(slotDropEvent(QDropEvent*))); + connect(m_pEditTabs, SIGNAL(filesDropped(TQDropEvent*)), this, + SLOT(slotDropEvent(TQDropEvent*))); // Set an editor as the active part whenever its owner tab is selected connect(m_pEditTabs, SIGNAL(editorChanged(EditorPage*, EditorPage*)), this, SLOT(slotChangeEditor(EditorPage*, EditorPage*))); // Display a file at a specific line when selected in a query list - connect(m_pQueryWidget, SIGNAL(lineRequested(const QString&, uint)), - this, SLOT(slotQueryShowEditor(const QString&, uint))); + connect(m_pQueryWidget, SIGNAL(lineRequested(const TQString&, uint)), + this, SLOT(slotQueryShowEditor(const TQString&, uint))); // Display the symbol dialogue when the user opens a new query page connect(m_pQueryWidget, SIGNAL(newQuery()), @@ -148,8 +148,8 @@ KScope::KScope(QWidget* pParent, const char* szName) : connect(&m_timerRebuild, SIGNAL(timeout()), this, SLOT(slotRebuildDB())); // Display a file at a specific line when selected in a call tree dialogue - connect(m_pCallTreeMgr, SIGNAL(lineRequested(const QString&, uint)), - this, SLOT(slotQueryShowEditor(const QString&, uint))); + connect(m_pCallTreeMgr, SIGNAL(lineRequested(const TQString&, uint)), + this, SLOT(slotQueryShowEditor(const TQString&, uint))); // Store main window settings when closed setAutoSaveSettings(); @@ -203,14 +203,14 @@ void KScope::initMainWindow() { KStatusBar* pStatus; KDockWidget* pMainDock; - QPopupMenu* pPopup; + TQPopupMenu* pPopup; // Create the status bar pStatus = statusBar(); pStatus->insertItem(i18n(" Line: N/A Col: N/A "), 0, 0, true); // Create the main dock for the editor tabs widget - pMainDock = createDockWidget("Editors Window", QPixmap()); + pMainDock = createDockWidget("Editors Window", TQPixmap()); pMainDock->setWidget(m_pEditTabs); pMainDock->setDockSite(KDockWidget::DockCorner); setMainDockWidget(pMainDock); @@ -236,11 +236,11 @@ void KScope::initMainWindow() SLOT(slotFileViewDockClosed())); // Associate the "Window" menu with the editor tabs widdget - pPopup = (QPopupMenu*)factory()->container("window", this); + pPopup = (TQPopupMenu*)factory()->container("window", this); m_pEditTabs->setWindowMenu(pPopup); // Associate the "Query" popup menu with the query widget - pPopup = (QPopupMenu*)factory()->container("query_popup", this); + pPopup = (TQPopupMenu*)factory()->container("query_popup", this); m_pQueryWidget->setPageMenu(pPopup, m_pActions->getLockAction()); // Restore dock configuration @@ -284,7 +284,7 @@ void KScope::slotCreateProject() { NewProjectDlg dlg(true, this); ProjectBase::Options opt; - QString sProjPath; + TQString sProjPath; // Prompt the user to close any active projects if (m_pProjMgr->curProject()) { @@ -301,7 +301,7 @@ void KScope::slotCreateProject() } // Display the "New Project" dialog - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; // Create and open the new project @@ -318,15 +318,15 @@ void KScope::slotCreateProject() void KScope::slotOpenProject() { OpenProjectDlg dlg; - QString sPath; + TQString sPath; - if (dlg.exec() == QDialog::Rejected) + if (dlg.exec() == TQDialog::Rejected) return; sPath = dlg.getPath(); // Check if the path refers to a permanent or temporary project - if (QFileInfo(sPath).isDir()) + if (TQFileInfo(sPath).isDir()) openProject(sPath); else openCscopeOut(sPath); @@ -355,7 +355,7 @@ void KScope::slotProjectFiles() // Display the files dialog ProjectFilesDlg dlg((Project*)pProj, this); - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; // Update the project's file list @@ -392,7 +392,7 @@ void KScope::slotProjectProps() dlg.setProperties(pProj->getName(), pProj->getPath(), opt); // Display the properties dialog - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; // Set new properties @@ -420,7 +420,7 @@ void KScope::slotProjectProps() */ void KScope::slotProjectCscopeOut() { - QString sFilePath; + TQString sFilePath; // Prompt for a Cscope.out file sFilePath = KFileDialog::getOpenFileName(); @@ -520,7 +520,7 @@ void KScope::slotQueryIncluding() */ void KScope::slotQueryQuickDef() { - QString sSymbol; + TQString sSymbol; QueryViewDlg* pDlg; uint nType; bool bCase; @@ -534,8 +534,8 @@ void KScope::slotQueryQuickDef() pDlg = new QueryViewDlg(QueryViewDlg::DestroyOnSelect, this); // Display a line when it is selected in the dialogue - connect(pDlg, SIGNAL(lineRequested(const QString&, uint)), this, - SLOT(slotShowEditor(const QString&, uint))); + connect(pDlg, SIGNAL(lineRequested(const TQString&, uint)), this, + SLOT(slotShowEditor(const TQString&, uint))); // Start the query pDlg->query(nType, sSymbol); @@ -596,7 +596,7 @@ void KScope::slotConfigure() connect(&dlg, SIGNAL(applyPref()), this, SLOT(slotApplyPref())); // Show the dialog - if (dlg.exec() == QDialog::Accepted) { + if (dlg.exec() == TQDialog::Accepted) { // Verify Cscope's installation verifyCscope(); } @@ -610,7 +610,7 @@ void KScope::slotConfigure() */ void KScope::slotProjectFilesChanged() { - QStringList slArgs; + TQStringList slArgs; // Refresh the file list m_pFileList->setUpdatesEnabled(false); @@ -630,9 +630,9 @@ void KScope::slotProjectFilesChanged() * file list, and the project's database is rebuilt. * @param slFiles The list of file paths added to the project */ -void KScope::slotFilesAdded(const QStringList& slFiles) +void KScope::slotFilesAdded(const TQStringList& slFiles) { - QStringList::const_iterator itr; + TQStringList::const_iterator itr; // Add the file paths to the project's file list for (itr = slFiles.begin(); itr != slFiles.end(); ++itr) @@ -651,7 +651,7 @@ void KScope::slotFilesAdded(const QStringList& slFiles) */ void KScope::slotQuery(uint nType, bool bPrompt) { - QString sSymbol; + TQString sSymbol; CallTreeDlg* pCallTreeDlg; bool bCase; @@ -680,13 +680,13 @@ void KScope::slotQuery(uint nType, bool bPrompt) * If another project is currently active, it is closed first. * @param sDir The directory of the project to open. */ -void KScope::openProject(const QString& sDir) +void KScope::openProject(const TQString& sDir) { - QString sProjDir; + TQString sProjDir; ProjectBase* pProj; - QStringList slQueryFiles; - QStringList slCallTreeFiles; - QStringList slArgs; + TQStringList slQueryFiles; + TQStringList slCallTreeFiles; + TQStringList slArgs; ProjectBase::Options opt; // Close the current project (may return false if the user clicks on the @@ -695,7 +695,7 @@ void KScope::openProject(const QString& sDir) return; // Open the project in the project manager - sProjDir = QDir::cleanDirPath(sDir); + sProjDir = TQDir::cleanDirPath(sDir); if (!m_pProjMgr->open(sProjDir)) return; @@ -754,7 +754,7 @@ void KScope::openProject(const QString& sDir) * @param sFilePath The full path of the Cscope.out file * @return true if successful, false otherwise */ -bool KScope::openCscopeOut(const QString& sFilePath) +bool KScope::openCscopeOut(const TQString& sFilePath) { ProjectBase* pProj; @@ -798,8 +798,8 @@ bool KScope::openCscopeOut(const QString& sFilePath) */ void KScope::openLastProject() { - const QStringList slProjects = Config().getRecentProjects(); - QString sPath; + const TQStringList slProjects = Config().getRecentProjects(); + TQString sPath; if (slProjects.empty()) return; @@ -808,7 +808,7 @@ void KScope::openLastProject() sPath = *slProjects.begin(); // Check if the path refers to a temporary project - if (!QFileInfo(sPath).isDir()) { + if (!TQFileInfo(sPath).isDir()) { openCscopeOut(sPath); return; } @@ -846,7 +846,7 @@ void KScope::restoreSession() for (pLoc = sess.fllOpenFiles.first(); pLoc != NULL; pLoc = sess.fllOpenFiles.next()) { - if (QFile::exists(pLoc->m_sPath)) { + if (TQFile::exists(pLoc->m_sPath)) { pPage = addEditor(pLoc->m_sPath); pPage->setCursorPos(pLoc->m_nLine, pLoc->m_nCol); } @@ -901,8 +901,8 @@ void KScope::toggleQueryWindow(bool bShow) */ void KScope::parseCmdLine(KCmdLineArgs* pArgs) { - QString sArg; - QFileInfo fi; + TQString sArg; + TQFileInfo fi; int i; // Loop over all arguments @@ -981,8 +981,8 @@ void KScope::initCscope() SLOT(slotBuildAborted())); // Show errors in a modeless dialogue - connect(m_pCscopeBuild, SIGNAL(error(const QString&)), this, - SLOT(slotCscopeError(const QString&))); + connect(m_pCscopeBuild, SIGNAL(error(const TQString&)), this, + SLOT(slotCscopeError(const TQString&))); } /** @@ -1052,7 +1052,7 @@ bool KScope::slotCloseProject() m_pProjMgr->close(); delete m_pCscopeBuild; m_pCscopeBuild = NULL; - setCaption(QString::null); + setCaption(TQString::null); // Clear the contents of the file list m_pFileView->clear(); @@ -1072,13 +1072,13 @@ bool KScope::slotCloseProject() */ void KScope::slotExtEdit() { - QString sCmdLine; + TQString sCmdLine; KProcess proc; // Create the command line for the external editor sCmdLine = Config().getExtEditor(); sCmdLine.replace("%F", m_sCurFilePath); - sCmdLine.replace("%L", QString::number(m_nCurLine)); + sCmdLine.replace("%L", TQString::number(m_nCurLine)); // Run the external editor proc.setUseShell(true); @@ -1161,7 +1161,7 @@ void KScope::slotCscopeVerified(bool bResult, uint nArgs) */ void KScope::slotProjectMake() { - QString sCmd, sDir; + TQString sCmd, sDir; // Create the make dialogue, if it does not exist if (m_pMakeDlg == NULL) { @@ -1174,8 +1174,8 @@ void KScope::slotProjectMake() m_pMakeDlg->setDir(sDir); // Show the relevant source location when an error link is clicked - connect(m_pMakeDlg, SIGNAL(fileRequested(const QString&, uint)), this, - SLOT(slotShowEditor(const QString&, uint))); + connect(m_pMakeDlg, SIGNAL(fileRequested(const TQString&, uint)), this, + SLOT(slotShowEditor(const TQString&, uint))); // Show the dialogue m_pMakeDlg->show(); @@ -1212,14 +1212,14 @@ void KScope::slotProjectRemake() void KScope::slotShowBookmarks() { BookmarksDlg dlg; - QString sPath; + TQString sPath; uint nLine; // Load the bookmark list m_pEditTabs->showBookmarks(dlg.getView()); // Show the dialogue - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; // Go to the selected bookmark @@ -1239,11 +1239,11 @@ void KScope::slotShowBookmarks() * determined automatically * @return true if the user hs enetered a symbol, false otherwise */ -bool KScope::getSymbol(uint& nType, QString& sSymbol, bool& bCase, +bool KScope::getSymbol(uint& nType, TQString& sSymbol, bool& bCase, bool bPrompt) { EditorPage* pPage; - QString sSuggested; + TQString sSuggested; // Set the currently selected text, if any if ((pPage = m_pEditTabs->getCurrentPage()) != NULL) @@ -1272,10 +1272,10 @@ bool KScope::getSymbol(uint& nType, QString& sSymbol, bool& bCase, * @param sFilePath The path of the file to open * @return A pointer to the found or newly created editor page */ -EditorPage* KScope::addEditor(const QString& sFilePath) +EditorPage* KScope::addEditor(const TQString& sFilePath) { EditorPage* pPage; - QString sAbsFilePath; + TQString sAbsFilePath; ProjectBase* pProj; // If the file name is given using a relative path, we need to convert @@ -1283,11 +1283,11 @@ EditorPage* KScope::addEditor(const QString& sFilePath) // TODO: Project needs a translatePath() method pProj = m_pProjMgr->curProject(); if (sFilePath[0] != '/' && pProj) { - sAbsFilePath = QDir::cleanDirPath(pProj->getSourceRoot() + "/" + + sAbsFilePath = TQDir::cleanDirPath(pProj->getSourceRoot() + "/" + sFilePath); } else { - sAbsFilePath = QDir::cleanDirPath(sFilePath); + sAbsFilePath = TQDir::cleanDirPath(sFilePath); } // Do not open a new editor if one exists for this file @@ -1312,7 +1312,7 @@ EditorPage* KScope::createEditorPage() { KTextEditor::Document* pDoc; EditorPage* pPage; - QPopupMenu* pMenu; + TQPopupMenu* pMenu; ProjectBase* pProj; // Load a new document part @@ -1321,26 +1321,26 @@ EditorPage* KScope::createEditorPage() return NULL; // Create the new editor page - pMenu = (QPopupMenu*)factory()->container(Config().getEditorPopupName(), + pMenu = (TQPopupMenu*)factory()->container(Config().getEditorPopupName(), this); pPage = new EditorPage(pDoc, pMenu, m_pEditTabs); m_pEditTabs->addEditorPage(pPage); // Show the file's path in the main title - connect(pPage, SIGNAL(fileOpened(EditorPage*, const QString&)), this, - SLOT(slotFileOpened(EditorPage*, const QString&))); + connect(pPage, SIGNAL(fileOpened(EditorPage*, const TQString&)), this, + SLOT(slotFileOpened(EditorPage*, const TQString&))); // Show cursor position in the status bar connect(pPage, SIGNAL(cursorPosChanged(uint, uint)), this, SLOT(slotShowCursorPos(uint, uint))); // Rebuild the database after a file has changed - connect(pPage, SIGNAL(fileSaved(const QString&, bool)), this, - SLOT(slotFileSaved(const QString&, bool))); + connect(pPage, SIGNAL(fileSaved(const TQString&, bool)), this, + SLOT(slotFileSaved(const TQString&, bool))); // Handle file drops - connect(pPage->getView(), SIGNAL(dropEventPass(QDropEvent*)), this, - SLOT(slotDropEvent(QDropEvent*))); + connect(pPage->getView(), SIGNAL(dropEventPass(TQDropEvent*)), this, + SLOT(slotDropEvent(TQDropEvent*))); // Apply per-project configuration pProj = m_pProjMgr->curProject(); @@ -1416,7 +1416,7 @@ void KScope::slotChangeEditor(EditorPage* pOldPage, EditorPage* pNewPage) * cursor, or 0 to maintain the cursor in its current * position (which does not affect the position history) */ -void KScope::slotShowEditor(const QString& sFilePath, uint nLine) +void KScope::slotShowEditor(const TQString& sFilePath, uint nLine) { EditorPage* pPage; @@ -1453,7 +1453,7 @@ void KScope::slotShowEditor(const QString& sFilePath, uint nLine) * @param sFilePath The full path of the file to open for editing * @param nLine The number of the line on which to position the cursor */ -void KScope::slotQueryShowEditor(const QString& sFilePath, uint nLine) +void KScope::slotQueryShowEditor(const TQString& sFilePath, uint nLine) { // Hide the query window, if it was hidden before a query was initiated if (m_bHideQueryOnSelection) @@ -1496,13 +1496,13 @@ void KScope::slotNewFile() void KScope::slotOpenFile() { ProjectBase* pProj; - QStringList slFiles; - QStringList::Iterator itr; + TQStringList slFiles; + TQStringList::Iterator itr; // Prompt the user for the file(s) to open. pProj = m_pProjMgr->curProject(); slFiles = KFileDialog::getOpenFileNames(pProj ? pProj->getSourceRoot() : - QString::null); + TQString::null); // Open all selected files. for (itr = slFiles.begin(); itr != slFiles.end(); ++itr) { @@ -1537,7 +1537,7 @@ void KScope::slotCloseAllWindows() * Cscope process. * @param sMsg The error message */ -void KScope::slotCscopeError(const QString& sMsg) +void KScope::slotCscopeError(const TQString& sMsg) { m_pMsgDlg->addText(sMsg); } @@ -1553,7 +1553,7 @@ void KScope::slotCscopeError(const QString& sMsg) */ void KScope::slotBuildProgress(int nFiles, int nTotal) { - QString sMsg; + TQString sMsg; // Use the progress dialogue, if it exists (first time builds) if (m_pProgressDlg) { @@ -1563,7 +1563,7 @@ void KScope::slotBuildProgress(int nFiles, int nTotal) // Show progress information sMsg = i18n("Rebuilding the cross reference database...") + " " + - QString::number((nFiles * 100) / nTotal) + "%"; + TQString::number((nFiles * 100) / nTotal) + "%"; statusBar()->message(sMsg); } @@ -1654,10 +1654,10 @@ void KScope::slotApplyPref() void KScope::slotShowCursorPos(uint nLine, uint nCol) { KStatusBar* pStatus = statusBar(); - QString sText; + TQString sText; /* Show the line and column numbers. */ - QTextOStream(&sText) << " Line: " << nLine << " Col: " << nCol << " "; + TQTextOStream(&sText) << " Line: " << nLine << " Col: " << nCol << " "; pStatus->changeItem(sText, 0); /* Store the current line. */ @@ -1670,7 +1670,7 @@ void KScope::slotShowCursorPos(uint nLine, uint nCol) * EditorPage object. * @param sFilePath The full path of the opened file */ -void KScope::slotFileOpened(EditorPage*, const QString& sFilePath) +void KScope::slotFileOpened(EditorPage*, const TQString& sFilePath) { m_sCurFilePath = sFilePath; setCaption(m_pProjMgr->getProjName() + " - " + m_sCurFilePath); @@ -1684,7 +1684,7 @@ void KScope::slotFileOpened(EditorPage*, const QString& sFilePath) * @param sPath The full path of the modified file that caused this event * @param bIsNew true if this is a new file, false otherwise */ -void KScope::slotFileSaved(const QString& sPath, bool bIsNew) +void KScope::slotFileSaved(const TQString& sPath, bool bIsNew) { ProjectBase* pProj; int nTime; @@ -1741,7 +1741,7 @@ void KScope::slotFileSaved(const QString& sPath, bool bIsNew) * Opens all files dropped over the widget. * @param pEvent Pointer to an object containing the list of dropped files */ -void KScope::slotDropEvent(QDropEvent* pEvent) +void KScope::slotDropEvent(TQDropEvent* pEvent) { KURL::List list; KURL::List::Iterator itr; -- cgit v1.2.1