Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating a program to write out a JSON file which would be uploaded t…
…o a server. DREAM3D will retrieve this file to check for new versions. This replaces the old version.txt file that was used for versions prior to this.
- Loading branch information
1 parent
22dde13
commit 1e28746
Showing
5 changed files
with
135 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
|
||
|
||
|
||
|
||
#include <QtCore/QCoreApplication> | ||
#include <QtCore/QFile> | ||
#include <QtCore/QDir> | ||
#include <QtCore/QJsonArray> | ||
#include <QtCore/QJsonObject> | ||
#include <QtCore/QJsonDocument> | ||
#include <QtCore/QSet> | ||
#include <QtCore/QDate> | ||
|
||
#include "DREAM3DLib/DREAM3DLib.h" | ||
#include "DREAM3DLib/Common/FilterManager.h" | ||
#include "DREAM3DLib/Plugin/IDREAM3DPlugin.h" | ||
#include "DREAM3DLib/Plugin/DREAM3DPluginLoader.h" | ||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// | ||
// ----------------------------------------------------------------------------- | ||
void WriteWebServerJSON(const QString& filePath) | ||
{ | ||
|
||
|
||
// Register all the filters including trying to load those from Plugins | ||
FilterManager* fm = FilterManager::Instance(); | ||
DREAM3DPluginLoader::LoadPluginFilters(fm); | ||
PluginManager* pm = PluginManager::Instance(); | ||
QVector<IDREAM3DPlugin*> plugins = pm->getPluginsVector(); | ||
|
||
// Send progress messages from PipelineBuilder to this object for display | ||
QMetaObjectUtilities::RegisterMetaTypes(); | ||
|
||
|
||
// Write our File Version and DREAM3D Version strings | ||
QJsonObject meta; | ||
meta[DREAM3D::Settings::Version] = DREAM3DLib::Version::Package(); | ||
meta["Release Date"] = QDate::currentDate().toString(); | ||
meta["Release Type"] = "Beta"; | ||
|
||
QJsonObject m_Root; | ||
m_Root["DREAM3D"] = meta; | ||
|
||
|
||
QJsonArray plugArray; | ||
|
||
for(int i = 0; i < plugins.size(); i++) | ||
{ | ||
IDREAM3DPlugin* plug = plugins[i]; | ||
QJsonObject jobj; | ||
jobj["Plugin Name"] = plug->getPluginName(); | ||
jobj["Plugin Version"] = plug->getVersion(); | ||
jobj["Plugin Vendor"] = plug->getVendor(); | ||
plugArray.append(jobj); | ||
} | ||
m_Root["Plugins"] = plugArray; | ||
|
||
QJsonDocument doc(m_Root); | ||
QFile outputFile(filePath); | ||
if (outputFile.open(QIODevice::WriteOnly)) | ||
{ | ||
outputFile.write(doc.toJson()); | ||
outputFile.close(); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
// ----------------------------------------------------------------------------- | ||
// Use test framework | ||
// ----------------------------------------------------------------------------- | ||
int main(int argc, char** argv) | ||
{ | ||
// Instantiate the QCoreApplication that we need to get the current path and load plugins. | ||
QCoreApplication app(argc, argv); | ||
QCoreApplication::setOrganizationName("BlueQuartz Software"); | ||
QCoreApplication::setOrganizationDomain("bluequartz.net"); | ||
QCoreApplication::setApplicationName("CreateWebServerJson"); | ||
|
||
QString filePath = "/tmp/Version.json"; | ||
if(argc == 2) | ||
{ | ||
filePath = QString::fromLatin1(argv[1]); | ||
} | ||
|
||
WriteWebServerJSON(filePath); | ||
|
||
|
||
int err = EXIT_SUCCESS; | ||
|
||
|
||
return err; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters