QtLingo 1
QtLingo is an Application to make Qt Computer Translations easier
MyOrgSettings Class Reference

My Org Settings. More...

#include <MyOrgSettings.h>

Inheritance diagram for MyOrgSettings:

Public Types

enum  MyFileinfo {
  AbsolutePath = 100 , AbsoluteFilePath = 101 , BaseName = 102 , BirthTime = 103 ,
  CanonicalPath = 104 , CanonicalFilePath = 105 , CompleteBaseName = 106 , CompleteSuffix = 107 ,
  Directory = 108 , FileName = 109 , FilePath = 110 , IsWritable = 111 ,
  IsFile = 112 , IsFolder = 113 , FileSize = 114 , IsSymLink = 115 ,
  SymLinkTarget = 116
}
 File Information. More...
 
enum  MyMessageTypes {
  Information = 100 , Question = 101 , Warning = 102 , Critical = 103 ,
  Debug = 104
}
 Message Types. More...
 

Signals

void sendInternetProgress ()
 send Internet Progress More...
 
void sendUpdateSettings ()
 send Update Settings More...
 

Public Member Functions

 MyOrgSettings (QObject *parent=nullptr)
 MyOrgSettings Constructor. More...
 
 ~MyOrgSettings ()
 MyOrgSettings Destructor. More...
 
void onRunOnStartup ()
 Run On Startup. More...
 
QString readSettings (const QString &thisSetting, const QString &thisDefault)
 read Settings More...
 
QString readSettings (const QString &thisSetting)
 read Settings More...
 
bool readSettingsBool (const QString &thisSetting, bool thisDefault)
 read Settings Bool More...
 
int readSettingsInt (const QString &thisSetting, int thisDefault)
 read Settings Int More...
 
void writeSettings (const QString &thisSetting, const QString &thisValue)
 write Settings More...
 
QSettings * getSettings ()
 get Settings More...
 
QString getDataPath (const QString &thisFileName)
 Get Data Path. More...
 
QString getOrgName ()
 get Org Name More...
 
void setOrgName (const QString &thisOrgName)
 set Org Name More...
 
QString getOrgDomain ()
 my Organization Domain More...
 
void setOrgDomain (const QString &thisOrgDomain)
 set Org Domain. setOrgDomain More...
 
QString getAppName ()
 my Application Name More...
 
void setAppName (const QString &thisAppName)
 set AppName More...
 
QString getVersion ()
 my Application Version More...
 
void setVersion (const QString &thisVersion)
 set Version More...
 
QString getIniFileName ()
 my Application IniFile More...
 
void setIniFileName (const QString &thisIniFileName)
 set IniFile More...
 
void setIniFileExtension (const QString &thisIniFileNameExtension)
 set Ini File Extension More...
 
QString getIniFileExtension ()
 getIniFileExtension More...
 
QString getIniFullPath ()
 my Application IniFile More...
 
void setIniFullPath (const QString &thisIniFileName)
 set IniFile More...
 
QString readFile (const QString &thisFileName)
 read File More...
 
QString combinePathFileName (const QString &thisPath, const QString &thisFileName)
 combine Path File Name More...
 
bool isFileExists (const QString &thisFile)
 File Functions. More...
 
bool isFileMake (const QString &thisPath, const QString &thisFileName)
 is File Make More...
 
bool isPathExists (const QString &thisPath)
 is Path Exists More...
 
bool isMakeDir (const QString &thisPath)
 is Make Dir More...
 
bool removeFile (const QString &thisFile)
 remove File More...
 
bool writeFile (const QString &thisFileName, const QString &thisContent)
 write File More...
 
QString getFileInfo (MyOrgSettings::MyFileinfo thisInfo, const QString &thisFileFolder)
 get File Info More...
 
int fileNumberLines (const QString &thisFile)
 file Number Lines More...
 
bool removeAllFiles (const QString &thisFolder)
 remove All Files More...
 
QString getLastApplicationPath ()
 get Last Application Path More...
 
void setLastApplicationPath (const QString &thisPath)
 set Last Application Path More...
 
QString getAppDataLocation ()
 get AppData Location More...
 
void setAppDataLocation (const QString &thisAppDataLocation)
 set AppData Location More...
 
bool isAppDataLocationGood (const QString &thisFolder)
 is AppData Location Good More...
 
bool isSetting (const QString &thisFieldName)
 is Setting More...
 
void setGeometry (QByteArray thisGeometry)
 Screen Geometry. More...
 
QByteArray getGeometry ()
 get Geometry More...
 
QByteArray getWindowState ()
 get Geometry Min More...
 
void setWindowState (QByteArray thisWindowState)
 get Geometry Min More...
 
QString encryptThis (const QString &thisSecret)
 encrypt This More...
 
QString decryptThis (const QString &thisSecret)
 decrypt This More...
 
QString getEnvironmentVar (const QString &thisVar, const QString &thisDefault)
 get Windows Environment Var More...
 
bool isWord (const QString &thisString) const
 is Word More...
 
void delay (int thisSeconds)
 delay More...
 
void setDebugMessage (bool thisState)
 set Debug Message More...
 
bool getDebugMessage ()
 get Debug Message More...
 
bool questionYesNo (const char *thisTitle, const char *thisQuestion) const
 question Yes No More...
 
QVariant showMessageBox (const QString &thisTitle, const QString &thisMessage, MyMessageTypes thisMessageType) const
 show Message Box information, question, warning, critica More...
 
QVariant setMessage (const QString &thisTitle, const QString &thisMessage, MyMessageTypes thisMessageType) const
 set Message More...
 
bool getInternetWait ()
 get Internet Wait More...
 
bool pingInternet ()
 ping Internet More...
 
bool connectInternet ()
 connect Internet More...
 
QString getCheckInternetUrl ()
 get Check Internet Url More...
 
void setCheckInternetUrl (const QString &thisCheckInternetUrl)
 set Check Internet Url More...
 
QSettings * getSetteings ()
 on Update Settings. onUpdateSettings More...
 

Public Attributes

SimpleCryptmyCrypto
 myCrypto More...
 
const QString MY_PROJECT_NAME = "QmlWidgetTranslator"
 MY_QT_PROJECT_NAME More...
 
const QString MY_INI_EXTENSION = "ini"
 MY_INI_EXTENSION More...
 
const QString MY_HELP_FOLDER = "help"
 MY_HELP_FOLDER More...
 
const QString MY_INTERNET_URL = "http://www.google.com"
 MY_INTERNET_URL More...
 
const QPoint ConstDefaultGeometryPos = QPoint(10, 10)
 ConstDefaultGeometryPos More...
 
const QSize ConstDefaultGeometrySize = QSize(666, 333)
 ConstDefaultGeometrySize More...
 
const QString MY_LAST_PROJECT_FOLDER = "LastProjectFolder"
 MY_QT_PROJECT_NAME More...
 
const QString MY_IS_DEBUG_MESSAGE = "IsDebugMessage"
 MY_IS_DEBUG_MESSAGE More...
 
const QString MY_LOCALE_LANG_CODE = "LocaleLanguageCode"
 MY_CURRENT_LANG_CODE More...
 
const QString MY_LOCALE_LANG_NAME = "LocaleLanguageName"
 MY_LOCALE_LANG_NAME More...
 
const QString MY_SQL_DEFAULT = "QSQLITE"
 SQL_DEFAULT More...
 
const QString MY_DEFAULT_SQL = ":memory:"
 MY_DEFAULT_SQL More...
 
const QString MY_SQL_PROJECT_ID = "ProjectID"
 SQL_PROJECT_ID More...
 
const QString MY_SQL_PROJECT_NAME = "ProjectName"
 MY_SQL_PROJECT_NAME More...
 
const QString MY_SQL_DB_NAME = "SqlDatabaseName"
 MY_SQL_DB_NAME More...
 
const QString MY_SQL_DB_TYPE = "SqlDatabaseType"
 MY_SQL_DB_TYPE More...
 
const QString MY_SQL_DB_HOST = "SqlDatabaseHost"
 MY_SQL_DB_HOST More...
 
const QString MY_SQL_DB_USER = "SqlDatabaseUser"
 MY_SQL_DB_USER More...
 
const QString MY_SQL_DB_PASS = "SqlDatabasePass"
 MY_SQL_DB_PASS More...
 
const QString MY_DATETIME_FORMAT_STARTED = "DateTimeFormatStarted"
 MY_DATETIME_FORMAT_STARTED More...
 
const QString MY_DATETIME_FORMAT_DUE = "DateTimeFormatDue"
 MY_DATETIME_FORMAT_STARTED More...
 
const QString MY_PROJECT_STATUS = "ProjectStatus"
 MY_PROJECT_STATUS More...
 
const QString MY_DEFAULT_LANGUAGE_CODE = "en"
 MY_DEFAULT_LANGUAGE_CODE More...
 
const QString MY_APPLICATION_NAME = "SettingsApplicationName"
 ConstSettingsApplicationName More...
 
const QString MY_ORG_NAME = "SettingsOrgName"
 ConstSettingsOrgName More...
 
const QString MY_ORG_DOMAIN = "SettingsOrgDomain"
 ConstSettingsOrgDomain More...
 
const QString MY_GEOMETRY = "Geometry"
 ConstSettingsGeometry More...
 
const QString MY_WINDOW_STATES = "WidowState"
 MY_WINDOW_STATES More...
 
const QString MY_LAST_TAB_INDEX = "LastTabInex"
 MY_LAST_TAB More...
 
const QString MY_DEFAULT_TAB_INDEX = "0"
 MY_DEFAULT_TAB_INDEX More...
 

Detailed Description

My Org Settings.

Author
Jeffrey Scott Flesher

Definition at line 34 of file MyOrgSettings.h.

Member Enumeration Documentation

◆ MyFileinfo

File Information.

Enumerator
AbsolutePath 

AbsolutePath

The absolute path name consists of the full path and the file name.

AbsoluteFilePath 

CanonicalPath

Returns a file's path absolute path, does not include the file name.

BaseName 

BaseName

Returns the base name of the file without the path.

BirthTime 

BirthTime

Returns the date and time when the file was created / born.

CanonicalPath 

CanonicalPath

Returns the canonical path including the file name, i.e. an absolute path without symbolic links or redundant "." or ".." elements.

CanonicalFilePath 

CanonicalFilePath

Returns the file's path canonical path (excluding the file name), i.e. an absolute path without symbolic links or redundant "." or ".." elements.

CompleteBaseName 

CompleteBaseName

Returns the complete base name of the file without the path.

CompleteSuffix 

CompleteSuffix

Returns the complete suffix (extension) of the file.

Directory 

Directory

Returns the path of the object's parent directory as a QDir object.

FileName 

FileName

Returns the name of the file, excluding the path.

FilePath 

FilePath

Returns the file name, including the path (which may be absolute or relative).

IsWritable 

IsWritable

Returns true if the user can write to the file; otherwise returns false.

IsFile 

IsFile

Returns true if this object points to a file or to a symbolic link to a file. Returns false if the object points to something which isn't a file, such as a directory.

IsFolder 

IsFolder

Returns true if this object points to a directory or to a symbolic link to a directory; otherwise returns false.

FileSize 

FileSize

File Size

IsSymLink 

IsSymLink

Returns true if this object points to a symbolic link; otherwise returns false.

SymLinkTarget 

SymLinkTarget

Returns the absolute path to the file or directory a symbolic link points to, or an empty string if the object isn't a symbolic link.

Definition at line 44 of file MyOrgSettings.h.

45 {
46 AbsolutePath = 100,
47 AbsoluteFilePath = 101,
48 BaseName = 102,
49 BirthTime = 103,
50 CanonicalPath = 104,
51 CanonicalFilePath = 105,
52 CompleteBaseName = 106,
53 CompleteSuffix = 107,
54 Directory = 108,
55 FileName = 109,
56 FilePath = 110,
57 IsWritable = 111,
58 IsFile = 112,
59 IsFolder = 113,
60 FileSize = 114,
61 IsSymLink = 115,
62 SymLinkTarget = 116,
63 }; // end enum MyFileinfo
@ Directory
Directory
Definition: MyOrgSettings.h:54
@ CanonicalFilePath
CanonicalFilePath
Definition: MyOrgSettings.h:51
@ BirthTime
BirthTime
Definition: MyOrgSettings.h:49
@ IsWritable
IsWritable
Definition: MyOrgSettings.h:57
@ FileName
FileName
Definition: MyOrgSettings.h:55
@ BaseName
BaseName
Definition: MyOrgSettings.h:48
@ IsFile
IsFile
Definition: MyOrgSettings.h:58
@ AbsoluteFilePath
CanonicalPath
Definition: MyOrgSettings.h:47
@ SymLinkTarget
SymLinkTarget
Definition: MyOrgSettings.h:62
@ IsSymLink
IsSymLink
Definition: MyOrgSettings.h:61
@ CompleteSuffix
CompleteSuffix
Definition: MyOrgSettings.h:53
@ CanonicalPath
CanonicalPath
Definition: MyOrgSettings.h:50
@ AbsolutePath
AbsolutePath
Definition: MyOrgSettings.h:46
@ IsFolder
IsFolder
Definition: MyOrgSettings.h:59
@ CompleteBaseName
CompleteBaseName
Definition: MyOrgSettings.h:52
@ FileSize
FileSize
Definition: MyOrgSettings.h:60
@ FilePath
FilePath
Definition: MyOrgSettings.h:56

◆ MyMessageTypes

Message Types.

Enumerator
Information 

Information

Information

Question 

Question

Question

Warning 

Warning

Warning

Critical 

Critical

Critical

Debug 

Debug

Debug

Definition at line 70 of file MyOrgSettings.h.

71 {
72 Information = 100,
73 Question = 101,
74 Warning = 102,
75 Critical = 103,
76 Debug = 104,
77 }; // end enum MyFileinfo
@ Information
Information
Definition: MyOrgSettings.h:72
@ Critical
Critical
Definition: MyOrgSettings.h:75
@ Question
Question
Definition: MyOrgSettings.h:73
@ Warning
Warning
Definition: MyOrgSettings.h:74

Constructor & Destructor Documentation

◆ MyOrgSettings()

MyOrgSettings::MyOrgSettings ( QObject *  parent = nullptr)
explicit

MyOrgSettings Constructor.

Creates QSettings for organizationName, organizationDomain, applicationName. MyOrgSettings.

Definition at line 13 of file MyOrgSettings.cpp.

13 : QObject(parent)
14{
15 // Fixed random number, change it before using it, then leave it,
16 // all data stored with this key will only work with this key.
17 // Defined in MyOrgSettings.h
19 // Trigger for Update
20 connect(this, &MyOrgSettings::sendUpdateSettings, this, &MyOrgSettings::onUpdateSettings);
21
22 // Run after GUI loads
23 QTimer::singleShot(200, this, &MyOrgSettings::onRunOnStartup);
24}
#define MY_CRYPTO_SEED
MY_CRYPTO_SEED
Definition: MyOrgSettings.h:28
SimpleCrypt * myCrypto
myCrypto
Definition: MyOrgSettings.h:81
void sendUpdateSettings()
send Update Settings
void onRunOnStartup()
Run On Startup.
Simple encryption and decryption of strings and byte arrays.
Definition: SimpleCrypt.h:72

◆ ~MyOrgSettings()

MyOrgSettings::~MyOrgSettings ( )

MyOrgSettings Destructor.

Deconstructor. ~MyOrgSettings.

Definition at line 29 of file MyOrgSettings.cpp.

30{
31
32}

Member Function Documentation

◆ combinePathFileName()

QString MyOrgSettings::combinePathFileName ( const QString &  thisPath,
const QString &  thisFileName 
)

combine Path File Name

combine Path File Name. combinePathFileName

Definition at line 776 of file MyOrgSettings.cpp.

777{
778 setMessage("combine Path File Name", QString("combinePathFileName(%1, %2)").arg(thisPath, thisFileName), Debug);
779 return QString("%1%2%3").arg(thisPath, QDir::separator(), thisFileName);
780} // end combinePathFileName
QVariant setMessage(const QString &thisTitle, const QString &thisMessage, MyMessageTypes thisMessageType) const
set Message

◆ connectInternet()

bool MyOrgSettings::connectInternet ( )

connect Internet

ping Internet. pingInternet set in cmake

connect Internet. connectInternet

Definition at line 696 of file MyOrgSettings.cpp.

697{
698 setMessage("connect Internet", "connectInternet", Debug);
699 bool isInternetAvailable = false;
700 QNetworkAccessManager *theNetworkManager = new QNetworkAccessManager;
701 QEventLoop theEventLoop;
702 QObject::connect(theNetworkManager, &QNetworkAccessManager::finished, &theEventLoop, &QEventLoop::quit);
703 QNetworkReply *reply = theNetworkManager->get(QNetworkRequest(QUrl(getCheckInternetUrl())));
704 theEventLoop.exec();
705 if (reply->bytesAvailable())
706 { isInternetAvailable = true; }
707 else
708 { isInternetAvailable = false; }
709 delete reply;
710 delete theNetworkManager;
711 return isInternetAvailable;
712} // end delay
QString getCheckInternetUrl()
get Check Internet Url

◆ decryptThis()

QString MyOrgSettings::decryptThis ( const QString &  thisSecret)

decrypt This

Crypto using SimpleCrypt. decryptThis.

Definition at line 495 of file MyOrgSettings.cpp.

496{
497 setMessage("decryp tThis", "decryptThis", Debug);
498 return myCrypto->decryptToString(thisSecret);
499}
QString decryptToString(const QString &cyphertext)
decrypt To String QString. decryptToString

◆ delay()

void MyOrgSettings::delay ( int  thisSeconds)

delay

delay. delay

Definition at line 661 of file MyOrgSettings.cpp.

662{
663 setMessage("idelay", QString("delay(%1)").arg(thisSeconds), Debug);
664 QEventLoop theDelayLoop;
665 QTimer::singleShot(thisSeconds * 1000, &theDelayLoop, &QEventLoop::quit);
666 theDelayLoop.exec();
667} // end delay

◆ encryptThis()

QString MyOrgSettings::encryptThis ( const QString &  thisSecret)

encrypt This

Crypto using SimpleCrypt. encryptThis.

Definition at line 486 of file MyOrgSettings.cpp.

487{
488 setMessage("encrypt This", "encryptThis", Debug);
489 return myCrypto->encryptToString(thisSecret);
490}
QString encryptToString(const QString &plaintext)
encrypt To String QString. encryptToString

◆ fileNumberLines()

int MyOrgSettings::fileNumberLines ( const QString &  thisFile)

file Number Lines

Number of Lines in a file. fileNumberLines.

Definition at line 744 of file MyOrgSettings.cpp.

745{
746 setMessage("file Number Lines", QString("fileNumberLines(%1)").arg(thisFile), Debug);
747 if (!isFileExists(thisFile)) { setMessage(QObject::tr("File not found").toLocal8Bit(), QString("%1: %2").arg(QObject::tr("File not found"), thisFile).toLocal8Bit(), Critical); return 0; }
748 std::ifstream inFile(thisFile.toLocal8Bit());
749 return std::count(std::istreambuf_iterator<char>(inFile), std::istreambuf_iterator<char>(), '\n');
750} // end fileNumberLines
bool isFileExists(const QString &thisFile)
File Functions.

◆ getAppDataLocation()

QString MyOrgSettings::getAppDataLocation ( )

get AppData Location

get App Data Location. getAppDataLocation

Definition at line 587 of file MyOrgSettings.cpp.

588{
589 if (myAppDataLocation.isEmpty())
590 {
591 QString theAppDataLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
592 if (theAppDataLocation.isEmpty())
593 {
594 theAppDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
595 if (theAppDataLocation.isEmpty())
596 { theAppDataLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); }
597 if (theAppDataLocation.isEmpty())
598 { theAppDataLocation = QDir::currentPath(); }
599 }
600 if (!isAppDataLocationGood(theAppDataLocation))
601 {
602 theAppDataLocation = QDir::currentPath(); // FIXME
603 }
604 setAppDataLocation(theAppDataLocation);
605 }
606 setMessage("get App Data Location", QString("getAppDataLocation(%1)").arg(myAppDataLocation), Debug);
607 return myAppDataLocation;
608} // end getAppDataLocation
bool isAppDataLocationGood(const QString &thisFolder)
is AppData Location Good
void setAppDataLocation(const QString &thisAppDataLocation)
set AppData Location

◆ getAppName()

QString MyOrgSettings::getAppName ( )

my Application Name

get App Name. getAppName

Definition at line 243 of file MyOrgSettings.cpp.

244{
245 if (myApplicationName.isEmpty()) { setAppName(qApp->applicationName()); }
246 setMessage("get App Name", QString("getAppName(%1)").arg(myApplicationName), Debug);
247 return myApplicationName;
248} // end getAppName
void setAppName(const QString &thisAppName)
set AppName

◆ getCheckInternetUrl()

QString MyOrgSettings::getCheckInternetUrl ( )

get Check Internet Url

get CheckInternetUrl. getCheckInternetUrl

Definition at line 289 of file MyOrgSettings.cpp.

290{
291 setMessage("get CheckInternetUrl", QString("getCheckInternetUrl(%1)").arg(myCheckInternetUrl), Debug);
292 if (myCheckInternetUrl.isEmpty())
294 return myCheckInternetUrl;
295}
const QString MY_INTERNET_URL
MY_INTERNET_URL
Definition: MyOrgSettings.h:87
void setCheckInternetUrl(const QString &thisCheckInternetUrl)
set Check Internet Url

◆ getDataPath()

QString MyOrgSettings::getDataPath ( const QString &  thisFileName)

Get Data Path.

get Data Path. getDataPath FIXME

Definition at line 153 of file MyOrgSettings.cpp.

154{
155 setMessage("get Data Path", QString("getDataPath(%1)").arg(thisFileName), Debug);
156 //
157 QDir settingsPath;
158 // FIXME this is where the exe is
159 QString myDataPath = QString("%1%2%3").arg(settingsPath.currentPath(), QDir::separator(), thisFileName);
160 setMessage("", "getDataPath = " + myDataPath, Debug);
161 return myDataPath;
162}

◆ getDebugMessage()

bool MyOrgSettings::getDebugMessage ( )

get Debug Message

get Debug Message. getDebugMessage

Definition at line 868 of file MyOrgSettings.cpp.

869{
870 setMessage("get Debug Message", QString("getDebugMessage(%1)").arg(isDebugMessage), Debug);
871 return isDebugMessage;
872}

◆ getEnvironmentVar()

QString MyOrgSettings::getEnvironmentVar ( const QString &  thisVar,
const QString &  thisDefault 
)

get Windows Environment Var

get Environment Var. getEnvironmentVar inline auto get_environement_variable(const char* key ) { char * val = getenv(key); return (val == NULL) ? "" : std::string(val); } auto programFiles = get_environement_variable("%ProgramW6432%"); auto programFilesX86 = get_environement_variable("%ProgramFiles(x86)%"); auto userProfile = get_environement_variable("%USERPROFILE%"); auto userProfile = get_environement_variable("%USERPROFILE%\Documents");

Definition at line 634 of file MyOrgSettings.cpp.

635{
636 setMessage("get Environment Var", QString("getEnvironmentVar(%1)").arg(thisVar), Debug);
637 QString theEnvValue = qEnvironmentVariable(thisVar.toLocal8Bit());
638 if (!theEnvValue.isNull())
639 { return theEnvValue; }
640 else
641 { return thisDefault; }
642}

◆ getFileInfo()

QString MyOrgSettings::getFileInfo ( MyOrgSettings::MyFileinfo  thisInfo,
const QString &  thisFileFolder 
)

get File Info

get File Info. getFileInfo

Definition at line 504 of file MyOrgSettings.cpp.

505{
506 setMessage("get File Info", QString("getFileInfo(%1)").arg(thisFileFolder), Debug);
507 if (thisFileFolder.isEmpty()) { return ""; }
508 //
509 QFileInfo theFileInfo(thisFileFolder);
510 //
511 switch (thisInfo)
512 {
513 case AbsoluteFilePath:
514 // The absolute path name consists of the full path and the file name.
515 return theFileInfo.absoluteFilePath();
516 case AbsolutePath:
517 // Returns a file's path absolute path. This doesn't include the file name..
518 return theFileInfo.absolutePath();
519 case BaseName:
520 // Returns the base name of the file without the path.
521 return theFileInfo.baseName();
522 case BirthTime:
523 // Returns the date and time when the file was created / born.
524 return theFileInfo.birthTime().toString();
525 case CanonicalPath:
526 // Returns the file's path canonical path (excluding the file name), i.e. an absolute path without symbolic links or redundant "." or ".." elements.
527 return theFileInfo.canonicalPath();
529 // Returns the canonical path including the file name, i.e. an absolute path without symbolic links or redundant "." or ".." elements.
530 return theFileInfo.canonicalFilePath();
531 case CompleteBaseName:
532 // Returns the complete base name of the file without the path.
533 // "/tmp/archive.tar.gz" == "archive.tar"
534 return theFileInfo.completeBaseName();
535 case CompleteSuffix:
536 // Returns the complete suffix (extension) of the file.
537 // "/tmp/archive.tar.gz" == "tar.gz"
538 return theFileInfo.completeSuffix();
539 case Directory:
540 // Returns the path of the object's parent directory as a QDir object.
541 return theFileInfo.dir().currentPath();
542 case FileName:
543 // Returns the name of the file, excluding the path. getFileInfo(FileName, "")
544 return theFileInfo.fileName();
545 case FilePath:
546 // Returns the file name, including the path (which may be absolute or relative).
547 return theFileInfo.filePath();
548 case IsWritable:
549 // Returns true if the user can write to the file; otherwise returns false.
550 if (theFileInfo.isWritable()) return "true"; else return "false";
551 case FileSize:
552 return QString::number(theFileInfo.size());
553 case IsFile:
554 if (isFileExists(thisFileFolder)) return "true"; else return "false";
555 case IsFolder:
556 if (isPathExists(thisFileFolder)) return "true"; else return "false";
557 case IsSymLink:
558 if (theFileInfo.isSymLink()) return "true"; else return "false";
559 case SymLinkTarget:
560 if (theFileInfo.isSymLink()) return theFileInfo.symLinkTarget(); else return "";
561 }
562 return "";
563}
bool isPathExists(const QString &thisPath)
is Path Exists

◆ getGeometry()

QByteArray MyOrgSettings::getGeometry ( )

get Geometry

get Geometry. getGeometry

Definition at line 408 of file MyOrgSettings.cpp.

409{
410 setMessage("get Geometry", "getGeometry", Debug);
411 // Geometry
412 mySettings->beginGroup("Geometry");
413 myGeometry = mySettings->value(MY_GEOMETRY).toByteArray();
414 mySettings->endGroup();
415 return myGeometry;
416} // end getGeometry
const QString MY_GEOMETRY
ConstSettingsGeometry

◆ getIniFileExtension()

QString MyOrgSettings::getIniFileExtension ( )

getIniFileExtension

get Ini File Extension. getIniFileExtension

Definition at line 338 of file MyOrgSettings.cpp.

339{
340 setMessage("get Ini File", QString("getIniFile(%1)").arg(myIniFileName), Debug);
341 if (myIniFileExtension.isEmpty())
343 return myIniFileExtension;
344}
const QString MY_INI_EXTENSION
MY_INI_EXTENSION
Definition: MyOrgSettings.h:85
void setIniFileExtension(const QString &thisIniFileNameExtension)
set Ini File Extension

◆ getIniFileName()

QString MyOrgSettings::getIniFileName ( )

my Application IniFile

get Ini File Name. getIniFileName

Definition at line 314 of file MyOrgSettings.cpp.

315{
316 if (myIniFileName.isEmpty())
318 setMessage("get Ini File", QString("getIniFile(%1)").arg(myIniFileName), Debug);
319 return myIniFileName;
320}
QString getAppName()
my Application Name
void setIniFileName(const QString &thisIniFileName)
set IniFile

◆ getIniFullPath()

QString MyOrgSettings::getIniFullPath ( )

my Application IniFile

set Ini Full Path. getIniFullPath

Definition at line 362 of file MyOrgSettings.cpp.

363{
364 setMessage("get Ini Full Path", "getIniFullPath", Debug);
365 if (myIniFullPath.isEmpty())
366 {
367 // organizationName, organizationDomain, applicationName and applicationName
368 // are set in main.cpp, and passed into Constuctor, so they are set
369 QCoreApplication::setOrganizationName(getOrgName());
370 QCoreApplication::setOrganizationDomain(getOrgDomain());
371 QCoreApplication::setApplicationName(getAppName());
372 //QCoreApplication::setApplicationDisplayName(getAppName());
373 // see *.pro file where it is: DEFINES *= APP_VERSION=$${VERSION}
374 // cmake does not have this yet, this is a hack till I FIXME
375 QCoreApplication::setApplicationVersion(getVersion());
376 setIniFullPath(QString("%1%2%3.%4").arg(getAppDataLocation(), QDir::separator(), getIniFileName(), getIniFileExtension()));
377 }
378 return myIniFullPath;
379}
QString getAppDataLocation()
get AppData Location
void setIniFullPath(const QString &thisIniFileName)
set IniFile
QString getVersion()
my Application Version
QString getIniFileExtension()
getIniFileExtension
QString getIniFileName()
my Application IniFile
QString getOrgDomain()
my Organization Domain
QString getOrgName()
get Org Name

◆ getInternetWait()

bool MyOrgSettings::getInternetWait ( )

get Internet Wait

get Internet Wait. getInternetWait

Definition at line 718 of file MyOrgSettings.cpp.

719{
720 setMessage("get Internet Wait", "getInternetWait", Debug);
721#ifdef MY_INTERNET_CHECK_PING
722 if (pingInternet()) { return true; }
723#else
724 if (connectInternet()) { return true; }
725#endif
726
727 bool isNotConnected = true;
728 while (isNotConnected)
729 {
730 delay(30);
731#ifdef MY_INTERNET_CHECK_PING
732 isNotConnected = pingInternet();
733#else
734 isNotConnected = connectInternet();
735#endif
737 }
738 return true;
739} // end delay
bool connectInternet()
connect Internet
void sendInternetProgress()
send Internet Progress
bool pingInternet()
ping Internet
void delay(int thisSeconds)
delay

◆ getLastApplicationPath()

QString MyOrgSettings::getLastApplicationPath ( )

get Last Application Path

get Last Application Path. getLastApplicationPath

Definition at line 167 of file MyOrgSettings.cpp.

168{
169 if (myLastApplicationFolder.isEmpty())
170 {
171 //
172 QString theProjectPath = QCoreApplication::applicationFilePath();
173 if (!isPathExists(theProjectPath))
174 {
175 setMessage("get Last Application Path", QString("%1 getLastApplicationPath(%2) - %3").arg(tr("getLastApplicationPath not found"), myLastApplicationFolder, theProjectPath), Warning);
176 theProjectPath = QDir::currentPath();
177 }
179 }
180 setMessage("get Last Application Path", QString("getLastApplicationPath(%1)").arg(myLastApplicationFolder), Debug);
181 return myLastApplicationFolder;
182}
void setLastApplicationPath(const QString &thisPath)
set Last Application Path
const QString MY_LAST_PROJECT_FOLDER
MY_QT_PROJECT_NAME
Definition: MyOrgSettings.h:91
QString readSettings(const QString &thisSetting, const QString &thisDefault)
read Settings

◆ getOrgDomain()

QString MyOrgSettings::getOrgDomain ( )

my Organization Domain

get Org Domain. getOrgDomain

Definition at line 220 of file MyOrgSettings.cpp.

221{
222 if (myOrganizationDomain.isEmpty()) { setOrgDomain(qApp->organizationDomain()); }
223 setMessage("get Org Domain", QString("getOrgDomain(%1)").arg(myOrganizationDomain), Debug);
224 return myOrganizationDomain;
225} // end getOrgDomain
void setOrgDomain(const QString &thisOrgDomain)
set Org Domain. setOrgDomain

◆ getOrgName()

QString MyOrgSettings::getOrgName ( )

get Org Name

This value is used for Qt Settings: GitHub Account Name is one example. getOrgName.

Definition at line 197 of file MyOrgSettings.cpp.

198{
199 if (myOrganizationName.isEmpty()) { setOrgName(qApp->organizationName()); }
200 setMessage("get Org Name", QString("getOrgName(%1)").arg(myOrganizationName), Debug);
201 return myOrganizationName;
202} // end getOrgName
void setOrgName(const QString &thisOrgName)
set Org Name

◆ getSetteings()

QSettings * MyOrgSettings::getSetteings ( )

on Update Settings. onUpdateSettings

Definition at line 60 of file MyOrgSettings.cpp.

61{
62 return mySettings;
63}

◆ getSettings()

QSettings * MyOrgSettings::getSettings ( )

get Settings

get Settings. getSettings

Definition at line 68 of file MyOrgSettings.cpp.

69{
70 setMessage("get Settings", "getSettings", Debug);
72 {
73 if (!isFileMake(getAppDataLocation(), QString("%1.%2").arg(getIniFileName(), getIniFileExtension())))
74 {
75 setMessage("get Settings", QString("%1: %2").arg(QObject::tr("Failed to make File in getSettings"), getIniFullPath()), Critical);
76 }
77 }
78 return new QSettings(getIniFullPath(), QSettings::IniFormat);
79} // end qSettingsInstance
QString getIniFullPath()
my Application IniFile
bool isFileMake(const QString &thisPath, const QString &thisFileName)
is File Make

◆ getVersion()

QString MyOrgSettings::getVersion ( )

my Application Version

get Version is set in header as a default. getVersion

Definition at line 266 of file MyOrgSettings.cpp.

267{
268 setMessage("get Version", QString("getVersion(%1)").arg(myVersion), Debug);
269 return myVersion;
270}

◆ getWindowState()

QByteArray MyOrgSettings::getWindowState ( )

get Geometry Min

get Window State. getWindowState

Definition at line 432 of file MyOrgSettings.cpp.

433{
434 setMessage("get Window State", "getWindowState", Debug);
435 // Window State
436 mySettings->beginGroup("Geometry");
437 myWindowState = mySettings->value(MY_WINDOW_STATES).toByteArray();
438 mySettings->endGroup();
439 return myWindowState;
440}
const QString MY_WINDOW_STATES
MY_WINDOW_STATES

◆ isAppDataLocationGood()

bool MyOrgSettings::isAppDataLocationGood ( const QString &  thisFolder)

is AppData Location Good

is App Data Location Good. isAppDataLocationGood

Definition at line 568 of file MyOrgSettings.cpp.

569{
570 setMessage("is App Data Location Good", QString("isAppDataLocationGood(%1)").arg(thisFolder), Debug);
571 bool isGood = true;
572 if (isFileMake(thisFolder, "ReadMe.txt"))
573 {
574 if (getFileInfo(IsWritable, combinePathFileName(thisFolder, "ReadMe.txt")) == "false")
575 { isGood = false; }
576 }
577 else
578 { isGood = false; }
579 if (getFileInfo(IsFolder, thisFolder) == "false")
580 { isGood = false; }
581 return isGood;
582} // end isAppDataLocationGood
QString combinePathFileName(const QString &thisPath, const QString &thisFileName)
combine Path File Name
QString getFileInfo(MyOrgSettings::MyFileinfo thisInfo, const QString &thisFileFolder)
get File Info

◆ isFileExists()

bool MyOrgSettings::isFileExists ( const QString &  thisFile)

File Functions.

is File Exists. isFileExists

Definition at line 794 of file MyOrgSettings.cpp.

795{
796 setMessage("is File Exists", QString("isFileExists(%1)").arg(thisFile), Debug);
797 // check if file exists and if yes: Is it really a file and not directory?
798 return QFileInfo::exists(thisFile) && QFileInfo(thisFile).isFile();
799} // end isFileExists

◆ isFileMake()

bool MyOrgSettings::isFileMake ( const QString &  thisPath,
const QString &  thisFileName 
)

is File Make

is File Make. isFileMake

Definition at line 815 of file MyOrgSettings.cpp.

816{
817 setMessage("is File Make", QString("isFileMake(%1, %2)").arg(thisPath, thisFileName), Debug);
818 isCreated = false;
819 QString thePath = combinePathFileName(thisPath, thisFileName);
820 if (!isMakeDir(thisPath)) return false;
821 if (!isFileExists(thePath))
822 {
823 QFile theFile(thePath);
824 if (theFile.open(QIODevice::WriteOnly))
825 {
826 /* Point a QTextStream object at the file */
827 QTextStream outStream(&theFile);
828 /* Write the line to the file */
829 outStream << QString("%1 %2").arg(QObject::tr("This file was created to test if this folder is writeable by"), QCoreApplication::applicationName()).toLocal8Bit();
830 /* Close the file */
831 theFile.close();
832 if (isFileExists(thePath)) { isCreated = true; }
833 return isCreated;
834 }
835 else return false;
836 }
837 return true;
838} // end isFileMake
bool isMakeDir(const QString &thisPath)
is Make Dir

◆ isMakeDir()

bool MyOrgSettings::isMakeDir ( const QString &  thisPath)

is Make Dir

is Make Dir. isMakeDir

Definition at line 843 of file MyOrgSettings.cpp.

844{
845 setMessage("is Make Dir", QString("isMakeDir(%1)").arg(thisPath), Debug);
846 QDir dir(thisPath);
847 if (!dir.exists())
848 {
849 if (!dir.mkpath("."))
850 { setMessage(QObject::tr("File System Error").toLocal8Bit(), QString("%1 %2").arg(tr("Error: cannot create file"), thisPath).toLocal8Bit(), Critical); }
851 else return true;
852 }
853 return isPathExists(thisPath);
854} // end isMakeDir

◆ isPathExists()

bool MyOrgSettings::isPathExists ( const QString &  thisPath)

is Path Exists

is Path Exists. isPathExists

Definition at line 785 of file MyOrgSettings.cpp.

786{
787 setMessage("is Path Exists", QString("isPathExists(%1)").arg(thisPath), Debug);
788 return QDir(thisPath).exists() && QFileInfo(thisPath).isDir();
789} // end isPathExists

◆ isSetting()

bool MyOrgSettings::isSetting ( const QString &  thisFieldName)

is Setting

is Setting. isSetting

Definition at line 84 of file MyOrgSettings.cpp.

85{
86 setMessage("is Setting", QString("isSetting(%1)").arg(thisFieldName), Debug);
87 return mySettings->contains(thisFieldName);
88} // end isSetting

◆ isWord()

bool MyOrgSettings::isWord ( const QString &  thisString) const

is Word

is Word only checks to see if any letters are in it. isWord

Definition at line 647 of file MyOrgSettings.cpp.

648{
649 setMessage("is Word", QString("isWord(%1)").arg(thisString), Debug);
650 for(int i = 0; i < thisString.length(); i++)
651 {
652 if (thisString.at(i).isLetter())
653 { return true; }
654 }
655 return false;
656}

◆ onRunOnStartup()

void MyOrgSettings::onRunOnStartup ( )

Run On Startup.

Run On Start up. onRunOnStartup.

Definition at line 37 of file MyOrgSettings.cpp.

38{
39 if (isDebugMessage)
40 {
41 setMessage("on Run On Start up", "onRunOnStartup", Debug);
42 // FIXME move to test project
43 QString theTest = "This is my Secret";
44 if (theTest != decryptThis(encryptThis(theTest)))
45 { setMessage(QObject::tr("Crypto Fail").toLocal8Bit(), tr("Crypto Fail: MyOrgSettings::onRunOnStartup()").toLocal8Bit(), Critical); }
46 }
47}
QString decryptThis(const QString &thisSecret)
decrypt This
QString encryptThis(const QString &thisSecret)
encrypt This

◆ pingInternet()

bool MyOrgSettings::pingInternet ( )

ping Internet

◆ questionYesNo()

bool MyOrgSettings::questionYesNo ( const char *  thisTitle,
const char *  thisQuestion 
) const

question Yes No

Titel and Question Yes No. questionYesNo.

Definition at line 877 of file MyOrgSettings.cpp.

878{
879 if (setMessage(thisTitle, thisQuestion, MyMessageTypes::Question) == "true")
880 { return true; }
881 else
882 { return false; }
883} // end questionYesNo

◆ readFile()

QString MyOrgSettings::readFile ( const QString &  thisFileName)

read File

read File. readFile

Definition at line 445 of file MyOrgSettings.cpp.

446{
447 setMessage("read File", QString("readFile(%1)").arg(thisFileName), Debug);
448 QFile file(thisFileName);
449 if(!file.open(QFile::ReadOnly | QFile::Text))
450 {
451 setMessage(QObject::tr("Error opening file for reading").toLocal8Bit(), QString("%1: %2").arg(QObject::tr("Could not open file for reading"), thisFileName).toLocal8Bit(), Critical);
452 return "";
453 }
454 QTextStream in(&file);
455 QString thisText = in.readAll();
456 file.close();
457 return thisText;
458}

◆ readSettings() [1/2]

QString MyOrgSettings::readSettings ( const QString &  thisSetting)

read Settings

read Settings. readSettings

Definition at line 105 of file MyOrgSettings.cpp.

106{
107 setMessage("read Settings", QString("readSettings(%1)").arg(thisSetting), Debug);
108 mySettings->beginGroup("General");
109 QString theSetting = mySettings->value(thisSetting).toString();
110 mySettings->endGroup();
111 return theSetting;
112}

◆ readSettings() [2/2]

QString MyOrgSettings::readSettings ( const QString &  thisSetting,
const QString &  thisDefault 
)

read Settings

read Settings. readSettings

Definition at line 93 of file MyOrgSettings.cpp.

94{
95 setMessage("read Settings", QString("readSettings(%1, %2)").arg(thisSetting, thisDefault), Debug);
96 mySettings->beginGroup("General");
97 QString theSetting = mySettings->value(thisSetting, thisDefault).toString();
98 mySettings->endGroup();
99 return theSetting;
100}

◆ readSettingsBool()

bool MyOrgSettings::readSettingsBool ( const QString &  thisSetting,
bool  thisDefault 
)

read Settings Bool

read Settings Bool. readSettingsBool

Definition at line 117 of file MyOrgSettings.cpp.

118{
119 setMessage("read Settings Bool", QString("readSettingsBool(%1, %2)").arg(thisSetting, thisDefault), Debug);
120 mySettings->beginGroup("General");
121 bool theSetting = mySettings->value(thisSetting, thisDefault).toBool();
122 mySettings->endGroup();
123 return theSetting;
124}

◆ readSettingsInt()

int MyOrgSettings::readSettingsInt ( const QString &  thisSetting,
int  thisDefault 
)

read Settings Int

read Settings Int. readSettingsInt

Definition at line 129 of file MyOrgSettings.cpp.

130{
131 setMessage("read Settings Int", QString("readSettingsInt(%1, %2)").arg(thisSetting, thisDefault), Debug);
132 mySettings->beginGroup("General");
133 int theSetting = mySettings->value(thisSetting, thisDefault).toInt();
134 mySettings->endGroup();
135 return theSetting;
136}

◆ removeAllFiles()

bool MyOrgSettings::removeAllFiles ( const QString &  thisFolder)

remove All Files

removeAllFiles. removeAllFiles

Definition at line 755 of file MyOrgSettings.cpp.

756{
757 setMessage("remove All Files", QString("removeAllFiles(%1)").arg(thisFolder), Debug);
758 if (!isPathExists(thisFolder)) { setMessage(QObject::tr("Folder not found").toLocal8Bit(), QString("%1: %2").arg(QObject::tr("Folder not found"), thisFolder).toLocal8Bit(), Critical); return false; }
759 QDir theDirFiles(thisFolder);
760 theDirFiles.setNameFilters(QStringList() << "*.*");
761 theDirFiles.setFilter(QDir::Files);
762 foreach(QString theDirFile, theDirFiles.entryList())
763 {
764 if (!theDirFiles.remove(theDirFile))
765 {
766 setMessage(QObject::tr("Files could not be removed").toLocal8Bit(), QString("%1: %2").arg(QObject::tr("Files could not be removed"), thisFolder).toLocal8Bit(), Critical);
767 return false;
768 }
769 }
770 return true;
771} // end removeAllFiles

◆ removeFile()

bool MyOrgSettings::removeFile ( const QString &  thisFile)

remove File

remove File. removeFile

Definition at line 804 of file MyOrgSettings.cpp.

805{
806 setMessage("remove File", QString("removeFile(%1)").arg(thisFile), Debug);
807 if (isFileExists(thisFile))
808 { return QFile::remove(thisFile); }
809 return true;
810}

◆ sendInternetProgress

void MyOrgSettings::sendInternetProgress ( )
signal

send Internet Progress

Definition at line 187 of file moc_MyOrgSettings.cpp.

188{
189 QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
190}

◆ sendUpdateSettings

void MyOrgSettings::sendUpdateSettings ( )
signal

send Update Settings

Definition at line 215 of file moc_MyOrgSettings.cpp.

216{
217 QMetaObject::activate(this, &staticMetaObject, 1, nullptr);
218}

◆ setAppDataLocation()

void MyOrgSettings::setAppDataLocation ( const QString &  thisAppDataLocation)

set AppData Location

set App Data Location. setAppDataLocation

Definition at line 613 of file MyOrgSettings.cpp.

614{
615 if (QString::compare(myAppDataLocation, thisAppDataLocation, Qt::CaseInsensitive))
616 {
617 myAppDataLocation = thisAppDataLocation;
618 emit sendUpdateSettings();
619 }
620} // end setAppDataLocation

◆ setAppName()

void MyOrgSettings::setAppName ( const QString &  thisAppName)

set AppName

set App Name. setAppName

Definition at line 253 of file MyOrgSettings.cpp.

254{
255 setMessage("set App Name", QString("setAppName(%1)").arg(thisAppName), Debug);
256 if (QString::compare(myApplicationName, thisAppName, Qt::CaseInsensitive))
257 {
258 myApplicationName = thisAppName;
259 emit sendUpdateSettings();
260 }
261} // end setAppName

◆ setCheckInternetUrl()

void MyOrgSettings::setCheckInternetUrl ( const QString &  thisCheckInternetUrl)

set Check Internet Url

set CheckInternetUrl. setCheckInternetUrl theLanguageModel->mySetting->setVersion(VERSION);

Definition at line 301 of file MyOrgSettings.cpp.

302{
303 setMessage("set CheckInternetUrl", QString("setCheckInternetUrl(%1)").arg(thisCheckInternetUrl), Debug);
304 if (QString::compare(myCheckInternetUrl, thisCheckInternetUrl, Qt::CaseInsensitive))
305 {
306 myCheckInternetUrl = thisCheckInternetUrl;
307 emit sendUpdateSettings();
308 }
309}

◆ setDebugMessage()

void MyOrgSettings::setDebugMessage ( bool  thisState)

set Debug Message

set Debug Message. setDebugMessage

Definition at line 859 of file MyOrgSettings.cpp.

860{
861 isDebugMessage = thisState;
862 setMessage("set Debug Message", QString("setDebugMessage(%1)").arg(thisState), Debug);
863}

◆ setGeometry()

void MyOrgSettings::setGeometry ( QByteArray  thisGeometry)

Screen Geometry.

set Geometry. setGeometry

Definition at line 397 of file MyOrgSettings.cpp.

398{
399 setMessage("set Geometry", "setGeometry", Debug);
400 mySettings->beginGroup("Geometry");
401 mySettings->setValue(MY_GEOMETRY, thisGeometry);
402 mySettings->endGroup();
403} // end setGeometry

◆ setIniFileExtension()

void MyOrgSettings::setIniFileExtension ( const QString &  thisIniFileNameExtension)

set Ini File Extension

set Ini File Extension. setIniFileExtension

Definition at line 349 of file MyOrgSettings.cpp.

350{
351 setMessage("set Ini File", QString("setIniFile(%1)").arg(thisIniFileNameExtension), Debug);
352 if (QString::compare(myIniFileExtension, thisIniFileNameExtension, Qt::CaseInsensitive))
353 {
354 myIniFileExtension = thisIniFileNameExtension;
355 emit sendUpdateSettings();
356 }
357}

◆ setIniFileName()

void MyOrgSettings::setIniFileName ( const QString &  thisIniFileName)

set IniFile

set Ini File Name. setIniFileName

Definition at line 325 of file MyOrgSettings.cpp.

326{
327 setMessage("set Ini File", QString("setIniFile(%1)").arg(thisIniFileName), Debug);
328 if (QString::compare(myIniFileName, thisIniFileName, Qt::CaseInsensitive))
329 {
330 myIniFileName = thisIniFileName;
331 emit sendUpdateSettings();
332 }
333}

◆ setIniFullPath()

void MyOrgSettings::setIniFullPath ( const QString &  thisIniFileName)

set IniFile

set Ini Full Path. setIniFullPath

Definition at line 384 of file MyOrgSettings.cpp.

385{
386 setMessage("set Ini Full Path", QString("%1(%2)").arg("setIniFullPath", thisIniFileName), Debug);
387 if (QString::compare(myIniFullPath, thisIniFileName, Qt::CaseInsensitive))
388 {
389 myIniFullPath = thisIniFileName;
390 emit sendUpdateSettings();
391 }
392}

◆ setLastApplicationPath()

void MyOrgSettings::setLastApplicationPath ( const QString &  thisPath)

set Last Application Path

set Last Application Path. setLastApplicationPath

Definition at line 187 of file MyOrgSettings.cpp.

188{
189 setMessage("set Last Application Path", QString("setLastApplicationPath(%1)").arg(thisPath), Debug);
190 myLastApplicationFolder = thisPath;
192}
void writeSettings(const QString &thisSetting, const QString &thisValue)
write Settings

◆ setMessage()

QVariant MyOrgSettings::setMessage ( const QString &  thisTitle,
const QString &  thisMessage,
MyMessageTypes  thisMessageType 
) const

set Message

set Message. setMessage

Definition at line 899 of file MyOrgSettings.cpp.

900{
901 switch (thisMessageType)
902 {
903 case Debug:
904 {
905#ifdef MY_QML
906#ifdef DEBUG
907 // FIXME
908 if (isDebugMessage)
909 {
910#ifdef QT_DEBUG
911 qDebug() << thisMessage;
912#else
913 std::cout << thisMessage.toStdString() << std::endl;
914#endif
915 }
916#else
917 if (isDebugMessage)
918 { std::cout << thisMessage.toStdString() << std::endl; }
919#endif
920 return "";
921#else
922 if (isDebugMessage)
923 {
924#ifdef QT_DEBUG
925 qDebug() << thisMessage;
926#else
927 std::cout << thisMessage.toStdString() << std::endl;
928#endif
929 }
930 return "";
931#endif
932 }
933 case Information:
934 {
935#ifdef MY_QML
936#ifdef QT_DEBUG
937 // FIXME
938 qInfo() << thisMessage;
939#else
940 std::cout << thisMessage.toStdString() << std::endl;
941#endif
942 return "";
943#else
944 return QMessageBox::information(nullptr, thisTitle, thisMessage, QMessageBox::Ok);
945#endif
946 }
947 case Question:
948 {
949#ifdef MY_QML
950 // FIXME
951#ifdef QT_DEBUG
952 qDebug() << thisMessage;
953#else
954 std::cout << thisMessage.toStdString() << std::endl;
955#endif
956 return "";
957#else
958 QMessageBox theMsgBox;
959 theMsgBox.setWindowTitle(QObject::tr(thisTitle.toLocal8Bit()));
960 theMsgBox.setText(QObject::tr(thisMessage.toLocal8Bit()));
961 theMsgBox.setStandardButtons(QMessageBox::Yes);
962 theMsgBox.addButton(QMessageBox::No);
963 theMsgBox.setDefaultButton(QMessageBox::No);
964 if(theMsgBox.exec() == QMessageBox::Yes)
965 {
966 setMessage("", QObject::tr("Yes was clicked"), Debug);
967 return true;
968 }
969 else
970 {
971 setMessage("", QObject::tr("Yes was not clicked"), Debug);
972 return false;
973 }
974
975#endif
976 }
977 case Warning:
978 {
979#ifdef MY_QML
980#ifdef QT_DEBUG
981 // FIXME
982 qWarning() << thisMessage;
983#else
984 std::cout << thisMessage.toStdString() << std::endl;
985#endif
986 return "";
987#else
988 return QMessageBox::warning(nullptr, thisTitle, thisMessage, QMessageBox::Ok);
989#endif
990 }
991 case Critical:
992 {
993#ifdef MY_QML
994#ifdef QT_DEBUG
995 // FIXME
996 qCritical() << thisMessage;
997#else
998 std::cout << thisMessage.toStdString() << std::endl;
999#endif
1000 return "";
1001#else
1002 return QMessageBox::critical(nullptr, thisTitle, thisMessage, QMessageBox::Ok);
1003#endif
1004 }
1005 } // end switch (thisMessageType)
1006 return QVariant();
1007} // end setMessage

◆ setOrgDomain()

void MyOrgSettings::setOrgDomain ( const QString &  thisOrgDomain)

set Org Domain. setOrgDomain

Definition at line 230 of file MyOrgSettings.cpp.

231{
232 setMessage("set Org Domain", QString("setOrgDomain(%1)").arg(thisOrgDomain), Debug);
233 if (QString::compare(myOrganizationDomain, thisOrgDomain, Qt::CaseInsensitive))
234 {
235 myOrganizationDomain = thisOrgDomain;
236 emit sendUpdateSettings();
237 }
238} // end setOrgDomain

◆ setOrgName()

void MyOrgSettings::setOrgName ( const QString &  thisOrgName)

set Org Name

set Org Name. setOrgName

Definition at line 207 of file MyOrgSettings.cpp.

208{
209 setMessage("set Org Name", QString("setOrgName(%1)").arg(thisOrgName), Debug);
210 if (QString::compare(myOrganizationName, thisOrgName, Qt::CaseInsensitive))
211 {
212 myOrganizationName = thisOrgName;
213 emit sendUpdateSettings();
214 }
215} // end setOrgName

◆ setVersion()

void MyOrgSettings::setVersion ( const QString &  thisVersion)

set Version

set Version. setVersion theLanguageModel->mySetting->setVersion(VERSION);

Definition at line 276 of file MyOrgSettings.cpp.

277{
278 setMessage("set Version", QString("setVersion(%1)").arg(thisVersion), Debug);
279 if (QString::compare(myVersion, thisVersion, Qt::CaseInsensitive))
280 {
281 myVersion = thisVersion;
282 emit sendUpdateSettings();
283 }
284}

◆ setWindowState()

void MyOrgSettings::setWindowState ( QByteArray  thisWindowState)

get Geometry Min

set Window State. setWindowState

Definition at line 421 of file MyOrgSettings.cpp.

422{
423 setMessage("set Window State", "setWindowState", Debug);
424 mySettings->beginGroup("Geometry");
425 mySettings->setValue(MY_WINDOW_STATES, thisWindowState);
426 mySettings->endGroup();
427}

◆ showMessageBox()

QVariant MyOrgSettings::showMessageBox ( const QString &  thisTitle,
const QString &  thisMessage,
MyMessageTypes  thisMessageType 
) const

show Message Box information, question, warning, critica

information, question: 1 = true, 0 = false, warning, critical: theMessage.toLocal8Bit().

Parameters
thisTitleQString Title
thisMessageQString Message
thisMessageTypeQString Message Type showMessageBox

Definition at line 891 of file MyOrgSettings.cpp.

892{
893 return setMessage(thisTitle, thisMessage, thisMessageType);
894} // end showMessageBox

◆ writeFile()

bool MyOrgSettings::writeFile ( const QString &  thisFileName,
const QString &  thisContent 
)

write File

write File.

Parameters
thisFileNameQString File Name
thisContentQString Content writeFile

Definition at line 465 of file MyOrgSettings.cpp.

466{
467 setMessage("write File", QString("writeFile(%1)").arg(thisFileName), Debug);
468 QFile theFile(thisFileName);
469 // Trying to open in WriteOnly and Text mode and Truncate file if contents exists
470 if(!theFile.open(QFile::WriteOnly | QFile::Text | QIODevice::Truncate))
471 {
472 setMessage(QObject::tr("Error opening file for writing").toLocal8Bit(), QString("%1: %2").arg(QObject::tr("Could not open file for writing"), thisFileName).toLocal8Bit(), Critical);
473 return false;
474 }
475 // Write to file
476 QTextStream theFileStream(&theFile);
477 theFileStream << thisContent;
478 theFile.flush();
479 theFile.close();
480 return true;
481} // end writeFile

◆ writeSettings()

void MyOrgSettings::writeSettings ( const QString &  thisSetting,
const QString &  thisValue 
)

write Settings

write Settings. writeSettings

Definition at line 141 of file MyOrgSettings.cpp.

142{
143 setMessage("write Settings", QString("writeSettings(%1, %2)").arg(thisSetting, thisValue), Debug);
144 mySettings->beginGroup("General");
145 mySettings->setValue(thisSetting, thisValue);
146 mySettings->endGroup();
147}

Member Data Documentation

◆ ConstDefaultGeometryPos

const QPoint MyOrgSettings::ConstDefaultGeometryPos = QPoint(10, 10)

ConstDefaultGeometryPos

Top, Left.

Definition at line 89 of file MyOrgSettings.h.

◆ ConstDefaultGeometrySize

const QSize MyOrgSettings::ConstDefaultGeometrySize = QSize(666, 333)

ConstDefaultGeometrySize

Width x Height.

Definition at line 90 of file MyOrgSettings.h.

◆ MY_APPLICATION_NAME

const QString MyOrgSettings::MY_APPLICATION_NAME = "SettingsApplicationName"

ConstSettingsApplicationName

QSettings Field Settings Application Name.

Definition at line 112 of file MyOrgSettings.h.

◆ MY_DATETIME_FORMAT_DUE

const QString MyOrgSettings::MY_DATETIME_FORMAT_DUE = "DateTimeFormatDue"

MY_DATETIME_FORMAT_STARTED

DateTime Format Storage Field Name.

Definition at line 106 of file MyOrgSettings.h.

◆ MY_DATETIME_FORMAT_STARTED

const QString MyOrgSettings::MY_DATETIME_FORMAT_STARTED = "DateTimeFormatStarted"

MY_DATETIME_FORMAT_STARTED

DateTime Format Storage Field Name.

Definition at line 105 of file MyOrgSettings.h.

◆ MY_DEFAULT_LANGUAGE_CODE

const QString MyOrgSettings::MY_DEFAULT_LANGUAGE_CODE = "en"

MY_DEFAULT_LANGUAGE_CODE

Used to find default Translation Files

Definition at line 110 of file MyOrgSettings.h.

◆ MY_DEFAULT_SQL

const QString MyOrgSettings::MY_DEFAULT_SQL = ":memory:"

MY_DEFAULT_SQL

Default Sql Driver is in memory.

Definition at line 97 of file MyOrgSettings.h.

◆ MY_DEFAULT_TAB_INDEX

const QString MyOrgSettings::MY_DEFAULT_TAB_INDEX = "0"

MY_DEFAULT_TAB_INDEX

Default Tab Index.

Definition at line 118 of file MyOrgSettings.h.

◆ MY_GEOMETRY

const QString MyOrgSettings::MY_GEOMETRY = "Geometry"

ConstSettingsGeometry

QSettings Field Settings Geometry.

Definition at line 115 of file MyOrgSettings.h.

◆ MY_HELP_FOLDER

const QString MyOrgSettings::MY_HELP_FOLDER = "help"

MY_HELP_FOLDER

Help folder.

Definition at line 86 of file MyOrgSettings.h.

◆ MY_INI_EXTENSION

const QString MyOrgSettings::MY_INI_EXTENSION = "ini"

MY_INI_EXTENSION

Ini File Extension.

Definition at line 85 of file MyOrgSettings.h.

◆ MY_INTERNET_URL

const QString MyOrgSettings::MY_INTERNET_URL = "http://www.google.com"

MY_INTERNET_URL

Default Internet URL for testing if Internet is up.

Definition at line 87 of file MyOrgSettings.h.

◆ MY_IS_DEBUG_MESSAGE

const QString MyOrgSettings::MY_IS_DEBUG_MESSAGE = "IsDebugMessage"

MY_IS_DEBUG_MESSAGE

Field Name for IsDebugMessage.

Definition at line 92 of file MyOrgSettings.h.

◆ MY_LAST_PROJECT_FOLDER

const QString MyOrgSettings::MY_LAST_PROJECT_FOLDER = "LastProjectFolder"

MY_QT_PROJECT_NAME

Field Name for Last Project folder.

Definition at line 91 of file MyOrgSettings.h.

◆ MY_LAST_TAB_INDEX

const QString MyOrgSettings::MY_LAST_TAB_INDEX = "LastTabInex"

MY_LAST_TAB

Field Name for Current Last Tab Index.

Definition at line 117 of file MyOrgSettings.h.

◆ MY_LOCALE_LANG_CODE

const QString MyOrgSettings::MY_LOCALE_LANG_CODE = "LocaleLanguageCode"

MY_CURRENT_LANG_CODE

Field Name for Current Language Code.

Definition at line 93 of file MyOrgSettings.h.

◆ MY_LOCALE_LANG_NAME

const QString MyOrgSettings::MY_LOCALE_LANG_NAME = "LocaleLanguageName"

MY_LOCALE_LANG_NAME

Field Name for Current Language Name.

Definition at line 94 of file MyOrgSettings.h.

◆ MY_ORG_DOMAIN

const QString MyOrgSettings::MY_ORG_DOMAIN = "SettingsOrgDomain"

ConstSettingsOrgDomain

QSettings Field Settings Org Domain.

Definition at line 114 of file MyOrgSettings.h.

◆ MY_ORG_NAME

const QString MyOrgSettings::MY_ORG_NAME = "SettingsOrgName"

ConstSettingsOrgName

QSettings Field Settings Org Name.

Definition at line 113 of file MyOrgSettings.h.

◆ MY_PROJECT_NAME

const QString MyOrgSettings::MY_PROJECT_NAME = "QmlWidgetTranslator"

MY_QT_PROJECT_NAME

Qt Project Name.

Definition at line 84 of file MyOrgSettings.h.

◆ MY_PROJECT_STATUS

const QString MyOrgSettings::MY_PROJECT_STATUS = "ProjectStatus"

MY_PROJECT_STATUS

Project Status Storage Field Name.

Definition at line 107 of file MyOrgSettings.h.

◆ MY_SQL_DB_HOST

const QString MyOrgSettings::MY_SQL_DB_HOST = "SqlDatabaseHost"

MY_SQL_DB_HOST

SQL Ini Storage Field Name.

Definition at line 102 of file MyOrgSettings.h.

◆ MY_SQL_DB_NAME

const QString MyOrgSettings::MY_SQL_DB_NAME = "SqlDatabaseName"

MY_SQL_DB_NAME

SQL Ini Storage Field Name.

Definition at line 100 of file MyOrgSettings.h.

◆ MY_SQL_DB_PASS

const QString MyOrgSettings::MY_SQL_DB_PASS = "SqlDatabasePass"

MY_SQL_DB_PASS

SQL Ini Storage Field Name.

Definition at line 104 of file MyOrgSettings.h.

◆ MY_SQL_DB_TYPE

const QString MyOrgSettings::MY_SQL_DB_TYPE = "SqlDatabaseType"

MY_SQL_DB_TYPE

SQL Ini Storage Field Name.

Definition at line 101 of file MyOrgSettings.h.

◆ MY_SQL_DB_USER

const QString MyOrgSettings::MY_SQL_DB_USER = "SqlDatabaseUser"

MY_SQL_DB_USER

SQL Ini Storage Field Name.

Definition at line 103 of file MyOrgSettings.h.

◆ MY_SQL_DEFAULT

const QString MyOrgSettings::MY_SQL_DEFAULT = "QSQLITE"

SQL_DEFAULT

Default Sql Driver QSQLITE.

Definition at line 96 of file MyOrgSettings.h.

◆ MY_SQL_PROJECT_ID

const QString MyOrgSettings::MY_SQL_PROJECT_ID = "ProjectID"

SQL_PROJECT_ID

Field Name for Project ID.

Definition at line 98 of file MyOrgSettings.h.

◆ MY_SQL_PROJECT_NAME

const QString MyOrgSettings::MY_SQL_PROJECT_NAME = "ProjectName"

MY_SQL_PROJECT_NAME

Field Name for Project ID.

Definition at line 99 of file MyOrgSettings.h.

◆ MY_WINDOW_STATES

const QString MyOrgSettings::MY_WINDOW_STATES = "WidowState"

MY_WINDOW_STATES

QSettings Field Window State.

Definition at line 116 of file MyOrgSettings.h.

◆ myCrypto

SimpleCrypt* MyOrgSettings::myCrypto

myCrypto

my Crypto

Definition at line 81 of file MyOrgSettings.h.


The documentation for this class was generated from the following files: