Progress: 35%.
This commit is contained in:
parent
2fd0d6d3d4
commit
159d38e210
1 changed files with 166 additions and 4 deletions
|
|
@ -383,6 +383,38 @@ void SearchItem::printData()
|
|||
qDebug() << "Magnet: " << magnet;
|
||||
}
|
||||
|
||||
void SearchItem::writeData(std::string file_path)
|
||||
{
|
||||
std::fstream out(file_path, std::fstream::out);
|
||||
if(!out.is_open()) {
|
||||
qDebug() << "Failed to write to file: " << file_path;
|
||||
return;
|
||||
}
|
||||
out << title.toStdString() << std::endl;
|
||||
out << url.toDisplayString().toStdString() << std::endl;
|
||||
out << magnet.toStdString() << std::endl;
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
void SearchItem::readFromData(std::string file_path)
|
||||
{
|
||||
std::fstream in(file_path, std::fstream::in);
|
||||
if(!in.is_open()) {
|
||||
qDebug() << "Failed to read from file: " << file_path;
|
||||
return;
|
||||
}
|
||||
std::string stitle, surl, smagnet;
|
||||
in >> stitle;
|
||||
in >> surl;
|
||||
in >> smagnet;
|
||||
in.close();
|
||||
title = QString::fromStdString(stitle);
|
||||
url = QUrl(QString::fromStdString(surl));
|
||||
magnet = QString::fromStdString(smagnet);
|
||||
in.close();
|
||||
}
|
||||
|
||||
std::string MainScreen::Tags::getTag(std::string file_name, std::string key)
|
||||
{
|
||||
QJsonDocument doc = QJsonDocument::fromJson(readFile(file_name));
|
||||
|
|
|
|||
Loading…
Reference in a new issue