69 lines
1.9 KiB
C++
69 lines
1.9 KiB
C++
#include "mainwindow.h"
|
|
#include "net/net.h"
|
|
#include "settings/settings.h"
|
|
#include "utils/utils.h"
|
|
#include <QApplication>
|
|
#include <curl/curl.h>
|
|
#include <iostream>
|
|
#if __GNUC__ < 8
|
|
# include <experimental/filesystem>
|
|
using namespace std::experimental::filesystem;
|
|
#else
|
|
# include <filesystem>
|
|
using std::filesystem;
|
|
#endif
|
|
#include <fstream>
|
|
#include <QTranslator>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
// std::ifstream test_file("/home/leca/projects/qt/checks-parser/test.html");
|
|
|
|
// std::string content;
|
|
|
|
// std::string str;
|
|
// while(getline(test_file, str)) {
|
|
// content += str + "\n";
|
|
// }
|
|
|
|
// parseOfdRuAnswer(content);
|
|
// return 0;
|
|
curl_global_init(CURL_GLOBAL_ALL);
|
|
|
|
std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser");
|
|
create_directories(program_data_path);
|
|
|
|
std::string settings_file_path =
|
|
get_path_relative_to_home(".local/share/checks_parser/settings.json");
|
|
|
|
Settings s(settings_file_path);
|
|
Net n;
|
|
|
|
Parser p;
|
|
std::vector<std::string> stores_updates = p.check_updates();
|
|
for (const std::string &update : stores_updates) {
|
|
std::cout << "Downloading "
|
|
<< s.get_setting("stores_modules_url") + update << " to "
|
|
<< get_path_relative_to_home(s.get_setting("stores_modules_dir") +
|
|
"/" + update)
|
|
<< std::endl;
|
|
|
|
n.get_file(s.get_setting("stores_modules_url") + "/" + update,
|
|
get_path_relative_to_home(s.get_setting("stores_modules_dir") +
|
|
"/" + update));
|
|
}
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
QTranslator translator;
|
|
if(!translator.load(QLocale::system().name())) {
|
|
translator.load("en_US");
|
|
}
|
|
a.installTranslator(&translator);
|
|
MainWindow w;
|
|
w.update();
|
|
w.show();
|
|
|
|
return a.exec();
|
|
}
|