#ifndef PERHOUR_H
#define PERHOUR_H

#include <QWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QScrollArea>
#include <QScrollBar>
#include <QSpacerItem>
#include "onehourweather.h"
#include "global/corevar.h"

class perhour : public QWidget
{
    Q_OBJECT
public:
    explicit perhour(QWidget *parent = nullptr);
    void setHourlyInfor(QList<Hourly> tmp_list, int m_isFullScreen);
    void setHourlyIcon(int m_isFullScreen);
    void paintEvent(QPaintEvent *event) override;

private:
    int currentPage = 1; // 记录当前逐小时的页面
    QWidget *m_perhourWid = nullptr;
    QHBoxLayout *m_perhourLayout = nullptr;  // 逐小时布局
    QHBoxLayout *m_Layout = nullptr;         // 横向布局
    QScrollArea *m_scrollArea = nullptr;
    // QPushButton *m_left;
    // QPushButton *m_right;


    onehourweather *m_onehourWeatherFirstFirst;
    onehourweather *m_onehourWeatherFirstSecond;
    onehourweather *m_onehourWeatherFirstThird;
    onehourweather *m_onehourWeatherFirstFourth;
    onehourweather *m_onehourWeatherFirstFifth;
    onehourweather *m_onehourWeatherFirstSixth;
    onehourweather *m_onehourWeatherFirstSeventh;
    onehourweather *m_onehourWeatherFirstEighth;

    onehourweather *m_onehourWeatherSecondFirst;
    onehourweather *m_onehourWeatherSecondSecond;
    onehourweather *m_onehourWeatherSecondThird;
    onehourweather *m_onehourWeatherSecondFourth;
    onehourweather *m_onehourWeatherSecondFifth;
    onehourweather *m_onehourWeatherSecondSixth;
    onehourweather *m_onehourWeatherSecondSeventh;
    onehourweather *m_onehourWeatherSecondEighth;

    onehourweather *m_onehourWeatherThirdFirst;
    onehourweather *m_onehourWeatherThirdSecond;
    onehourweather *m_onehourWeatherThirdThird;
    onehourweather *m_onehourWeatherThirdFourth;
    onehourweather *m_onehourWeatherThirdFifth;
    onehourweather *m_onehourWeatherThirdSixth;
    onehourweather *m_onehourWeatherThirdSeventh;
    onehourweather *m_onehourWeatherThirdEighth;

    QString m_firstFirstIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstSecondIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstThirdIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstFourthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstFifthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstSixthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstSeventhIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_firstEighthIconPath = ":/res/weather-icon/PNG48/1x/999.png";

    QString m_secondFirstIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondSecondIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondThirdIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondFourthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondFifthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondSixthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondSeventhIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_secondEighthIconPath = ":/res/weather-icon/PNG48/1x/999.png";

    QString m_thirdFirstIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdSecondIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdThirdIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdFourthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdFifthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdSixthIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdSeventhIconPath = ":/res/weather-icon/PNG48/1x/999.png";
    QString m_thirdEighthIconPath = ":/res/weather-icon/PNG48/1x/999.png";

    void initWidget();
    void initStyle();
    void initConnect();

    QList<Hourly> tmpList;

signals:
    void sendIsFullScreen(int isFullScreen);

public slots:
    void slotChangePadHMode();
    void slotChangePadVMode();
    void slotChangePCMode();

};

#endif // PERHOUR_H
