Skip to content

Commit

Permalink
Merge branch 'develop' into febiostudio3
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMaas1978 committed Jan 18, 2025
2 parents a585f12 + d69eded commit 0c22dde
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 11 deletions.
12 changes: 11 additions & 1 deletion FEBioStudio/UpdateChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SOFTWARE.*/
#include <QDialogButtonBox>
#include <QPushButton>
#include <QCheckBox>
#include <QUrlQuery>
#include "UpdateChecker.h"
#include "ServerSettings.h"
#include "version.h"
Expand Down Expand Up @@ -84,11 +85,12 @@ void CUpdateWidget::connFinished(QNetworkReply *r)
}
}

void CUpdateWidget::checkForUpdate(bool dev, bool checkSDK, bool upCheck)
void CUpdateWidget::checkForUpdate(bool dev, bool checkSDK, bool upCheck, QString branch)
{
updaterUpdateCheck = upCheck;
devChannel = dev;
m_askSDK = checkSDK;
m_branch = branch;

if(updaterUpdateCheck)
{
Expand Down Expand Up @@ -119,6 +121,14 @@ void CUpdateWidget::checkForAppUpdate()
myurl.setPort(ServerSettings::Port());
myurl.setPath(urlBase + ".xml");

if(!m_branch.isEmpty())
{
QUrlQuery query;
query.addQueryItem("branch", m_branch);

myurl.setQuery(query);
}

QNetworkRequest request;
request.setUrl(myurl);
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::SameOriginRedirectPolicy);
Expand Down
3 changes: 2 additions & 1 deletion FEBioStudio/UpdateChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CUpdateWidget : public QWidget
public:
CUpdateWidget(QWidget* parent = nullptr);

void checkForUpdate(bool dev = false, bool checkSDK = false, bool updaterUpdateCheck = false);
void checkForUpdate(bool dev = false, bool checkSDK = false, bool updaterUpdateCheck = false, QString branch = "");

QString getServerMessage();

Expand Down Expand Up @@ -144,6 +144,7 @@ private slots:

bool devChannel;
bool devAlreadyParsed;
QString m_branch;
bool updaterUpdateCheck;
bool doingUpdaterUpdate;

Expand Down
3 changes: 2 additions & 1 deletion FEMLib/FSProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ void FSProject::SetModule(int mod, bool setDefaultPlotVariables)
FSModel& fem = GetFSModel();
FEBio::InitFSModel(fem);

if (setDefaultPlotVariables && (m_plt.PlotVariables() == 0))
if (setDefaultPlotVariables)
{
m_plt.Clear();
// add some default variables
// TODO: Maybe I can pull this info from FEBio somehow
SetDefaultPlotVariables();
Expand Down
12 changes: 10 additions & 2 deletions GeomLib/GModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ void GModel::ClearGroups()
imp->m_GNode.Clear();
}

void GModel::ClearUnusedGroups()
{
clearVector<GPartList>(imp->m_GPart, [](GPartList* pg) { return (pg->GetReferenceCount() == 0); });
clearVector<GFaceList>(imp->m_GFace, [](GFaceList* pg) { return (pg->GetReferenceCount() == 0); });
clearVector<GEdgeList>(imp->m_GEdge, [](GEdgeList* pg) { return (pg->GetReferenceCount() == 0); });
clearVector<GNodeList>(imp->m_GNode, [](GNodeList* pg) { return (pg->GetReferenceCount() == 0); });
}

//-----------------------------------------------------------------------------
void GModel::ClearDiscrete()
{
Expand Down Expand Up @@ -1625,11 +1633,11 @@ void GModel::RemoveNamedSelections()
for (int i=0; i<(int)imp->m_Obj.Size(); ++i)
{
GObject& obj = *imp->m_Obj[i];
obj.ClearFEGroups();
obj.RemoveUnusedFEGroups();
}

// remove all geometry selections
ClearGroups();
ClearUnusedGroups();
}

void GModel::RemoveMeshData()
Expand Down
1 change: 1 addition & 0 deletions GeomLib/GModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class GModel : public FSObject

//! clear groups
void ClearGroups();
void ClearUnusedGroups();

//! clear all discrete objects
void ClearDiscrete();
Expand Down
8 changes: 7 additions & 1 deletion Updater/FEBioStudioUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ int main(int argc, char* argv[])
// Check if --devChannel flag is present
bool devChannel = false;
bool updaterUpdateCheck = true;
QString branch = "";
for(int index = 1; index < argc; index++)
{
if(QString(argv[index]) == QString("--devChannel") || QString(argv[index]) == QString("-d"))
Expand All @@ -71,10 +72,15 @@ int main(int argc, char* argv[])
{
updaterUpdateCheck = false;
}
else if((QString(argv[index]) == QString("--branch") || QString(argv[index]) == QString("-b")) && index + 1 < argc)
{
devChannel = true;
branch = QString(argv[index + 1]);
}
}

// create the main window
CMainWindow wnd(devChannel, updaterUpdateCheck);
CMainWindow wnd(devChannel, updaterUpdateCheck, branch);
wnd.show();

return app.exec();
Expand Down
20 changes: 17 additions & 3 deletions Updater/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QSslError>
#include <QUrlQuery>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
Expand Down Expand Up @@ -178,9 +179,9 @@ class Ui::CMainWindow
};


CMainWindow::CMainWindow(bool devChannel, bool updaterUpdateCheck)
CMainWindow::CMainWindow(bool devChannel, bool updaterUpdateCheck, QString& branch)
: ui(new Ui::CMainWindow), restclient(new QNetworkAccessManager), m_devChannel(devChannel),
m_updaterUpdateCheck(updaterUpdateCheck), m_downloadingSDK(false)
m_updaterUpdateCheck(updaterUpdateCheck), m_downloadingSDK(false), m_branch(branch)
{
QString dir = QApplication::applicationDirPath();
bool correctDir = false;
Expand Down Expand Up @@ -284,6 +285,14 @@ void CMainWindow::getFile()

myurl.setPath(currentFile.baseURL + "/" + currentFile.name);

if(!m_branch.isEmpty())
{
QUrlQuery query;
query.addQueryItem("branch", m_branch);

myurl.setQuery(query);
}

QNetworkRequest request;
request.setUrl(myurl);
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::SameOriginRedirectPolicy);
Expand Down Expand Up @@ -433,7 +442,7 @@ void CMainWindow::initializePage(int id)
switch(id)
{
case 1:
ui->updateWidget->checkForUpdate(m_devChannel, true, m_updaterUpdateCheck);
ui->updateWidget->checkForUpdate(m_devChannel, true, m_updaterUpdateCheck, m_branch);
break;
case 2:
deleteFiles();
Expand Down Expand Up @@ -610,6 +619,11 @@ void CMainWindow::onFinish()
QStringList args;
args.push_back(QApplication::applicationDirPath() + FBSUPDATERBINARY);
if(m_devChannel) args.push_back("-d");
if(!m_branch.isEmpty())
{
args.push_back("-b");
args.push_back(m_branch);
}

for(auto file : ui->updateWidget->updateFiles)
{
Expand Down
3 changes: 2 additions & 1 deletion Updater/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CMainWindow : public QWizard
Q_OBJECT

public:
CMainWindow(bool devChannel, bool updaterUpdateCheck);
CMainWindow(bool devChannel, bool updaterUpdateCheck, QString& branch);

void makePath(QString path);
void addNewFile(const QString filename);
Expand Down Expand Up @@ -68,4 +68,5 @@ private slots:
bool m_devChannel;
bool m_updaterUpdateCheck;
bool m_downloadingSDK;
QString m_branch;
};
17 changes: 16 additions & 1 deletion Updater/mvUtil.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <string>
#include <sys/stat.h>

#ifdef WIN32
Expand Down Expand Up @@ -38,13 +39,20 @@ int main(int argc, char* argv[])

int start = 2;
bool dev = false;
std::string branch;

if(strcmp(argv[2], "-d") == 0)
{
start++;
dev = true;
}

if(argc > 4 && strcmp(argv[3], "-b") == 0)
{
start += 2;
branch = argv[4];
}

if((argc - start) % 2 != 0) return -1;

for (int index = start; index < argc; index += 2)
Expand Down Expand Up @@ -78,7 +86,14 @@ int main(int argc, char* argv[])

if(dev)
{
sprintf(command, "\"%s\" --noUpdaterCheck --devChannel", argv[1]);
if(branch.empty())
{
sprintf(command, "\"%s\" --noUpdaterCheck --devChannel", argv[1]);
}
else
{
sprintf(command, "\"%s\" --noUpdaterCheck --devChannel --branch %s", argv[1], branch.c_str());
}
}
else
{
Expand Down

0 comments on commit 0c22dde

Please sign in to comment.