Refactoring: Move gzip/diff/awk path default values init on Windows into the Preferences class
This commit is contained in:
parent
a9da643fb2
commit
fd22d49ead
@ -38,23 +38,11 @@ extern ProtocolWidgetFactory *OstProtocolWidgetFactory;
|
||||
QSettings *appSettings;
|
||||
QMainWindow *mainWindow;
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
QString kGzipPathDefaultValue;
|
||||
QString kDiffPathDefaultValue;
|
||||
QString kAwkPathDefaultValue;
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
int exitCode;
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
kGzipPathDefaultValue = app.applicationDirPath() + "/gzip.exe";
|
||||
kDiffPathDefaultValue = app.applicationDirPath() + "/diff.exe";
|
||||
kAwkPathDefaultValue = app.applicationDirPath() + "/gawk.exe";
|
||||
#endif
|
||||
|
||||
app.setApplicationName("Ostinato");
|
||||
app.setOrganizationName("Ostinato");
|
||||
app.setProperty("version", version);
|
||||
|
@ -25,6 +25,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include <QFileDialog>
|
||||
#include <QtGlobal>
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
QString kGzipPathDefaultValue;
|
||||
QString kDiffPathDefaultValue;
|
||||
QString kAwkPathDefaultValue;
|
||||
#endif
|
||||
|
||||
QString kUserDefaultValue;
|
||||
|
||||
Preferences::Preferences()
|
||||
@ -53,9 +59,14 @@ Preferences::~Preferences()
|
||||
|
||||
void Preferences::initDefaults()
|
||||
{
|
||||
Q_ASSERT(appSettings);
|
||||
|
||||
// Read username from the environment
|
||||
#if defined(Q_OS_WIN32)
|
||||
kGzipPathDefaultValue = QApplication::applicationDirPath() + "/gzip.exe";
|
||||
kDiffPathDefaultValue = QApplication::applicationDirPath() + "/diff.exe";
|
||||
kAwkPathDefaultValue = QApplication::applicationDirPath() + "/gawk.exe";
|
||||
#endif
|
||||
|
||||
// Read default username from the environment
|
||||
#ifdef Q_OS_WIN32
|
||||
kUserDefaultValue = QString(qgetenv("USERNAME").constData());
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user