Switch from Qt6 to Slint

This commit is contained in:
Vyn 2024-08-16 21:35:12 +02:00
parent f8be14bcf8
commit 63bf267a22
107 changed files with 27532 additions and 2896 deletions

47
src/Utils.cpp Normal file
View file

@ -0,0 +1,47 @@
/*
* Mirai. Copyright (C) 2024 Vyn
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
*/
#include "Utils.h"
std::string formatZeroPadding(const int number)
{
if (number < 10) {
return "0" + std::to_string(number);
}
return std::to_string(number);
}
std::string SlintDateToStdString(const Date &date)
{
return std::to_string(date.year) + "-" + formatZeroPadding(date.month) + "-" +
formatZeroPadding(date.day);
}
mirai::Date SlintDateToMiraiDate(const Date &date)
{
return mirai::Date(
date.year, static_cast<unsigned>(date.month), static_cast<unsigned>(date.day)
);
}
Date MiraiDateToSlintDate(const mirai::Date &date)
{
return {
.year = date.year,
.month = static_cast<int>(date.month),
.day = static_cast<int>(date.day),
};
}
Time MiraiTimeToSlintTime(const mirai::Time &time)
{
return {.hour = time.hour, .minute = time.minute, .second = 0};
}
mirai::Time SlintTimeToMiraiTime(const Time &time)
{
return {.hour = time.hour, .minute = time.minute};
}