qmlFrontend/hwengine.cpp
branchqmlfrontend
changeset 10442 c58db813240b
parent 10436 084e046f6bd5
child 10444 47a6231f1fc1
equal deleted inserted replaced
10440:b74a7bbe224e 10442:c58db813240b
    18     flibInit_t *flibInit;
    18     flibInit_t *flibInit;
    19     flibFree_t *flibFree;
    19     flibFree_t *flibFree;
    20     getThemesList_t *flibGetThemesList;
    20     getThemesList_t *flibGetThemesList;
    21     freeThemesList_t *flibFreeThemesList;
    21     freeThemesList_t *flibFreeThemesList;
    22     getThemeIcon_t *flibGetThemeIcon;
    22     getThemeIcon_t *flibGetThemeIcon;
       
    23     getTeamsList_t *flibGetTeamsList;
    23 }
    24 }
    24 
    25 
    25 Q_DECLARE_METATYPE(MessageType);
    26 Q_DECLARE_METATYPE(MessageType);
    26 
    27 
    27 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) :
    28 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) :
    45     flibFree = (flibFree_t*) hwlib.resolve("flibFree");
    46     flibFree = (flibFree_t*) hwlib.resolve("flibFree");
    46 
    47 
    47     flibGetThemesList = (getThemesList_t*) hwlib.resolve("getThemesList");
    48     flibGetThemesList = (getThemesList_t*) hwlib.resolve("getThemesList");
    48     flibFreeThemesList = (freeThemesList_t*) hwlib.resolve("freeThemesList");
    49     flibFreeThemesList = (freeThemesList_t*) hwlib.resolve("freeThemesList");
    49     flibGetThemeIcon = (getThemeIcon_t*) hwlib.resolve("getThemeIcon");
    50     flibGetThemeIcon = (getThemeIcon_t*) hwlib.resolve("getThemeIcon");
       
    51 
       
    52     flibGetTeamsList = (getTeamsList_t*) hwlib.resolve("getTeamsList");
    50 
    53 
    51     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
    54     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
    52     flibRegisterGUIMessagesCallback(this, &guiMessagesCallback);
    55     flibRegisterGUIMessagesCallback(this, &guiMessagesCallback);
    53 
    56 
    54     ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme"));
    57     ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme"));
   128     }
   131     }
   129     flibFreeThemesList(themes);
   132     flibFreeThemesList(themes);
   130 
   133 
   131     m_engine->rootContext()->setContextProperty("themesModel", QVariant::fromValue(resultModel));
   134     m_engine->rootContext()->setContextProperty("themesModel", QVariant::fromValue(resultModel));
   132 }
   135 }
       
   136 
       
   137 void HWEngine::getTeamsList()
       
   138 {
       
   139     char ** teams = flibGetTeamsList();
       
   140     for (char **i = teams; *i != NULL; i++) {
       
   141         QString team = QString::fromUtf8(*i);
       
   142 
       
   143         emit localTeamAdded(team, 0);
       
   144     }
       
   145 }