mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 10:13:42 +00:00
Refactor the whole structure, no more separation for C++ and Slint files
This commit is contained in:
parent
d6c781faa2
commit
893fcc11e3
35 changed files with 920 additions and 518 deletions
18
external/mirai-core/src/Mirai.cpp
vendored
18
external/mirai-core/src/Mirai.cpp
vendored
|
@ -88,6 +88,7 @@ void Mirai::addSource(
|
|||
SourceConstructor{.name = name, .sourceDataProvider = sourceDataProvider}
|
||||
));
|
||||
saveConfig();
|
||||
sourceAdded.emit(nullptr);
|
||||
};
|
||||
|
||||
void Mirai::editSource(int id, const std::string &name, const std::string &path)
|
||||
|
@ -97,6 +98,7 @@ void Mirai::editSource(int id, const std::string &name, const std::string &path)
|
|||
|
||||
DataProvider *sourceDataProvider = source->dataProvider();
|
||||
saveConfig();
|
||||
sourceEdited.emit(nullptr);
|
||||
}
|
||||
|
||||
void Mirai::deleteSource(int id)
|
||||
|
@ -113,6 +115,7 @@ void Mirai::deleteSource(int id)
|
|||
);
|
||||
|
||||
saveConfig();
|
||||
sourceDeleted.emit(id);
|
||||
}
|
||||
|
||||
void Mirai::unloadAllSources()
|
||||
|
@ -146,4 +149,19 @@ Source *Mirai::getSourceById(int id)
|
|||
return source->get();
|
||||
}
|
||||
|
||||
void Mirai::onSourceAdded(std::function<void(Source *)> f)
|
||||
{
|
||||
sourceAdded.registerCallback(f);
|
||||
}
|
||||
|
||||
void Mirai::onSourceEdited(std::function<void(Source *)> f)
|
||||
{
|
||||
sourceEdited.registerCallback(f);
|
||||
}
|
||||
|
||||
void Mirai::onSourceDeleted(std::function<void(int)> f)
|
||||
{
|
||||
sourceDeleted.registerCallback(f);
|
||||
}
|
||||
|
||||
} // namespace mirai
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue