Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
nwagenbrenner committed Aug 9, 2024
2 parents d456744 + 3843a07 commit 2d9276e
Show file tree
Hide file tree
Showing 23 changed files with 1,814 additions and 951 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ if(C_API)
add_definitions(-DC_API)
endif(C_API)

# Enable phone home and message server startup
option(PHONE_HOME_QUERIES "Enable Phone Home Queries" ON)

if (PHONE_HOME_QUERIES)
add_definitions(-DPHONE_HOME_QUERIES_ENABLED)
message(STATUS "Phone Home Queries are enabled.")
else()
message(STATUS "Phone Home Queries are disabled.")
endif()

# OpenFOAM related options
option(NINJAFOAM "Enable OpenFOAM solver" ON)
if(NINJAFOAM)
Expand Down Expand Up @@ -421,6 +431,7 @@ set(share_files date_time_zonespec.csv
map.htm
thredds.csv
surface_data.zip
srtm_region.geojson
us_srtm_region.dbf
us_srtm_region.prj
us_srtm_region.shp
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ Nicolás Chiaraviglio <[email protected]>
Peter Mehlitz <[email protected]>
Tanner Finney <[email protected]>
Tomàs Margalef <[email protected]>
Hannah Gedlaman <[email protected]>
Nicholas Kim <[email protected]>
Rui Zhang <[email protected]>
2 changes: 1 addition & 1 deletion src/cli/cmake_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
int main(int argc, char *argv[])
{
CPLSetConfigOption( "NINJA_DISABLE_CALL_HOME", "ON" );
NinjaInitialize();
NinjaInitialize("cli");
//set a different key for the CLI since this is where users are likely to abuse access
if(CPLGetConfigOption("NINJA_CLI_SRTM_API_KEY", NULL) != NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/WidgetDownloadDEM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void WidgetDownloadDEM::updateProgress()

if(result < 0)
{
progressBar->setLabelText("The surface data download failed. \nThis normally happens when either the data source doesn't cover your region or the server that provides the surface data is down or under high usage. \nPlease try again later or try a different data source.");
progressBar->setLabelText("The surface data download failed. \nThis can happen when either the data source doesn't cover your region or the server that provides the surface data is down or under high usage. \nPlease try again later or try a different data source.");
progressBar->setRange(0,1);
progressBar->setValue( 0 );
progressBar->setCancelButtonText("Close");
Expand Down
2 changes: 1 addition & 1 deletion src/gui/cmake_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, char *argv[])
return result;
}

NinjaInitialize();
NinjaInitialize("gui");

QApplication app(argc, argv);

Expand Down
42 changes: 21 additions & 21 deletions src/gui/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ mainWindow::mainWindow(QWidget *parent)

meshCellSize = 200.0;

#ifdef PHONE_HOME_QUERIES_ENABLED
checkMessages();
#endif

QString v(NINJA_VERSION_STRING);
v = "Welcome to WindNinja " + v;

Expand Down Expand Up @@ -113,32 +117,30 @@ mainWindow::mainWindow(QWidget *parent)
/*
** Check for version updates, or messages from the server.
*/
#ifdef PHONE_HOME_QUERIES_ENABLED
void mainWindow::checkMessages(void) {
QMessageBox mbox;
char **papszMsg = NinjaCheckVersion();
if (papszMsg != NULL) {
const char *pszVers =
CSLFetchNameValueDef(papszMsg, "VERSION", NINJA_VERSION_STRING);
if (strcmp(pszVers, NINJA_VERSION_STRING) > 0) {
mbox.setText("A new version of WindNinja is available: " +
QString(pszVers));
mbox.exec();
}
char **papszUserMsg = CSLFetchNameValueMultiple(papszMsg, "MESSAGE");
for (int i = 0; i < CSLCount(papszUserMsg); i++) {
mbox.setText(QString(papszUserMsg[i]));
mbox.exec();
}
CSLDestroy(papszUserMsg);
if (CSLFetchNameValue(papszMsg, "ABORT") != NULL) {
QMessageBox mbox;
char *papszMsg = NinjaQueryServerMessages(true);
if (papszMsg != NULL) {
if (strcmp(papszMsg, "TRUE\n") == 0) {
mbox.setText("There is a fatal flaw in Windninja, it must close.");
mbox.exec();
abort();
}
}
CSLDestroy(papszMsg);

else {
char *papszMsg = NinjaQueryServerMessages(false);
if (papszMsg != NULL) {
mbox.setText(papszMsg);

mbox.exec();
}
}
}
}

#endif

bool mainWindow::okToContinue()
{
if(okToContinueCheck)
Expand Down Expand Up @@ -1223,8 +1225,6 @@ void mainWindow::aboutWindNinja()
"Kyle Shannon<br/>" \
"Natalie Wagenbrenner<br/>" \
"Bret Butler<br/>" \
"Levi Malott<br/>" \
"Cody Posey<p/>");
aboutText.append("<p>Missoula Fire Sciences Laboratory<br />");
aboutText.append("Rocky Mountain Research Station<br />");
aboutText.append("USDA Forest Service<br />");
Expand Down
3 changes: 3 additions & 0 deletions src/gui/mainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ class mainWindow : public QMainWindow
void mainDiurnalChanged(bool dC);

public slots:

#ifdef PHONE_HOME_QUERIES_ENABLED
void checkMessages();
#endif
#ifdef NINJAFOAM
void openExistingCase();
void updateFileInputForCase(const char* file);
Expand Down
Loading

0 comments on commit 2d9276e

Please sign in to comment.