From 1516b4fecc91f03d6658849d331e8f93e2e4526e Mon Sep 17 00:00:00 2001 From: yodalee Date: Thu, 8 Jan 2015 04:43:58 +0800 Subject: [PATCH] modify empty function, refresh time in projectView --- qucs/qucs/projectView.cpp | 5 ++--- qucs/qucs/qucs.cpp | 25 +++---------------------- qucs/qucs/qucs.h | 2 -- qucs/qucs/qucs_actions.cpp | 4 ++-- 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/qucs/qucs/projectView.cpp b/qucs/qucs/projectView.cpp index 63670e6940..d5deadec32 100644 --- a/qucs/qucs/projectView.cpp +++ b/qucs/qucs/projectView.cpp @@ -51,7 +51,7 @@ ProjectView::~ProjectView() void ProjectView::setProjPath(const QString &path) { - m_valid = QDir(path).exists(); + m_valid = !path.isEmpty() && QDir(path).exists(); if (m_valid) { //test path exist @@ -67,9 +67,8 @@ ProjectView::setProjPath(const QString &path) m_projName = m_projName.mid(i+1); // cut out the last subdirectory } m_projName.remove("_prj"); - - refresh(); } + refresh(); } // refresh using projectPath diff --git a/qucs/qucs/qucs.cpp b/qucs/qucs/qucs.cpp index 950867756e..2bc6e6e968 100644 --- a/qucs/qucs/qucs.cpp +++ b/qucs/qucs/qucs.cpp @@ -190,10 +190,6 @@ QucsApp::~QucsApp() // ########## Creates the working area (QTabWidget etc.) ########## // ########## ########## // ####################################################################### -void QucsApp::initContentListView() -{ -} - /** * @brief QucsApp::initView Setup the layour of all widgets */ @@ -1123,17 +1119,6 @@ void QucsApp::slotButtonProjNew() } } -// ---------------------------------------------------------- -// Reads all files in the project directory and sort them into the -// content ListView -void QucsApp::readProjectFiles() -{ - //Is this OK instead of the above?? - initContentListView(); - - slotUpdateTreeview(); -} - // ---------------------------------------------------------- // Opens an existing project. void QucsApp::openProject(const QString& Path) @@ -1165,9 +1150,6 @@ void QucsApp::openProject(const QString& Path) Content->setProjPath(QucsSettings.QucsWorkDir.absolutePath()); - QStringList headers; - readProjectFiles(); - TabView->setCurrentPage(1); // switch to "Content"-Tab ProjName = Name; // remember the name of project @@ -1226,8 +1208,7 @@ void QucsApp::slotMenuProjClose() QucsSettings.QucsWorkDir.setPath(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs")); octave->adjustDirectory(); - QStringList headers; - initContentListView(); + Content->setProjPath(""); TabView->setCurrentPage(0); // switch to "Projects"-Tab ProjName = ""; @@ -1453,7 +1434,7 @@ void QucsApp::slotFileSave() statusBar()->message(tr("Ready.")); if(!ProjName.isEmpty()) - readProjectFiles(); // re-read the content ListView + slotUpdateTreeview(); } // -------------------------------------------------------------- @@ -1565,7 +1546,7 @@ void QucsApp::slotFileSaveAs() this->updateSpiceNameHash(); if(!ProjName.isEmpty()) - readProjectFiles(); // re-read the content ListView + slotUpdateTreeview(); } diff --git a/qucs/qucs/qucs.h b/qucs/qucs/qucs.h index 183b374cbf..3860036865 100644 --- a/qucs/qucs/qucs.h +++ b/qucs/qucs/qucs.h @@ -203,7 +203,6 @@ private slots: // ********** Methods *************************************************** void initView(); void initCursorMenu(); - void initContentListView(); void printCurrentDocument(bool); bool saveFile(QucsDoc *Doc=0); @@ -226,7 +225,6 @@ private slots: public: void readProjects(); - void readProjectFiles(); void updatePathList(void); // update the list of paths, pruning non-existing paths void updatePathList(QStringList); void updateSchNameHash(void); // maps all schematic files in the path list diff --git a/qucs/qucs/qucs_actions.cpp b/qucs/qucs/qucs_actions.cpp index 247ef2016c..0c7e0b0072 100644 --- a/qucs/qucs/qucs_actions.cpp +++ b/qucs/qucs/qucs_actions.cpp @@ -952,7 +952,7 @@ void QucsApp::slotAddToProject() } free(Buffer); - readProjectFiles(); // re-read the content ListView + slotUpdateTreeview(); statusBar()->message(tr("Ready.")); } @@ -1257,7 +1257,7 @@ void QucsApp::slotImportData() ImportDialog *d = new ImportDialog(this); if(d->exec() == QDialog::Accepted) - readProjectFiles(); // re-read all project files + slotUpdateTreeview(); } // -----------------------------------------------------------