mac patches
This commit is contained in:
parent
0d63bb7316
commit
4f13c01e12
6 changed files with 43 additions and 6 deletions
|
@ -118,4 +118,5 @@ win32 {
|
||||||
macx {
|
macx {
|
||||||
ICON = resources/appicon.icns
|
ICON = resources/appicon.icns
|
||||||
CONFIG += x86 ppc
|
CONFIG += x86 ppc
|
||||||
|
LIBS += -bind_at_load
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,15 +492,19 @@ void CardDatabase::picDownloadChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CardDatabase::loadCardDatabase()
|
bool CardDatabase::loadCardDatabase(const QString &path)
|
||||||
{
|
{
|
||||||
QString cardDatabasePath = settingsCache->getCardDatabasePath();
|
if (!path.isEmpty())
|
||||||
if (!cardDatabasePath.isEmpty())
|
loadSuccess = loadFromFile(path);
|
||||||
loadSuccess = loadFromFile(cardDatabasePath);
|
|
||||||
else loadSuccess = false;
|
else loadSuccess = false;
|
||||||
return loadSuccess;
|
return loadSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CardDatabase::loadCardDatabase()
|
||||||
|
{
|
||||||
|
return loadCardDatabase(settingsCache->getCardDatabasePath());
|
||||||
|
}
|
||||||
|
|
||||||
QStringList CardDatabase::getAllColors() const
|
QStringList CardDatabase::getAllColors() const
|
||||||
{
|
{
|
||||||
QSet<QString> colors;
|
QSet<QString> colors;
|
||||||
|
|
|
@ -121,9 +121,10 @@ public:
|
||||||
bool getLoadSuccess() const { return loadSuccess; }
|
bool getLoadSuccess() const { return loadSuccess; }
|
||||||
public slots:
|
public slots:
|
||||||
void clearPixmapCache();
|
void clearPixmapCache();
|
||||||
|
bool loadCardDatabase(const QString &path);
|
||||||
|
bool loadCardDatabase();
|
||||||
private slots:
|
private slots:
|
||||||
void picDownloadFinished(QNetworkReply *reply);
|
void picDownloadFinished(QNetworkReply *reply);
|
||||||
bool loadCardDatabase();
|
|
||||||
void picDownloadChanged();
|
void picDownloadChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,18 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// qInstallMsgHandler(myMessageOutput);
|
// qInstallMsgHandler(myMessageOutput);
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QDir baseDir(app.applicationDirPath());
|
||||||
|
baseDir.cdUp();
|
||||||
|
QDir pluginsDir = baseDir;
|
||||||
|
pluginsDir.cd("PlugIns");
|
||||||
|
app.addLibraryPath(pluginsDir.absolutePath());
|
||||||
|
baseDir.cdUp();
|
||||||
|
baseDir.cdUp();
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
app.addLibraryPath(app.applicationDirPath() + "/plugins");
|
app.addLibraryPath(app.applicationDirPath() + "/plugins");
|
||||||
|
#endif
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName("Cockatrice");
|
QCoreApplication::setOrganizationName("Cockatrice");
|
||||||
|
@ -83,6 +94,15 @@ int main(int argc, char *argv[])
|
||||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||||
|
|
||||||
bool startMainProgram = true;
|
bool startMainProgram = true;
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
if (!db->getLoadSuccess())
|
||||||
|
if (db->loadCardDatabase(baseDir.absolutePath() + "/cards.xml"))
|
||||||
|
settingsCache->setCardDatabasePath(baseDir.absolutePath() + "/cards.xml");
|
||||||
|
if (!QDir(settingsCache->getDeckPath()).exists())
|
||||||
|
settingsCache->setDeckPath(baseDir.absolutePath() + "/decks");
|
||||||
|
if (!QDir(settingsCache->getPicsPath()).exists())
|
||||||
|
settingsCache->setPicsPath(baseDir.absolutePath() + "/pics");
|
||||||
|
#endif
|
||||||
if (!db->getLoadSuccess() || !QDir(settingsCache->getDeckPath()).exists() || !QDir(settingsCache->getPicsPath()).exists()) {
|
if (!db->getLoadSuccess() || !QDir(settingsCache->getDeckPath()).exists() || !QDir(settingsCache->getPicsPath()).exists()) {
|
||||||
DlgSettings dlgSettings;
|
DlgSettings dlgSettings;
|
||||||
dlgSettings.show();
|
dlgSettings.show();
|
||||||
|
|
|
@ -8,3 +8,8 @@ QT += network svg xml
|
||||||
|
|
||||||
HEADERS += src/oracleimporter.h src/window_main.h ../cockatrice/src/carddatabase.h ../cockatrice/src/settingscache.h
|
HEADERS += src/oracleimporter.h src/window_main.h ../cockatrice/src/carddatabase.h ../cockatrice/src/settingscache.h
|
||||||
SOURCES += src/main.cpp src/oracleimporter.cpp src/window_main.cpp ../cockatrice/src/carddatabase.cpp ../cockatrice/src/settingscache.cpp
|
SOURCES += src/main.cpp src/oracleimporter.cpp src/window_main.cpp ../cockatrice/src/carddatabase.cpp ../cockatrice/src/settingscache.cpp
|
||||||
|
|
||||||
|
macx {
|
||||||
|
CONFIG += x86 ppc
|
||||||
|
LIBS += -bind_at_load
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,13 @@ const QString WindowMain::defaultSetsUrl = QString("http://www.cockatrice.de/fil
|
||||||
WindowMain::WindowMain(QWidget *parent)
|
WindowMain::WindowMain(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
importer = new OracleImporter(qApp->applicationDirPath(), this);
|
QDir dataDir(qApp->applicationDirPath());
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
dataDir.cdUp();
|
||||||
|
dataDir.cdUp();
|
||||||
|
dataDir.cdUp();
|
||||||
|
#endif
|
||||||
|
importer = new OracleImporter(dataDir.absolutePath(), this);
|
||||||
nam = new QNetworkAccessManager(this);
|
nam = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
checkBoxLayout = new QVBoxLayout;
|
checkBoxLayout = new QVBoxLayout;
|
||||||
|
|
Loading…
Reference in a new issue