Browse Source

🚧 fiche perso viewer

master
Amaury Louarn 7 years ago
parent
commit
b948201f14
9 changed files with 109 additions and 0 deletions
  1. +9
    -0
      include/CharacterView.h
  2. +7
    -0
      include/character.h
  3. +33
    -0
      include/characterproperty.h
  4. +9
    -0
      include/characterview.h
  5. +7
    -0
      src/CMakeLists.txt
  6. +6
    -0
      src/character.cpp
  7. +29
    -0
      src/characterproperty.cpp
  8. +5
    -0
      src/characterview.cpp
  9. +4
    -0
      src/main.cpp

+ 9
- 0
include/CharacterView.h View File

@ -0,0 +1,9 @@
#pragma once
#include <QtWidgets>
class CharacterView : public QWidget
{
public:
CharacterView();
};

+ 7
- 0
include/character.h View File

@ -0,0 +1,7 @@
#pragma once
class Character
{
public:
Character();
};

+ 33
- 0
include/characterproperty.h View File

@ -0,0 +1,33 @@
#pragma once
#include <iostream>
#include <optional>
class CharacterProperty
{
public:
using StringType = std::string;
using IntegerType = int;
using FloatingType = double;
public:
enum Type {
string,
integer,
floating_point
};
public:
CharacterProperty();
std::optional<StringType> toString() const;
std::optional<IntegerType> toInt() const;
std::optional<FloatingType> toFloat() const;
private:
Type m_valueType;
StringType m_valueString;
IntegerType m_valueInt;
FloatingType m_valueFloat;
};

+ 9
- 0
include/characterview.h View File

@ -0,0 +1,9 @@
#pragma once
#include <QtWidgets>
class CharacterView : public QWidget
{
public:
CharacterView();
};

+ 7
- 0
src/CMakeLists.txt View File

@ -2,6 +2,13 @@ include_directories(${jdr-desktop_SOURCE_DIR})
include_directories(${jdr-desktop_SOURCE_DIR}/include) include_directories(${jdr-desktop_SOURCE_DIR}/include)
add_executable(jdr-desktop add_executable(jdr-desktop
#models
characterproperty.cpp
character.cpp
#views
characterview.cpp
main.cpp main.cpp
) )


+ 6
- 0
src/character.cpp View File

@ -0,0 +1,6 @@
#include "character.h"
Character::Character()
{
}

+ 29
- 0
src/characterproperty.cpp View File

@ -0,0 +1,29 @@
#include "characterproperty.h"
CharacterProperty::CharacterProperty()
{
}
std::optional<CharacterProperty::StringType> CharacterProperty::toString() const
{
if(m_valueType != Type::string)
return std::nullopt;
return std::make_optional(m_valueString);
}
std::optional<CharacterProperty::IntegerType> CharacterProperty::toInt() const
{
if(m_valueType != Type::integer)
return std::nullopt;
return std::make_optional(m_valueInt);
}
std::optional<CharacterProperty::FloatingType> CharacterProperty::toFloat() const
{
if(m_valueType != Type::floating_point)
return std::nullopt;
return std::make_optional(m_valueFloat);
}

+ 5
- 0
src/characterview.cpp View File

@ -0,0 +1,5 @@
#include "characterview.h"
CharacterView::CharacterView()
{
}

+ 4
- 0
src/main.cpp View File

@ -1,9 +1,13 @@
#include <iostream> #include <iostream>
#include <QApplication> #include <QApplication>
#include "characterview.h"
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
CharacterView window;
window.show();
return app.exec(); return app.exec();
} }

Loading…
Cancel
Save