From f24d16019f668ba9c53448f87ad97744a9ae8349 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Wed, 27 Nov 2013 23:17:42 +0100 Subject: [PATCH] Minor fixes for linux build refs #36 - Fixed compiler error in context.cpp (is not used anymore, but was still annoying) - GCC was complaining about the template definitons in blackgui. Removing typename fixed it. - Fixed a bug in qmake. Unfortunately qmake mkspec was just linux-g++ (not linux-g++-64), so added this case. - Fixed a PRE_TARGETDEPS bug - QMake has strange behaviour with DBUS_ADAPTORS: include the header somewhere, otherwise it won't be generated. refs #81 --- client.pro | 2 +- externals.pri | 12 ++++++++++++ src/blackcore/dbus_dummy.cpp | 10 ++++++++++ src/blackgui/listmodelbase.cpp | 18 ++++++++++++------ src/blackmisc/context.cpp | 23 ++++++----------------- 5 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 src/blackcore/dbus_dummy.cpp diff --git a/client.pro b/client.pro index 829a9ad3f..c24d9eab6 100644 --- a/client.pro +++ b/client.pro @@ -17,7 +17,7 @@ WITH_SAMPLES = ON equals(WITH_BLACKMISC, ON) { SUBDIRS += src/blackmisc - SUBDIRS += src/blackmisc_cpp2xml + #SUBDIRS += src/blackmisc_cpp2xml } equals(WITH_BLACKCORE, ON) { diff --git a/externals.pri b/externals.pri index 902b60790..8c04eab23 100644 --- a/externals.pri +++ b/externals.pri @@ -44,6 +44,18 @@ win32-g++ { } } +linux-g++ { + GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64) + contains(GCC64,[enabled]) { + LIBS *= -L$$EXTERNALDIR/linux64/lib + message("64 bit") + } + else { + LIBS *= -L$$EXTERNALDIR/linux32/lib + message("32 bit") + } +} + linux-g++-32 { LIBS *= -L$$EXTERNALDIR/linux32/lib } diff --git a/src/blackcore/dbus_dummy.cpp b/src/blackcore/dbus_dummy.cpp new file mode 100644 index 000000000..754b8787e --- /dev/null +++ b/src/blackcore/dbus_dummy.cpp @@ -0,0 +1,10 @@ +/* Copyright (C) 2013 VATSIM Community / contributors + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// These two header files are not really needed here. But if they are not +// included "somewhere", they are not generated -> compiler error! +// Possible solution: Generate them once and put them in git. +#include "contextnetwork_adaptor.h" +#include "contextsettings_adaptor.h" diff --git a/src/blackgui/listmodelbase.cpp b/src/blackgui/listmodelbase.cpp index 15264b7d5..61a9a5b6f 100644 --- a/src/blackgui/listmodelbase.cpp +++ b/src/blackgui/listmodelbase.cpp @@ -15,7 +15,8 @@ namespace BlackGui /* * Column count */ - template int CListModelBase::columnCount(const QModelIndex & /** modelIndex **/) const + template + int CListModelBase::columnCount(const QModelIndex & /** modelIndex **/) const { int c = this->m_columns.size(); return c; @@ -24,7 +25,8 @@ namespace BlackGui /* * Row count */ - template int CListModelBase::rowCount(const QModelIndex & /** parent */) const + template + int CListModelBase::rowCount(const QModelIndex & /** parent */) const { return this->m_list.size(); } @@ -32,7 +34,8 @@ namespace BlackGui /* * Column to property index */ - template int CListModelBase::columnToPropertyIndex(int column) const + template + int CListModelBase::columnToPropertyIndex(int column) const { return this->m_columns.columnToPropertyIndex(column); } @@ -40,7 +43,8 @@ namespace BlackGui /* * Header data */ - template QVariant CListModelBase::headerData(int section, Qt::Orientation orientation, int role) const + template QVariant + CListModelBase::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { @@ -55,7 +59,8 @@ namespace BlackGui /* * Data */ - template QVariant CListModelBase::data(const QModelIndex &index, int role) const + template + QVariant CListModelBase::data(const QModelIndex &index, int role) const { // checks if (index.row() < 0 || index.row() >= this->m_list.size() || @@ -81,7 +86,8 @@ namespace BlackGui /* * Update */ - template int CListModelBase::update(const ListType &list) + template + int CListModelBase::update(const ListType &list) { ListType copyList = (list.size() > 1 && this->hasValidSortColumn() ? this->sortListByColumn(list, this->m_sortedColumn, this->m_sortOrder) : diff --git a/src/blackmisc/context.cpp b/src/blackmisc/context.cpp index 76c56fc06..21d557fed 100644 --- a/src/blackmisc/context.cpp +++ b/src/blackmisc/context.cpp @@ -6,6 +6,9 @@ #include "blackmisc/debug.h" #include "blackmisc/context.h" #include +#include +#include + #ifdef Q_OS_WIN #include @@ -57,23 +60,9 @@ namespace BlackMisc void CApplicationContext::setDefaultApplicationName() { -#ifdef Q_OS_WIN - //! By default, we use the executables name. - if (getApplicationName().isEmpty()) - { - WCHAR name[1024]; - int size = GetModuleFileName(NULL, name, 1023); - QString applicationPath = QString::fromWCharArray(name, size); - setApplicationName(QFileInfo(applicationPath).fileName()); - } -#else - //! Todo: Check if there a corresponding API in Linux and Mac - //! For the time being, set it to unknown. - if (m_context.getApplicationName().isEmpty()) - { - m_context.setApplicationName(""); - } -#endif + // This part was not working before on linux. + // This class is depricated, but as long as it is not removed, if fixed it anyway. + setApplicationName(QFileInfo(QCoreApplication::applicationFilePath()).fileName()); } } // namespace BlackMisc