فهرست منبع

.pro file scripts improvement, refactored source files to follow new project structure

Ivan Arkhipov 6 سال پیش
والد
کامیت
a21715d1f2

+ 50 - 34
client.pro

@@ -27,7 +27,13 @@ INCLUDEPATH += $$PWD/include/
 INCLUDEPATH += $$PWD/ui/
 
 # ================================================== #
+message(================QT INFO====================)
+message(Qt version: $$[QT_VERSION])
+message(Qt is installed in $$[QT_INSTALL_PREFIX])
+# ================================================== #
+
 
+message(==========BUILDING EXTERNAL RES============)
 win32 {
     build_pass: CONFIG(debug, debug|release) {
         DESTDIR = $$OUT_PWD/debug
@@ -43,23 +49,26 @@ unix {
 
 guiRes.target = BuildResources
 exists($$DESTDIR/res) {
-        message("Directory $$DESTDIR/res already exists")
-    } else {
-            guiRes.commands += $(MKDIR) \"$$DESTDIR/res\" $$escape_expand(\n\t)
+    message("Directory $$DESTDIR/res already exists")
+} else {
+    guiRes.commands += $(MKDIR) \"$$DESTDIR/res\" $$escape_expand(\n\t)
     }
 
-win32 {
-    guiRes.commands += rcc.exe -binary $$PWD/res/hotseatgame/game_ui.qrc -o $$DESTDIR/res/game_ui_data.gtr $$escape_expand(\n\t) \
-                       rcc.exe -binary $$PWD/res/hotseatgame/units.qrc -o $$DESTDIR/res/unit_data.gtr $$escape_expand(\n\t) \
-                       rcc.exe -binary $$PWD/res/hotseatgame/effects.qrc -o $$DESTDIR/res/effect_data.gtr $$escape_expand(\n\t) \
-                       rcc.exe -binary $$PWD/res/hotseatgame/spells.qrc -o $$DESTDIR/res/spell_data.gtr
-}
-
-unix {
-    guiRes.commands += rcc -binary $$PWD/res/hotseatgame/game_ui.qrc -o $$DESTDIR/res/game_ui_data.gtr $$escape_expand(\n\t) \
-                       rcc -binary $$PWD/res/hotseatgame/units.qrc -o $$DESTDIR/res/unit_data.gtr $$escape_expand(\n\t) \
-                       rcc -binary $$PWD/res/hotseatgame/effects.qrc -o $$DESTDIR/res/effect_data.gtr $$escape_expand(\n\t) \
-                       rcc -binary $$PWD/res/hotseatgame/spells.qrc -o $$DESTDIR/res/spell_data.gtr
+EXT_RES =                                                                   \
+    "$$PWD/res/main_menu.qrc           -o $$DESTDIR/res/data1.gtr"          \
+    "$$PWD/res/hotseatgame/game_ui.qrc -o $$DESTDIR/res/game_ui_data.gtr"   \
+    "$$PWD/res/hotseatgame/units.qrc   -o $$DESTDIR/res/unit_data.gtr"      \
+    "$$PWD/res/hotseatgame/effects.qrc -o $$DESTDIR/res/effect_data.gtr"    \
+    "$$PWD/res/hotseatgame/spells.qrc  -o $$DESTDIR/res/spell_data.gtr"     \
+
+for (RES, EXT_RES) {
+    win32 {
+        message(rcc.exe -binary $${RES})
+        guiRes.commands += rcc.exe -binary $${RES} $$escape_expand(\n\t)
+    }
+    unix {
+        guiRes.commands += rcc -binary $${RES} $$escape_expand(\n\t)
+    }
 }
 
 QMAKE_EXTRA_TARGETS += guiRes
@@ -74,9 +83,9 @@ SOURCES +=                                      \
     source/racemanager.cpp                      \
     source/soundengine.cpp                      \
                                                 \
-    source/effects/effect.cpp                   \
-    source/effects/melledamage.cpp              \
-    source/effects/selfheal.cpp                 \
+\    #source/effects/effect.cpp                   \
+\    #source/effects/melledamage.cpp              \
+\    #source/effects/selfheal.cpp                 \
                                                 \
     source/gui/guiscenemanager.cpp              \
     source/gui/scene.cpp                        \
@@ -86,9 +95,9 @@ SOURCES +=                                      \
     source/hotseatgame/gamemanager.cpp          \
     source/hotseatgame/unitsqueue.cpp           \
                                                 \
-    source/skills/spell.cpp                     \
-    source/skills/selfheal.cpp                  \
-    source/skills/melledamage.cpp               \
+\   #source/skills/spell.cpp                     \
+\   #source/skills/selfheal.cpp                  \
+\   #source/skills/melledamage.cpp               \
                                                 \
     source/units/mage.cpp                       \
     source/units/unit.cpp                       \
@@ -110,9 +119,9 @@ HEADERS +=                                      \
     include/racemanager.h                       \
     include/soundengine.h                       \
                                                 \
-    include/effects/effect.h                    \
-    include/effects/melledamage.h               \
-    include/effects/selfheal.h                  \
+\    #include/effects/effect.h                    \
+\    #include/effects/melledamage.h               \
+\    #include/effects/selfheal.h                  \
                                                 \
     include/gui/guiscenemanager.h               \
     include/gui/scene.h                         \
@@ -122,9 +131,9 @@ HEADERS +=                                      \
     include/hotseatgame/uniticon.h              \
     include/hotseatgame/unitsqueue.h            \
                                                 \
-    include/skills/melledamage.h                \
-    include/skills/selfheal.h                   \
-    include/skills/spell.h                      \
+\    #include/skills/melledamage.h                \
+\    #include/skills/selfheal.h                   \
+\    #include/skills/spell.h                      \
                                                 \
     include/units/mage.h                        \
     include/units/unit.h                        \
@@ -146,12 +155,19 @@ FORMS +=                                        \
     ui/main_menu/mainmenu.ui
 
 RESOURCES += \
-     res/GUI.qrc \
-     res/hotseatgame/game_ui.qrc \
-     res/hotseatgame/units.qrc \
-     res/hotseatgame/spells.qrc \
-     res/hotseatgame/effects.qrc \
-     res/main_menu.qrc \
-     res/loading_form.qrc
+     res/GUI.qrc
+
+
+debug {
+#CONFIG += console
+
+#RESOURCES += \
+#        res/hotseatgame/game_ui.qrc \
+#        res/hotseatgame/units.qrc \
+#        res/hotseatgame/spells.qrc \
+#        res/hotseatgame/effects.qrc \
+#        res/main_menu.qrc \
+#        res/loading_form.qrc
+}
 
 RC_ICONS = $$PWD/assets/common/icon.ico

+ 1 - 1
include/effects/melledamage.h

@@ -6,7 +6,7 @@
 #define GAME_CLIENT_MELLEDAMAGE_H
 #pragma once
 #include <cassert>
-#include "effect\effect.h"
+#include "effects\effect.h"
 
 class melledamage : public Effect {
     void OperateOnCell(Cell* cell);

+ 4 - 4
source/effects/melledamage.cpp

@@ -4,16 +4,16 @@
 
 #pragma once
 #include <cassert>
-#include "effect\melledamage.h"
+#include "effects\melledamage.h"
 #include "units\unit.h"
 #include <string>
 
 void melledamage::OperateOnCell(Cell* cell){
-    throw std :: string("CAN'T TOUCH THIS")
+    throw std :: string("CAN'T TOUCH THIS");
 }
 
 void melledamage::OperateOnUnit(Unit* unit){
     int temp = unit -> reduceIncomingDamage("p", count_);
-    unit ->setHealthPoints(unit -> getHealthPoints() - temp);
+    //unit ->setHealthPoints(unit -> getHealthPoints() - temp);
     //check_on_death
-}
+}

+ 6 - 5
source/gui/guiscenemanager.cpp

@@ -1,10 +1,10 @@
 #include "gui/guiscenemanager.h"
-#include "gui/mainmenu.h"
+#include "ui/main_menu/mainmenu.h"
 
-#include "hotseatgame/gui/recruitmentscene.h"
-#include "hotseatgame/gui/playervsplayerintro.h"
-#include "hotseatgame/gui/prebattlescene.h"
-#include "hotseatgame/gui/hotseatgame.h"
+#include "ui/hotseat_recruitment/recruitmentscene.h"
+#include "ui/hotseat_intro/playervsplayerintro.h"
+#include "ui/hotseat_prebattle/prebattlescene.h"
+#include "ui/hotseat_game/hotseatgame.h"
 
 #include <QResource>
 #include <QApplication>
@@ -22,6 +22,7 @@ GuiSceneManager::GuiSceneManager(QObject *parent) : QObject(parent) {
     QResource::registerResource(QApplication::applicationDirPath() + "/res/unit_data.gtr");
     QResource::registerResource(QApplication::applicationDirPath() + "/res/spell_data.gtr");
     QResource::registerResource(QApplication::applicationDirPath() + "/res/effect_data.gtr");
+    QResource::registerResource(QApplication::applicationDirPath() + "/res/data1.gtr");
 
     QFontDatabase::addApplicationFont(":/assets/fonts/barocco-initial.ttf");
     QFontDatabase::addApplicationFont(":/assets/fonts/viking-cyr.ttf");

+ 1 - 1
source/hotseatgame/raceicon.cpp

@@ -1,4 +1,4 @@
-#include <hotseatgame/gui/raceicon.h>
+#include <hotseatgame/raceicon.h>
 #include <QDebug>
 #include <QTime>
 #include <QEvent>

+ 1 - 1
source/hotseatgame/uniticon.cpp

@@ -1,4 +1,4 @@
-#include <hotseatgame/gui/uniticon.h>
+#include <hotseatgame/uniticon.h>
 #include <QDebug>
 #include <QTime>
 #include <QBitmap>

+ 0 - 2
source/soundengine.cpp

@@ -5,7 +5,6 @@ AsyncSound::AsyncSound(QString path) {
     player->setMedia(QUrl(path));
     player->setVolume(50);
     player->play();
-    qDebug() << "Sound started!";
     connect(player, &QMediaPlayer::stateChanged, this, &AsyncSound::onStateChanged);
 }
 
@@ -57,7 +56,6 @@ SoundEngine::~SoundEngine() {
 
 void SoundEngine::onAsyncSoundFinished(const std::shared_ptr<AsyncSound> &sound)
 {
-    qDebug() << "Sound finished";
     if (async_sounds.count(sound))
         async_sounds.erase(sound);
 }

+ 1 - 1
ui/hotseat_game/hotseatgame.cpp

@@ -1,4 +1,4 @@
-#include "hotseatgame/gui/hotseatgame.h"
+#include "ui/hotseat_game/hotseatgame.h"
 #include "ui_hotseatgame.h"
 #include "gui/guiscenemanager.h"
 

+ 1 - 1
ui/hotseat_intro/playervsplayerintro.cpp

@@ -1,4 +1,4 @@
-#include "hotseatgame/gui/playervsplayerintro.h"
+#include "ui/hotseat_intro/playervsplayerintro.h"
 #include "gui/guiscenemanager.h"
 #include "playermanager.h"
 #include "gui/scene.h"

+ 3 - 3
ui/hotseat_prebattle/prebattlescene.cpp

@@ -1,13 +1,13 @@
 
-#include "hotseatgame/gui/prebattlescene.h"
+#include "ui/hotseat_prebattle/prebattlescene.h"
 
 #include "player.h"
 #include "playermanager.h"
 #include "race.h"
 #include "racemanager.h"
 
-#include "hotseatgame/gui/raceicon.h"
-#include "hotseatgame/gui/uniticon.h"
+#include "hotseatgame/raceicon.h"
+#include "hotseatgame/uniticon.h"
 #include "gui/guiscenemanager.h"
 #include "ui_prebattlescene.h"
 

+ 3 - 3
ui/hotseat_recruitment/recruitmentscene.cpp

@@ -1,6 +1,6 @@
-#include <hotseatgame/gui/recruitmentscene.h>
-#include <hotseatgame/gui/uniticon.h>
-#include <hotseatgame/gui/raceicon.h>
+#include <ui/hotseat_recruitment/recruitmentscene.h>
+#include <hotseatgame/uniticon.h>
+#include <hotseatgame/raceicon.h>
 #include <gui/guiscenemanager.h>
 #include <gui/scene.h>
 #include <playermanager.h>

+ 2 - 2
ui/hotseat_recruitment/recruitmentscene.ui

@@ -428,7 +428,7 @@
   <customwidget>
    <class>RaceIcon</class>
    <extends>QLabel</extends>
-   <header location="global">hotseatgame/gui/raceicon.h</header>
+   <header location="global">hotseatgame/raceicon.h</header>
   </customwidget>
   <customwidget>
    <class>Scene</class>
@@ -439,7 +439,7 @@
   <customwidget>
    <class>UnitIcon</class>
    <extends>QLabel</extends>
-   <header location="global">hotseatgame/gui/uniticon.h</header>
+   <header location="global">hotseatgame/uniticon.h</header>
    <slots>
     <signal>clicked()</signal>
     <signal>doubleclicked()</signal>

+ 1 - 1
ui/loading_form/loadingform.cpp

@@ -1,4 +1,4 @@
-#include "gui/loadingform.h"
+#include "ui/loading_form/loadingform.h"
 #include "ui_loadingform.h"
 
 LoadingForm::LoadingForm(QWidget *parent) :

+ 1 - 1
ui/loading_form/loadingform.h

@@ -1,7 +1,7 @@
 #ifndef LOADINGFORM_H
 #define LOADINGFORM_H
 
-#include "scene.h"
+#include "gui/scene.h"
 
 namespace Ui {
 class LoadingForm;

+ 1 - 3
ui/main_menu/mainmenu.cpp

@@ -1,4 +1,4 @@
-#include "gui/mainmenu.h"
+#include "main_menu/mainmenu.h"
 #include "gui/guiscenemanager.h"
 #include "soundengine.h"
 
@@ -65,11 +65,9 @@ bool ButtonHoverWatcher::eventFilter(QObject * watched, QEvent * event) {
     }
 
     if (event->type() == QEvent::MouseButtonPress) {
-        qDebug() << "CLICK!!";
         SoundEngine::getInstance().playAsync("qrc:/assets/main_menu/button_click.mp3");
         return false;
     }
-
     return false;
 }
 

+ 13 - 1
ui/main_menu/mainmenu.ui

@@ -195,6 +195,12 @@ border-image: url(:/assets/main_menu/leave_game_button.png);</string>
             <property name="text">
              <string/>
             </property>
+            <property name="autoRepeatDelay">
+             <number>100</number>
+            </property>
+            <property name="autoRepeatInterval">
+             <number>20</number>
+            </property>
            </widget>
            <widget class="QLabel" name="title_">
             <property name="geometry">
@@ -258,6 +264,12 @@ border-image: url(:/assets/main_menu/about_us_button.png);</string>
             <property name="text">
              <string/>
             </property>
+            <property name="autoRepeatDelay">
+             <number>10</number>
+            </property>
+            <property name="autoRepeatInterval">
+             <number>10</number>
+            </property>
            </widget>
            <zorder>title_</zorder>
            <zorder>leave_game_button</zorder>
@@ -346,7 +358,7 @@ border-image: url(:/assets/main_menu/about_us_button.png);</string>
   <customwidget>
    <class>Scene</class>
    <extends>QWidget</extends>
-   <header location="global">gui/scene.h</header>
+   <header>gui/scene.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>