From 32b3ed0a1362a4b0798ad71fac3450fb77cb7e41 Mon Sep 17 00:00:00 2001 From: Thomas Groman Date: Thu, 19 Sep 2019 00:41:48 -0700 Subject: merged from 0.6.7 codebase --- api/logic/translations/TranslationsModel.h | 54 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'api/logic/translations/TranslationsModel.h') diff --git a/api/logic/translations/TranslationsModel.h b/api/logic/translations/TranslationsModel.h index bd481134..a0327fcd 100644 --- a/api/logic/translations/TranslationsModel.h +++ b/api/logic/translations/TranslationsModel.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2019 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,39 +23,43 @@ struct Language; class MULTIMC_LOGIC_EXPORT TranslationsModel : public QAbstractListModel { - Q_OBJECT + Q_OBJECT public: - explicit TranslationsModel(QString path, QObject *parent = 0); - virtual ~TranslationsModel(); + explicit TranslationsModel(QString path, QObject *parent = 0); + virtual ~TranslationsModel(); - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex & parent) const override; - bool selectLanguage(QString key); - void updateLanguage(QString key); - QModelIndex selectedIndex(); - QString selectedLanguage(); + bool selectLanguage(QString key); + void updateLanguage(QString key); + QModelIndex selectedIndex(); + QString selectedLanguage(); - void downloadIndex(); + void downloadIndex(); private: - Language *findLanguage(const QString & key); - void loadLocalIndex(); - void downloadTranslation(QString key); - void downloadNext(); + Language *findLanguage(const QString & key); + void reloadLocalFiles(); + void downloadTranslation(QString key); + void downloadNext(); - // hide copy constructor - TranslationsModel(const TranslationsModel &) = delete; - // hide assign op - TranslationsModel &operator=(const TranslationsModel &) = delete; + // hide copy constructor + TranslationsModel(const TranslationsModel &) = delete; + // hide assign op + TranslationsModel &operator=(const TranslationsModel &) = delete; private slots: - void indexRecieved(); - void indexFailed(QString reason); - void dlFailed(QString reason); - void dlGood(); + void indexReceived(); + void indexFailed(QString reason); + void dlFailed(QString reason); + void dlGood(); + void translationDirChanged(const QString &path); + private: /* data */ - struct Private; - std::unique_ptr d; + struct Private; + std::unique_ptr d; }; -- cgit v1.2.3