Skip to content

Commit

Permalink
[#83945182] Rejigger connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
evanweaver committed Dec 8, 2014
1 parent 2b582e7 commit 1d3e030
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
4 changes: 1 addition & 3 deletions openstudiocore/src/openstudio_lib/OSAppBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ OSAppBase::OSAppBase( int & argc, char ** argv, const QSharedPointer<MeasureMana
{
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir();

auto updateUserMeasures = true;
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) {
QTimer::singleShot(0, this, SLOT(showMeasureUpdateDlg()));
updateUserMeasures = false;
}
else {
LOG(Debug, "Measures dir: " << openstudio::toString(userMeasuresDir));
Expand All @@ -58,7 +56,7 @@ OSAppBase::OSAppBase( int & argc, char ** argv, const QSharedPointer<MeasureMana
}
}

m_measureManager->updateMeasuresLists(updateUserMeasures);
m_measureManager->updateMeasuresLists();

m_waitDialog = boost::shared_ptr<WaitDialog>(new WaitDialog("Loading Model","Loading Model"));
}
Expand Down
8 changes: 4 additions & 4 deletions openstudiocore/src/pat_app/PatApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ PatApp::PatApp( int & argc, char ** argv, const QSharedPointer<ruleset::RubyUser
m_cloudDialog(nullptr),
m_measureManager(t_infoGetter, this)
{
connect(this, &PatApp::userMeasuresDirChanged, &m_measureManager, &MeasureManager::updateMeasuresLists);
bool isConnected = false;
isConnected = connect(this, SIGNAL(userMeasuresDirChanged()), &m_measureManager, SLOT(updateMeasuresLists()));
OS_ASSERT(isConnected);

setOrganizationName("NREL");
setOrganizationDomain("nrel.gov");
Expand Down Expand Up @@ -239,18 +241,16 @@ PatApp::PatApp( int & argc, char ** argv, const QSharedPointer<ruleset::RubyUser

openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir();

auto updateUserMeasures = true;
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) {
QMessageBox::information(this->mainWindow, "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);
updateUserMeasures = false;
}
else {
if (!QDir().exists(toQString(userMeasuresDir))) {
BCLMeasure::setUserMeasuresDir(userMeasuresDir);
}
}

m_measureManager.updateMeasuresLists(updateUserMeasures);
m_measureManager.updateMeasuresLists();

if (!fileName.isEmpty()){
if (openFile(fileName)){
Expand Down
13 changes: 13 additions & 0 deletions openstudiocore/src/shared_gui_components/MeasureManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include "../utilities/core/ApplicationPathHelpers.hpp"
#include "../utilities/core/Assert.hpp"
#include "../utilities/core/PathHelpers.hpp"
#include "../utilities/core/RubyException.hpp"
#include "../utilities/bcl/BCLMeasure.hpp"
#include "../utilities/bcl/RemoteBCL.hpp"
Expand Down Expand Up @@ -520,6 +521,18 @@ std::vector<BCLMeasure> MeasureManager::myMeasures() const
return result;
}

void MeasureManager::updateMeasuresLists()
{
openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir();

auto updateUserMeasures = true;
if (isNetworkPath(userMeasuresDir) && !isNetworkPathAvailable(userMeasuresDir)) {
updateUserMeasures = false;
}

updateMeasuresLists(updateUserMeasures);
}

void MeasureManager::updateMeasuresLists(bool updateUserMeasures)
{
m_patApplicationMeasures.clear();
Expand Down
4 changes: 3 additions & 1 deletion openstudiocore/src/shared_gui_components/MeasureManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class MeasureManager : public QObject
public slots:
/// Update the UI display for all measures. Does recompute the measure's XML.
/// Does not update the measures in the project at all
void updateMeasuresLists(bool updateUserMeasures = true);
void updateMeasuresLists();

/// For all measures in the "patApplicationMeasures" list which have changed relative to the version
/// in the project, update the project to the new version
Expand Down Expand Up @@ -181,6 +181,8 @@ class MeasureManager : public QObject
private:
REGISTER_LOGGER("openstudio.MeasureManager");

void updateMeasuresLists(bool updateUserMeasures);

BaseApp *m_app;
std::map<UUID,BCLMeasure> m_patApplicationMeasures;
std::map<UUID,BCLMeasure> m_myMeasures;
Expand Down

5 comments on commit 1d3e030

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

83945182_UserMeasuresDir (evanweaver) - x86_64-Linux-Ubuntu-14.04-clang-3.5: Tests Failed

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

83945182_UserMeasuresDir (evanweaver) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed)

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

83945182_UserMeasuresDir (evanweaver) - Win64-Windows-7-VisualStudio-12: OK (2170 of 2184 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

83945182_UserMeasuresDir (evanweaver) - i386-Windows-7-VisualStudio-12: OK (2166 of 2184 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

83945182_UserMeasuresDir (evanweaver) - x86_64-MacOS-10.9-clang: Build Failed

Build Badge Test Badge

Please sign in to comment.