remarkable_tool/main.cpp

57 lines
1.9 KiB
C++

/* Copyright 2021, Michele Santullo
* This file is part of remarkable_tool.
*
* remarkable_tool is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Remarkable_tool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with remarkable_tool. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main_window.hpp"
#include "notebook_tree.hpp"
#include <QApplication>
#include <iostream>
#include <string_view>
#include <vector>
#include <utility>
namespace {
#define BASE_PATH "/run/media/duckz/Sabrent/deleme/remarkable_20210324/xochitl/"
//#define BASE_PATH "/home/duckz/dev/code/cpp/remarkable_tool/lib/lines-are-beautiful/share/rmlab/examples/"
void print_tree (const duck::Node& tree, std::string_view desc={}, std::string indent={}) {
std::cout << indent << desc << " (\"" << tree.name << "\")";
if (tree.info && tree.info->isolated)
std::cout << " ISOLATED";
else if (tree.info and tree.info->deleted)
std::cout << " DELETED";
std::cout << '\n';
for (const auto& child : tree.children) {
print_tree(child, child.info->visible_name, indent + "\t");
}
}
} //unnamed namespace
int main (int argc, char* argv[]) {
using std::string_view;
QApplication app(argc, argv);
duck::Notebooks notebooks(BASE_PATH);
std::vector<duck::Node> roots = notebooks.build_tree();
std::vector<const duck::NotebookInfo*> dele_list = duck::make_list_of_deleted(roots);
duck::MainWindow win(&roots.back());
win.show();
return app.exec();
}