File indexing completed on 2025-02-02 04:11:29

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef GLAXNIMATE_GUI_FONT_GOOGLEFONTSWIDGET_H
0008 #define GLAXNIMATE_GUI_FONT_GOOGLEFONTSWIDGET_H
0009 
0010 #include <memory>
0011 #include <QWidget>
0012 
0013 #include "google_fonts_model.hpp"
0014 
0015 namespace glaxnimate::gui::font {
0016 
0017 class GoogleFontsWidget : public QWidget
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     GoogleFontsWidget(QWidget* parent = nullptr);
0023     ~GoogleFontsWidget();
0024 
0025     const GoogleFontsModel& model() const;
0026 
0027     void set_font_size(double size);
0028 
0029     model::CustomFont custom_font() const;
0030     const QFont& selected_font() const;
0031 
0032 Q_SIGNALS:
0033     void font_changed(const QFont& font);
0034 
0035 protected:
0036     void changeEvent ( QEvent* e ) override;
0037     void showEvent(QShowEvent* e) override;
0038 
0039 private Q_SLOTS:
0040     void change_style(const QModelIndex& index);
0041 
0042 private:
0043     class Private;
0044     std::unique_ptr<Private> d;
0045 };
0046 
0047 } // namespace glaxnimate::gui::font
0048 
0049 #endif // GLAXNIMATE_GUI_FONT_GOOGLEFONTSWIDGET_H