qmlFrontend/hwengine.cpp
branchqmlfrontend
changeset 10452 03519fd9f98d
parent 10450 bf9e30b4ef9b
child 10456 6fd99bb73524
equal deleted inserted replaced
10450:bf9e30b4ef9b 10452:03519fd9f98d
    23     freeThemesList_t *flibFreeThemesList;
    23     freeThemesList_t *flibFreeThemesList;
    24     getThemeIcon_t *flibGetThemeIcon;
    24     getThemeIcon_t *flibGetThemeIcon;
    25     getTeamsList_t *flibGetTeamsList;
    25     getTeamsList_t *flibGetTeamsList;
    26     tryAddTeam_t * flibTryAddTeam;
    26     tryAddTeam_t * flibTryAddTeam;
    27     tryRemoveTeam_t * flibTryRemoveTeam;
    27     tryRemoveTeam_t * flibTryRemoveTeam;
       
    28     changeTeamColor_t * flibChangeTeamColor;
    28 }
    29 }
    29 
    30 
    30 Q_DECLARE_METATYPE(MessageType);
    31 Q_DECLARE_METATYPE(MessageType);
    31 
    32 
    32 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) :
    33 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) :
    56 
    57 
    57     flibResetGameConfig = (resetGameConfig_t*) hwlib.resolve("resetGameConfig");
    58     flibResetGameConfig = (resetGameConfig_t*) hwlib.resolve("resetGameConfig");
    58     flibGetTeamsList = (getTeamsList_t*) hwlib.resolve("getTeamsList");
    59     flibGetTeamsList = (getTeamsList_t*) hwlib.resolve("getTeamsList");
    59     flibTryAddTeam = (tryAddTeam_t*) hwlib.resolve("tryAddTeam");
    60     flibTryAddTeam = (tryAddTeam_t*) hwlib.resolve("tryAddTeam");
    60     flibTryRemoveTeam = (tryRemoveTeam_t*) hwlib.resolve("tryRemoveTeam");
    61     flibTryRemoveTeam = (tryRemoveTeam_t*) hwlib.resolve("tryRemoveTeam");
       
    62     flibChangeTeamColor = (changeTeamColor_t*) hwlib.resolve("changeTeamColor");
    61 
    63 
    62     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
    64     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
    63     flibRegisterGUIMessagesCallback(this, &guiMessagesCallback);
    65     flibRegisterGUIMessagesCallback(this, &guiMessagesCallback);
    64 
    66 
    65     ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme"));
    67     ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme"));
   141     }
   143     }
   142     case MSG_REMOVETEAM: {
   144     case MSG_REMOVETEAM: {
   143         emit localTeamRemoved(msg);
   145         emit localTeamRemoved(msg);
   144         break;
   146         break;
   145     }
   147     }
       
   148     case MSG_TEAMCOLOR: {
       
   149         QStringList l = QString::fromUtf8(msg).split('\n');
       
   150         emit teamColorChanged(l[0], QColor::fromRgba(l[1].toInt()).name());
       
   151         break;
       
   152     }
   146     }
   153     }
   147 }
   154 }
   148 
   155 
   149 QString HWEngine::currentSeed()
   156 QString HWEngine::currentSeed()
   150 {
   157 {
   188 
   195 
   189 void HWEngine::resetGameConfig()
   196 void HWEngine::resetGameConfig()
   190 {
   197 {
   191     flibResetGameConfig();
   198     flibResetGameConfig();
   192 }
   199 }
       
   200 
       
   201 void HWEngine::changeTeamColor(const QString &teamName, int dir)
       
   202 {
       
   203     flibChangeTeamColor(teamName.toUtf8().constData(), dir);
       
   204 }