mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Ref T103, moved directory functions from CBuildConfig to CDirectoryUtils
getApplicationDir renamed to getBinDir() as it works different on MacOs see https://dev.swift-project.org/w/dev/swiftpc/dirstructure/
This commit is contained in:
committed by
Mathew Sutcliffe
parent
eaac4dacd6
commit
debd9c802f
@@ -7,7 +7,6 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackgui/components/datainfoareacomponent.h"
|
||||
#include "blackgui/components/dbaircrafticaocomponent.h"
|
||||
@@ -21,6 +20,7 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "ui_datainfoareacomponent.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <QTabWidget>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackGui;
|
||||
@@ -91,7 +90,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// write to disk
|
||||
bool s = sGui->getWebDataServices()->writeDbDataToDisk(CBuildConfig::getSwiftStaticDbFilesDir());
|
||||
bool s = sGui->getWebDataServices()->writeDbDataToDisk(CDirectoryUtils::getSwiftStaticDbFilesDir());
|
||||
if (s)
|
||||
{
|
||||
CLogMessage(this).info("Written DB data");
|
||||
@@ -106,12 +105,12 @@ namespace BlackGui
|
||||
bool CDataInfoAreaComponent::readDbDataFromResourceDir()
|
||||
{
|
||||
bool s = sGui &&
|
||||
sGui->getWebDataServices()->readDbDataFromDisk(CBuildConfig::getSwiftStaticDbFilesDir(), true);
|
||||
sGui->getWebDataServices()->readDbDataFromDisk(CDirectoryUtils::getSwiftStaticDbFilesDir(), true);
|
||||
|
||||
// info
|
||||
if (s)
|
||||
{
|
||||
CLogMessage(this).info("Read DB data from directory: %1") << CBuildConfig::getSwiftStaticDbFilesDir();
|
||||
CLogMessage(this).info("Read DB data from directory: %1") << CDirectoryUtils::getSwiftStaticDbFilesDir();
|
||||
ui->comp_DbAircraftIcao->showLoadIndicator();
|
||||
ui->comp_DbAirlineIcao->showLoadIndicator();
|
||||
ui->comp_DbCountries->showLoadIndicator();
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "ui_flightplancomponent.h"
|
||||
|
||||
@@ -598,7 +599,7 @@ namespace BlackGui
|
||||
QString CFlightPlanComponent::getDefaultFilename(bool load)
|
||||
{
|
||||
// some logic to find a useful default name
|
||||
QString dir = CBuildConfig::getDocumentationDirectory();
|
||||
QString dir = CDirectoryUtils::getDocumentationDirectory();
|
||||
|
||||
if (load)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include <QString>
|
||||
|
||||
namespace BlackGui
|
||||
@@ -31,7 +31,7 @@ namespace BlackGui
|
||||
static bool isValid(const QString &directory) { Q_UNUSED(directory); return true; }
|
||||
|
||||
//! Default, not consolidating
|
||||
static const QString &defaultValue() { return BlackConfig::CBuildConfig::getDocumentationDirectory(); }
|
||||
static const QString &defaultValue() { return BlackMisc::CDirectoryUtils::getDocumentationDirectory(); }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/restricted.h"
|
||||
|
||||
#include <QAbstractScrollArea>
|
||||
@@ -132,12 +133,12 @@ namespace BlackGui
|
||||
|
||||
bool CStyleSheetUtility::read()
|
||||
{
|
||||
QDir directory(CBuildConfig::getStylesheetsDir());
|
||||
QDir directory(CDirectoryUtils::getStylesheetsDir());
|
||||
if (!directory.exists()) { return false; }
|
||||
|
||||
// qss/css files
|
||||
const bool needsWatcher = this->m_fileWatcher.files().isEmpty();
|
||||
if (needsWatcher) { this->m_fileWatcher.addPath(CBuildConfig::getStylesheetsDir()); } // directory to deleted file watching
|
||||
if (needsWatcher) { this->m_fileWatcher.addPath(CDirectoryUtils::getStylesheetsDir()); } // directory to deleted file watching
|
||||
directory.setNameFilters({"*.qss", "*.css"});
|
||||
directory.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
|
||||
|
||||
@@ -239,7 +240,7 @@ namespace BlackGui
|
||||
qssWidget.append(qss);
|
||||
qssWidget.append("}\n");
|
||||
|
||||
QFile fontFile(CBuildConfig::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
QFile fontFile(CDirectoryUtils::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
bool ok = fontFile.open(QFile::Text | QFile::WriteOnly);
|
||||
if (ok)
|
||||
{
|
||||
@@ -253,7 +254,7 @@ namespace BlackGui
|
||||
|
||||
bool CStyleSheetUtility::resetFont()
|
||||
{
|
||||
QFile fontFile(CBuildConfig::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
QFile fontFile(CDirectoryUtils::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
return fontFile.remove();
|
||||
}
|
||||
|
||||
@@ -299,7 +300,7 @@ namespace BlackGui
|
||||
|
||||
bool CStyleSheetUtility::deleteModifiedFontFile()
|
||||
{
|
||||
const QString fn = CFileUtils::appendFilePaths(CBuildConfig::getStylesheetsDir(), fileNameFontsModified());
|
||||
const QString fn = CFileUtils::appendFilePaths(CDirectoryUtils::getStylesheetsDir(), fileNameFontsModified());
|
||||
QFile file(fn);
|
||||
if (!file.exists()) { return false; }
|
||||
bool r = file.remove();
|
||||
@@ -483,7 +484,7 @@ namespace BlackGui
|
||||
bool CStyleSheetUtility::qssFileExists(const QString &filename)
|
||||
{
|
||||
if (filename.isEmpty()) { return false; }
|
||||
const QFileInfo f(CFileUtils::appendFilePaths(CBuildConfig::getStylesheetsDir(), filename));
|
||||
const QFileInfo f(CFileUtils::appendFilePaths(CDirectoryUtils::getStylesheetsDir(), filename));
|
||||
return f.exists() && f.isReadable();
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user