mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
Merge remote-tracking branch 'upstream/master' into cmake_qt5
This commit is contained in:
commit
809f390e2f
13 changed files with 155 additions and 101 deletions
|
|
@ -130,6 +130,7 @@ set(COCKATRICE_LIBS)
|
|||
# Qt4 stuff
|
||||
if(Qt4_FOUND)
|
||||
if (NOT QT_QTMULTIMEDIA_FOUND)
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
FIND_PACKAGE(QtMobility REQUIRED)
|
||||
endif (NOT QT_QTMULTIMEDIA_FOUND)
|
||||
|
||||
|
|
@ -255,8 +256,9 @@ add_custom_command(
|
|||
)
|
||||
|
||||
if(APPLE)
|
||||
set(plugin_dest_dir ./cockatrice.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir ./cockatrice.app/Contents/Resources)
|
||||
# these needs to be relative to CMAKE_INSTALL_PREFIX
|
||||
set(plugin_dest_dir cockatrice.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir cockatrice.app/Contents/Resources)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => mediaservice
|
||||
|
|
@ -271,13 +273,16 @@ if(APPLE)
|
|||
endif()
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
Plugins = Plugins\")
|
||||
" COMPONENT Runtime)
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
Plugins = Plugins
|
||||
Translations = Resources/translations
|
||||
Data = Resources\")
|
||||
" COMPONENT Runtime)
|
||||
|
||||
install(CODE "
|
||||
file(GLOB_RECURSE QTPLUGINS
|
||||
\"${plugin_dest_dir}/*.dylib\")
|
||||
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\")
|
||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\")
|
||||
" COMPONENT Runtime)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ enum GraphicsItemType {
|
|||
|
||||
class AbstractGraphicsItem : public QObject, public QGraphicsItem {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QGraphicsItem)
|
||||
protected:
|
||||
void paintNumberEllipse(int number, int radius, const QColor &color, int position, int count, QPainter *painter);
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -105,15 +105,6 @@ int main(int argc, char *argv[])
|
|||
qInstallMessageHandler(myMessageOutput);
|
||||
#endif
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
QDir baseDir(app.applicationDirPath());
|
||||
baseDir.cdUp();
|
||||
baseDir.cdUp();
|
||||
baseDir.cdUp();
|
||||
QDir pluginsDir = baseDir;
|
||||
pluginsDir.cd("PlugIns");
|
||||
app.addLibraryPath(pluginsDir.absolutePath());
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
app.addLibraryPath(app.applicationDirPath() + "/plugins");
|
||||
#endif
|
||||
|
|
@ -129,11 +120,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (translationPath.isEmpty()) {
|
||||
#ifdef Q_OS_MAC
|
||||
QDir translationsDir = baseDir;
|
||||
translationsDir.cd("translations");
|
||||
translationPath = translationsDir.absolutePath();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
translationPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
#elif Q_OS_WIN
|
||||
translationPath = app.applicationDirPath() + "/translations";
|
||||
#endif
|
||||
}
|
||||
|
|
@ -171,6 +159,43 @@ int main(int argc, char *argv[])
|
|||
QDir().mkpath(dataDir + "/pics");
|
||||
settingsCache->setPicsPath(dataDir + "/pics");
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
if(settingsCache->getHandBgPath().isEmpty() &&
|
||||
settingsCache->getStackBgPath().isEmpty() &&
|
||||
settingsCache->getTableBgPath().isEmpty() &&
|
||||
settingsCache->getPlayerBgPath().isEmpty())
|
||||
{
|
||||
QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath);
|
||||
QString destDir = dataDir + "/zonebg";
|
||||
QDir tmpDir(destDir);
|
||||
if(!tmpDir.exists())
|
||||
{
|
||||
// try to install the default images for the current user and set the settigs value
|
||||
settingsCache->copyPath(srcDir + "/zonebg", destDir);
|
||||
|
||||
settingsCache->setHandBgPath(destDir + "/fabric_green.png");
|
||||
settingsCache->setStackBgPath(destDir + "/fabric_red.png");
|
||||
settingsCache->setTableBgPath(destDir + "/fabric_blue.png");
|
||||
settingsCache->setPlayerBgPath(destDir + "/fabric_gray.png");
|
||||
}
|
||||
}
|
||||
|
||||
if(settingsCache->getSoundPath().isEmpty())
|
||||
{
|
||||
QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath);
|
||||
QString destDir = dataDir + "/sounds";
|
||||
QDir tmpDir(destDir);
|
||||
if(!tmpDir.exists())
|
||||
{
|
||||
// try to install the default sounds for the current user and set the settigs value
|
||||
settingsCache->copyPath(srcDir + "/sounds", destDir);
|
||||
|
||||
settingsCache->setSoundPath(destDir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!settingsValid() || db->getLoadStatus() != Ok) {
|
||||
qDebug("main(): invalid settings or load status");
|
||||
DlgSettings dlgSettings;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "settingscache.h"
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
SettingsCache::SettingsCache()
|
||||
{
|
||||
|
|
@ -257,3 +259,31 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
|
|||
mainWindowGeometry = _mainWindowGeometry;
|
||||
settings->setValue("interface/main_window_geometry", mainWindowGeometry);
|
||||
}
|
||||
|
||||
void SettingsCache::copyPath(const QString &src, const QString &dst)
|
||||
{
|
||||
// test source && return if inexistent
|
||||
QDir dir(src);
|
||||
if (! dir.exists())
|
||||
return;
|
||||
// test destination && create if inexistent
|
||||
QDir tmpDir(dst);
|
||||
if (!tmpDir.exists())
|
||||
{
|
||||
tmpDir.setPath(QDir::rootPath());
|
||||
if (!tmpDir.mkdir(dst) && !tmpDir.exists()) {
|
||||
// TODO: this is probably not good.
|
||||
qDebug() << "copyPath(): Failed to create dir: " << dst;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||
QString dst_path = dst + QDir::separator() + d;
|
||||
dir.mkpath(dst_path);
|
||||
copyPath(src+ QDir::separator() + d, dst_path);
|
||||
}
|
||||
|
||||
foreach (QString f, dir.entryList(QDir::Files)) {
|
||||
QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public:
|
|||
bool getIgnoreUnregisteredUsers() const { return ignoreUnregisteredUsers; }
|
||||
QString getPicUrl() const { return picUrl; }
|
||||
QString getPicUrlHq() const { return picUrlHq; }
|
||||
void copyPath(const QString &src, const QString &dst);
|
||||
public slots:
|
||||
void setMainWindowGeometry(const QByteArray &_mainWindowGeometry);
|
||||
void setLang(const QString &_lang);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue