-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
…le network path.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -33,6 +33,7 @@ | |||
#include "../analysisdriver/SimpleProject.hpp" | ||||
|
||||
#include "../utilities/bcl/LocalBCL.hpp" | ||||
#include "../utilities/core/PathHelpers.hpp" | ||||
|
||||
#include <QDir> | ||||
#include <QMessageBox> | ||||
|
@@ -42,12 +43,18 @@ namespace openstudio { | |||
OSAppBase::OSAppBase( int & argc, char ** argv, const QSharedPointer<MeasureManager> &t_measureManager ) | ||||
: QApplication(argc, argv), m_measureManager(t_measureManager) | ||||
{ | ||||
LOG(Debug, "Measures dir: " << openstudio::toString(BCLMeasure::userMeasuresDir())); | ||||
if (!QDir().exists(toQString(BCLMeasure::userMeasuresDir()))){ | ||||
BCLMeasure::setUserMeasuresDir(BCLMeasure::userMeasuresDir()); | ||||
} | ||||
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir(); | ||||
|
||||
m_measureManager->updateMeasuresLists(); | ||||
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) { | ||||
QMessageBox::information(this->mainWidget(), "Network Connection Problem", "Unable to update Measures list.\nYour User Measures Directory appears to be a network directory and is not currently available.\nYou can change your specified User Measures Directory using Preferences->Change My Measures Directory.", QMessageBox::Ok); | ||||
This comment has been minimized.
Sorry, something went wrong. |
||||
} | ||||
else { | ||||
LOG(Debug, "Measures dir: " << openstudio::toString(userMeasuresDir)); | ||||
if (!QDir().exists(toQString(userMeasuresDir))){ | ||||
BCLMeasure::setUserMeasuresDir(userMeasuresDir); | ||||
} | ||||
m_measureManager->updateMeasuresLists(); | ||||
This comment has been minimized.
Sorry, something went wrong.
macumber
Contributor
|
void MeasureManager::updateMeasuresLists() |
void MeasureManager::updateMeasuresLists(bool updateUserMeasures=true)
If network drive is down you should still update the BCL and application measures
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
macumber
Dec 5, 2014
Contributor
You should not call BCLMeasure::setUserMeasuresDir(userMeasuresDir); if userMeasuresDir is on an unavailable network drive (you aren't currently but just FYI)
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1525,13 +1525,27 @@ void OSDocument::openMeasuresDlg() | |
void OSDocument::openChangeMeasuresDirDlg() | ||
{ | ||
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir(); | ||
|
||
QString dirName = QFileDialog::getExistingDirectory( this->mainWindow(), | ||
tr("Select My Measures Directory"), | ||
toQString(userMeasuresDir)); | ||
|
||
|
||
QString dirName(""); | ||
|
||
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) { | ||
QString dirName = QFileDialog::getExistingDirectory(this->mainWindow(), | ||
tr("Select My Measures Directory")); | ||
} | ||
else { | ||
QString dirName = QFileDialog::getExistingDirectory(this->mainWindow(), | ||
tr("Select My Measures Directory"), | ||
toQString(userMeasuresDir)); | ||
} | ||
|
||
userMeasuresDir = toPath(dirName); | ||
|
||
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) { | ||
QMessageBox::information(this->mainWindow(), "Network Connection Problem", "Unable to use new directory.\nYour User Measures Directory appears to be a network directory and is not currently available.\nYou can change your specified User Measures Directory using Preferences->Change My Measures Directory.", QMessageBox::Ok); | ||
This comment has been minimized.
Sorry, something went wrong.
macumber
Contributor
|
||
return; | ||
} | ||
|
||
if(dirName.length() > 0){ | ||
userMeasuresDir = toPath(dirName); | ||
if (BCLMeasure::setUserMeasuresDir(userMeasuresDir)){ | ||
OSAppBase::instance()->measureManager().updateMeasuresLists(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,18 +21,19 @@ | |
|
||
#include "../utilities/core/Assert.hpp" | ||
#include "../utilities/core/StringHelpers.hpp" | ||
#include "../utilities/core/PathHelpers.hpp" | ||
|
||
#include <QBoxLayout> | ||
#include <QComboBox> | ||
#include <QGroupBox> | ||
#include <QLabel> | ||
#include <QLineEdit> | ||
#include <QTextEdit> | ||
#include <QComboBox> | ||
#include <QVBoxLayout> | ||
#include <QHBoxLayout> | ||
#include <QListWidget> | ||
#include <QListWidgetItem> | ||
#include <QMessageBox> | ||
#include <QPushButton> | ||
#include <QRadioButton> | ||
#include <QGroupBox> | ||
#include <QListWidgetItem> | ||
#include <QListWidget> | ||
#include <QTextEdit> | ||
|
||
namespace openstudio { | ||
|
||
|
@@ -122,6 +123,13 @@ QSize BCLMeasureDialog::sizeHint() const | |
|
||
boost::optional<openstudio::BCLMeasure> BCLMeasureDialog::createMeasure() | ||
{ | ||
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir(); | ||
|
||
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) { | ||
QMessageBox::information(this, "Network Connection Problem", "Unable to create measure.\nYour User Measures Directory appears to be a network directory and is not currently available.\nYou can change the specified directory using Preferences->Change My Measures Directory.", QMessageBox::Ok); | ||
This comment has been minimized.
Sorry, something went wrong.
macumber
Contributor
|
||
return boost::optional<openstudio::BCLMeasure>(); | ||
} | ||
|
||
std::string name = toString(m_nameLineEdit->text()); | ||
std::string className = BCLMeasure::makeClassName(name); | ||
std::string lowerClassName = toUnderscoreCase(className); | ||
|
@@ -140,7 +148,6 @@ boost::optional<openstudio::BCLMeasure> BCLMeasureDialog::createMeasure() | |
measureType = MeasureType::ReportingMeasure; | ||
} | ||
|
||
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir(); | ||
QString folderName = toQString(lowerClassName).append("/"); | ||
openstudio::path measureDir = userMeasuresDir / toPath(folderName); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,13 +27,17 @@ | |
#include "OSListView.hpp" | ||
#include "OSViewSwitcher.hpp" | ||
|
||
#include "../openstudio_lib/MainWindow.hpp" | ||
#include "../openstudio_lib/OSAppBase.hpp" | ||
#include "../openstudio_lib/OSDocument.hpp" | ||
#include "../openstudio_lib/OSItem.hpp" | ||
|
||
#include "MeasureBadge.hpp" | ||
|
||
#include "../utilities/bcl/LocalBCL.hpp" | ||
#include "../utilities/core/Assert.hpp" | ||
#include "../utilities/core/Compare.hpp" | ||
#include "../utilities/core/PathHelpers.hpp" | ||
|
||
#include <OpenStudio.hxx> | ||
|
||
|
@@ -44,6 +48,7 @@ | |
#include <QDrag> | ||
#include <QFile> | ||
#include <QLabel> | ||
#include <QMessageBox> | ||
#include <QMimeData> | ||
#include <QSettings> | ||
#include <QVariant> | ||
|
@@ -145,8 +150,14 @@ void LocalLibraryController::showMeasures() | |
void LocalLibraryController::showMyMeasuresFolder() | ||
{ | ||
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir(); | ||
QString path = QDir::toNativeSeparators(toQString(userMeasuresDir)); | ||
QDesktopServices::openUrl(QUrl("file:///" + path)); | ||
|
||
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) { | ||
This comment has been minimized.
Sorry, something went wrong.
macumber
Contributor
|
||
QMessageBox::information(QApplication::activeWindow(), "Network Connection Problem", "Unable to show My Measures folder.\nYour User Measures Directory appears to be a network directory and is not currently available.\nYou can change your specified User Measures Directory using Preferences->Change My Measures Directory.", QMessageBox::Ok); | ||
This comment has been minimized.
Sorry, something went wrong.
macumber
Contributor
|
||
} | ||
else { | ||
QString path = QDir::toNativeSeparators(toQString(userMeasuresDir)); | ||
QDesktopServices::openUrl(QUrl("file:///" + path)); | ||
} | ||
} | ||
|
||
QSharedPointer<LibraryTypeListController> LocalLibraryController::createLibraryListController(const QDomDocument & taxonomy, LocalLibrary::LibrarySource source) | ||
|
@@ -685,6 +696,12 @@ void LibraryListController::createItems() | |
|
||
// create items | ||
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir(); | ||
|
||
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) { | ||
QMessageBox::information(QApplication::activeWindow(), "Network Connection Problem", "Unable to create Measure library list.\nYour User Measures Directory appears to be a network directory and is not currently available.\nYou can change your specified User Measures Directory using Preferences->Change My Measures Directory.", QMessageBox::Ok); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return; | ||
} | ||
|
||
for( const auto & measure : measures ) | ||
{ | ||
if( m_taxonomyTag.compare(QString::fromStdString(measure.taxonomyTag()),Qt::CaseInsensitive) == 0 ) | ||
|
4 comments
on commit 392a9e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evanweaver I made a bunch of comments on this page, we can discuss if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evanweaver Overall nice job!
Wordsmithing:
"Cannot Update User Measures"
"Your My Measures Directory appears to be on a network drive that is not currently available.\nYou can change your specified My Measures Directory using 'Preferences->Change My Measures Directory'."