2022-11-16 22:17:07 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
|
|
|
* PolyMC - Minecraft Launcher
|
|
|
|
* Copyright (c) 2022 Slendi <slendi@socopon.com>
|
|
|
|
*
|
|
|
|
* This program 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, version 3.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following copyright and
|
|
|
|
* permission notice:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QWidget>
|
2022-11-17 15:50:30 +00:00
|
|
|
#include <QtCharts/QChartView>
|
|
|
|
#include <QtCharts/QPieSeries>
|
|
|
|
#include <QtCharts/QPieSlice>
|
2022-11-16 22:17:07 +00:00
|
|
|
|
|
|
|
#include "BaseInstance.h"
|
|
|
|
#include "ui/pages/BasePage.h"
|
|
|
|
#include <Application.h>
|
2022-11-17 15:50:30 +00:00
|
|
|
#include <qmessagebox.h>
|
2022-11-16 22:17:07 +00:00
|
|
|
|
2022-11-25 11:55:19 +00:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
using namespace QtCharts;
|
|
|
|
#endif
|
|
|
|
|
2022-11-16 22:17:07 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class StoragePage;
|
|
|
|
}
|
|
|
|
|
|
|
|
class StoragePage : public QWidget, public BasePage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit StoragePage(BaseInstance *inst, QWidget *parent = 0);
|
|
|
|
virtual ~StoragePage();
|
|
|
|
virtual QString displayName() const override
|
|
|
|
{
|
|
|
|
return tr("Storage");
|
|
|
|
}
|
|
|
|
virtual QIcon icon() const override
|
|
|
|
{
|
2022-11-16 23:12:11 +00:00
|
|
|
auto icon = APPLICATION->getThemedIcon("storage");
|
2022-11-16 22:17:07 +00:00
|
|
|
if(icon.isNull())
|
|
|
|
icon = APPLICATION->getThemedIcon("news");
|
|
|
|
return icon;
|
|
|
|
}
|
|
|
|
virtual QString id() const override
|
|
|
|
{
|
|
|
|
return "storage";
|
|
|
|
}
|
|
|
|
virtual bool apply() override;
|
|
|
|
virtual QString helpPage() const override
|
|
|
|
{
|
|
|
|
return "Storage";
|
|
|
|
}
|
|
|
|
void retranslate() override;
|
|
|
|
|
2022-11-17 15:50:30 +00:00
|
|
|
void handleClearScreenshotsButton();
|
|
|
|
void handleClearLogsButton();
|
|
|
|
void handleClearAllButton();
|
2022-11-16 22:17:07 +00:00
|
|
|
|
2022-11-17 15:50:30 +00:00
|
|
|
void updateCalculations();
|
2022-11-16 22:17:07 +00:00
|
|
|
|
2024-01-01 23:20:50 +00:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *object, QEvent *event) override;
|
|
|
|
|
2022-11-16 22:17:07 +00:00
|
|
|
private:
|
|
|
|
Ui::StoragePage *ui;
|
|
|
|
BaseInstance *m_inst;
|
|
|
|
|
2022-11-25 11:55:19 +00:00
|
|
|
QPieSeries *m_series;
|
|
|
|
QChart *m_chart;
|
|
|
|
QChartView *m_chart_view;
|
2022-11-17 15:50:30 +00:00
|
|
|
|
|
|
|
QMessageBox *m_confirmation_box;
|
2022-11-16 22:17:07 +00:00
|
|
|
};
|