tycho: use a variadic template for dbgPrint
parent
11cfc909f8
commit
8f6b690442
|
@ -21,23 +21,23 @@ find_package(
|
|||
add_library(
|
||||
maraiah-tycho-hermes
|
||||
SHARED
|
||||
$ENV{OUT_DIR}/bindings.cc
|
||||
$ENV{OUT_DIR}/bindings.h
|
||||
cc/main.cc
|
||||
cc/mapmodel.cc
|
||||
cc/mapprops.cc
|
||||
cc/mapview.cc
|
||||
cc/menu.cc
|
||||
cc/project.cc
|
||||
cc/tycho.h
|
||||
resources/resources.qrc
|
||||
ui/about.ui
|
||||
ui/license.ui
|
||||
ui/mapprops.ui
|
||||
ui/mapview.ui
|
||||
ui/menu.ui
|
||||
ui/points.ui
|
||||
ui/project.ui
|
||||
$ENV{OUT_DIR}/bindings.cc
|
||||
$ENV{OUT_DIR}/bindings.h
|
||||
cc/main.cc
|
||||
cc/mapmodel.cc
|
||||
cc/mapprops.cc
|
||||
cc/mapview.cc
|
||||
cc/menu.cc
|
||||
cc/project.cc
|
||||
cc/tycho.h
|
||||
resources/resources.qrc
|
||||
ui/about.ui
|
||||
ui/license.ui
|
||||
ui/mapprops.ui
|
||||
ui/mapview.ui
|
||||
ui/menu.ui
|
||||
ui/points.ui
|
||||
ui/project.ui
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
|
@ -55,8 +55,8 @@ target_include_directories(
|
|||
|
||||
target_link_libraries(
|
||||
maraiah-tycho-hermes
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
||||
target_compile_definitions(
|
||||
|
|
|
@ -62,7 +62,8 @@ QVariant MapModel::data(const QModelIndex &index, int role) const
|
|||
switch(role) {
|
||||
case Qt::DecorationRole: {
|
||||
auto name = propIcon(index.row());
|
||||
auto icon = name.front() == ':' ? QIcon(name) : QIcon::fromTheme(name);
|
||||
auto icon = name.front() == ':' ? QIcon(name)
|
||||
: QIcon::fromTheme(name);
|
||||
return QVariant::fromValue(icon);
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <QMdiSubWindow>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "bindings.h"
|
||||
|
||||
#include "../ui/ui_about.h"
|
||||
#include "../ui/ui_license.h"
|
||||
#include "../ui/ui_mapprops.h"
|
||||
|
@ -22,18 +24,6 @@
|
|||
#include "../ui/ui_menu.h"
|
||||
#include "../ui/ui_project.h"
|
||||
|
||||
#include "bindings.h"
|
||||
|
||||
#ifdef TYCHO_DEBUG_ASSERTIONS
|
||||
#define dbgPrint(...) qDebug(__VA_ARGS__)
|
||||
#else
|
||||
#define dbgPrint(...)
|
||||
#endif
|
||||
|
||||
#define dbgPrintFunc() dbgPrint("%s", __func__)
|
||||
|
||||
// TODO: namespace Tycho {
|
||||
|
||||
class MapModel;
|
||||
class MapProps;
|
||||
class MapView;
|
||||
|
@ -81,7 +71,6 @@ class ProjectModel
|
|||
public:
|
||||
enum Type
|
||||
{
|
||||
Invalid,
|
||||
Map,
|
||||
};
|
||||
|
||||
|
@ -151,10 +140,21 @@ private:
|
|||
void addProject(Project *proj);
|
||||
};
|
||||
|
||||
constexpr std::uint32_t fourCC(std::uint8_t a,
|
||||
std::uint8_t b,
|
||||
std::uint8_t c,
|
||||
std::uint8_t d)
|
||||
template<typename... VA>
|
||||
static inline void dbgPrint([[maybe_unused]] char const *fmt,
|
||||
[[maybe_unused]] VA &&...va)
|
||||
{
|
||||
#ifdef TYCHO_DEBUG_ASSERTIONS
|
||||
qDebug(fmt, std::forward<VA>(va)...);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define dbgPrintFunc() dbgPrint("%s", __func__)
|
||||
|
||||
static inline constexpr std::uint32_t fourCC(std::uint8_t a,
|
||||
std::uint8_t b,
|
||||
std::uint8_t c,
|
||||
std::uint8_t d)
|
||||
{
|
||||
return (a << 24) | (b << 16) | (c << 8) | d;
|
||||
}
|
||||
|
@ -167,6 +167,4 @@ extern "C" {
|
|||
char const *tychoVersion();
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
// EOF
|
||||
|
|
Loading…
Reference in New Issue