2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.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, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
2021-06-08 21:41:42 +08:00
|
|
|
#ifndef EDITORFONTWIDGET_H
|
|
|
|
#define EDITORFONTWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2024-03-17 11:18:09 +08:00
|
|
|
#include <QStringListModel>
|
2021-06-08 21:41:42 +08:00
|
|
|
#include "settingswidget.h"
|
2024-03-13 19:17:25 +08:00
|
|
|
#include "utils/font.h"
|
2021-06-08 21:41:42 +08:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class EditorFontWidget;
|
|
|
|
}
|
|
|
|
|
2024-03-17 11:18:09 +08:00
|
|
|
class EditorFontModel : public QStringListModel
|
2024-03-13 19:17:25 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2024-03-17 11:18:09 +08:00
|
|
|
using QStringListModel::QStringListModel;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
2024-03-13 19:17:25 +08:00
|
|
|
};
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
class EditorFontWidget : public SettingsWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit EditorFontWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
|
|
|
~EditorFontWidget();
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_chkGutterOnlyMonospacedFonts_stateChanged(int arg1);
|
2024-03-13 19:17:25 +08:00
|
|
|
void on_btnAddFont_clicked();
|
|
|
|
void on_btnRemoveFont_clicked();
|
2024-03-17 11:18:09 +08:00
|
|
|
void on_btnModifyFont_clicked();
|
|
|
|
void on_btnResetFonts_clicked();
|
|
|
|
void on_btnMoveFontToTop_clicked();
|
2024-03-13 19:17:25 +08:00
|
|
|
void on_btnMoveFontUp_clicked();
|
|
|
|
void on_btnMoveFontDown_clicked();
|
2024-03-17 11:18:09 +08:00
|
|
|
void on_btnMoveFontToBottom_clicked();
|
2021-06-08 21:41:42 +08:00
|
|
|
|
2024-02-28 11:51:02 +08:00
|
|
|
// void on_chkLigature_toggled(bool checked);
|
|
|
|
|
|
|
|
// void on_chkForceFixedFontWidth_toggled(bool checked);
|
|
|
|
|
2024-03-17 11:41:40 +08:00
|
|
|
void on_lstFontList_doubleClicked(const QModelIndex &index);
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
private:
|
|
|
|
Ui::EditorFontWidget *ui;
|
2024-03-13 19:17:25 +08:00
|
|
|
EditorFontModel mModel;
|
2021-06-08 21:41:42 +08:00
|
|
|
|
|
|
|
// SettingsWidget interface
|
|
|
|
protected:
|
|
|
|
void doLoad() override;
|
|
|
|
void doSave() override;
|
2024-03-13 19:17:25 +08:00
|
|
|
void updateIcons(const QSize &size) override;
|
2021-06-08 21:41:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITORFONTWIDGET_H
|