Merge pull request #314 from ctrlaltca/win32_setup_fix

Fix oracle under windows
This commit is contained in:
Gavin Bisesi 2014-10-02 10:35:22 -04:00
commit 48817ed283
2 changed files with 22 additions and 13 deletions

View file

@ -51,13 +51,15 @@ Section "Application" SecApplication
SectionEnd
Section "Update configuration" SecUpdateConfig
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$APPDATA\Cockatrice\cards.xml"
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$APPDATA\Cockatrice\decks"
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$APPDATA\Cockatrice\pics"
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$APPDATA\Cockatrice\sounds"
SetShellVarContext current
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$LOCALAPPDATA\Cockatrice\cards.xml"
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$LOCALAPPDATA\Cockatrice\decks"
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$LOCALAPPDATA\Cockatrice\pics"
WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$LOCALAPPDATA\Cockatrice\sounds"
SectionEnd
Section "Start menu item" SecStartMenu
SetShellVarContext all
createDirectory "$SMPROGRAMS\Cockatrice"
createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" '--debug-output'
createShortCut "$SMPROGRAMS\Cockatrice\Oracle.lnk" "$INSTDIR\oracle.exe"
@ -65,7 +67,7 @@ Section "Start menu item" SecStartMenu
SectionEnd
Section Uninstall
SetShellVarContext all
SetShellVarContext all
RMDir /r "$INSTDIR\zonebg"
RMDir /r "$INSTDIR\plugins"
RMDir /r "$INSTDIR\sounds"
@ -83,8 +85,10 @@ SetShellVarContext all
RMDir "$SMPROGRAMS\Cockatrice"
DeleteRegKey HKCU "Software\Cockatrice"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice"
SetShellVarContext current
DeleteRegKey HKCU "Software\Cockatrice"
SectionEnd
LangString DESC_SecApplication ${LANG_ENGLISH} "Cockatrice program files"

View file

@ -7,6 +7,7 @@
#endif
#include <QAbstractButton>
#include <QCheckBox>
#include <QDir>
#include <QFileDialog>
#include <QGridLayout>
#include <QLabel>
@ -403,15 +404,13 @@ bool SaveSetsPage::validatePage()
QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
QSettings* settings = new QSettings(this);
QString savePath = settings->value("paths/carddatabase").toString();
if (savePath.isEmpty()) {
QDir().mkpath(dataDir);
}
QString defaultPath = settings->value("paths/carddatabase").toString();
QString windowName = tr("Save card database");
QString fileType = tr("XML; card database (*.xml)");
do {
QString fileName;
if (savePath.isEmpty()) {
if (defaultPath.isEmpty()) {
if (defaultPathCheckBox->isChecked())
fileName = dataDir + "/cards.xml";
else
@ -420,13 +419,19 @@ bool SaveSetsPage::validatePage()
}
else {
if (defaultPathCheckBox->isChecked())
fileName = savePath;
fileName = defaultPath;
else
fileName = QFileDialog::getSaveFileName(this, windowName, savePath, fileType);
fileName = QFileDialog::getSaveFileName(this, windowName, defaultPath, fileType);
}
if (fileName.isEmpty()) {
return false;
}
QFileInfo fi(fileName);
QDir fileDir(fi.path());
if (!fileDir.exists() && !fileDir.mkpath(fileDir.absolutePath())) {
return false;
}
if (wizard()->importer->saveToFile(fileName))
{
ok = true;