Commit edcc6b8b authored by Tomáš Jakubec's avatar Tomáš Jakubec
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+54 −0
Original line number Original line Diff line number Diff line
#-------------------------------------------------
#
# Project created by QtCreator 2019-03-01T09:42:56
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = PlanovaniZaNejistotyGUI
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

CONFIG += c++11

SOURCES += \
    goalsettings.cpp \
        main.cpp \
        mainwindow.cpp \
    setnewmap.cpp \
    field.cpp \
    map.cpp \
    strategist.cpp \
    mapview.cpp \
    settings.cpp \
    myscene.cpp

HEADERS += \
    goalsettings.h \
        mainwindow.h \
    setnewmap.h \
    define.h \
    field.h \
    map.h \
    strategist.h \
    mapview.h \
    settings.h \
    myscene.h

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

define.h

0 → 100644
+17 −0
Original line number Original line Diff line number Diff line
#ifndef DEFINE_H
#define DEFINE_H
#include <iostream>

#define CLASS_ATT(type, name) private:\
type name;\
public:\
type& get##name(){return name;}\
const type& get##name()const{return name;}\
void set##name(const type& val) {name = val;}

typedef double number;

#define DBG(var) std::cerr << #var << " at line " << __LINE__ << " has value " << var << std::endl
#define DBGMSG(msg) std::cerr << "DBGMSG at line " << __LINE__ << " says " << msg << std::endl
#define DBGCHECK std::cerr << "check in file " << __FILE__ << " at line " << __LINE__ << std::endl
#endif // DEFINE_H

field.cpp

0 → 100644
+2 −0
Original line number Original line Diff line number Diff line
#include "field.h"

field.h

0 → 100644
+29 −0
Original line number Original line Diff line number Diff line
#ifndef FIELD_H
#define FIELD_H
#include "define.h"

class Field
{
    CLASS_ATT(number, Value)
    CLASS_ATT(int, Flag)
    CLASS_ATT(int, bestChoise)
    enum flag {
        free,
        barier,
        goal,
        north,
        west,
        south,
        east
    };


public:
    Field(){
        Value = 0;
        Flag = free;
        bestChoise = 0;
    }
};

#endif // FIELD_H

goalsettings.cpp

0 → 100644
+47 −0
Original line number Original line Diff line number Diff line
#include "goalsettings.h"
#include <QDebug>
GoalSettings::GoalSettings(QWidget *parent):QDialog (parent)
{

    labVal = new QLabel("goal profit:");
    sbValue = new QSpinBox(this);
    sbValue->setRange(-100000, 100000);

    chDel = new QCheckBox("remove goal");
    chDel->setChecked(false);

    QVBoxLayout* lSBVal = new QVBoxLayout;
    lSBVal->addWidget(labVal);
    lSBVal->addStretch();
    lSBVal->addWidget(sbValue);

    lSBOpt = new QVBoxLayout;
    lSBOpt->addItem(lSBVal);
    lSBOpt->addStretch();
    lSBOpt->addWidget(chDel);


    btnOk = new QPushButton(tr("&OK"),this);
    btnOk->setShortcut(QKeySequence("ENTER"));
    btnOk->setStatusTip(tr("Confirms the settings."));

    btnCancel = new QPushButton(tr("&Cancel"),this);
    btnCancel->setShortcut(QKeySequence("ESCAPE"));
    btnCancel->setStatusTip(tr("Closes the settings."));

    lButtons = new QHBoxLayout;
    lButtons->addStretch();
    lButtons->addWidget(btnOk);
    lButtons->addWidget(btnCancel);

    lMain = new QVBoxLayout;
    lMain->addLayout(lSBOpt);
    lMain->addLayout(lButtons);

    setLayout(lMain);

    connect(btnOk, SIGNAL(clicked(bool)), this, SLOT(accept()));
    connect(btnCancel, SIGNAL(clicked(bool)), this, SLOT(close()));


}