Hook maximum allowed rating into the configuration
I wonder if max posts should be a setter in DanbooruService...
This commit is contained in:
		
					parent
					
						
							
								2f8d935dd6
							
						
					
				
			
			
				commit
				
					
						e1045e1fa6
					
				
			
		
					 2 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -45,6 +45,12 @@
 | 
			
		|||
namespace Danbooru
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
QHash<int, DanbooruPost::Rating> DanbooruMainWindow::ratingMap = {
 | 
			
		||||
    {0, DanbooruPost::Safe},
 | 
			
		||||
    {1, DanbooruPost::Questionable},
 | 
			
		||||
    {2, DanbooruPost::Explicit}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
 | 
			
		||||
    : KXmlGuiWindow(parent),
 | 
			
		||||
      m_view(new QQuickWidget(this)),
 | 
			
		||||
| 
						 | 
				
			
			@ -177,15 +183,16 @@ void DanbooruMainWindow::optionsPreferences()
 | 
			
		|||
    KConfigDialog* dialog = new KConfigDialog(this, "danboorusettings",
 | 
			
		||||
                                              DanbooruSettings::self());
 | 
			
		||||
 | 
			
		||||
    auto prefs = DanbooruSettings::self();
 | 
			
		||||
    qDebug() << prefs->boards() << "boards!";
 | 
			
		||||
    dialog->addPage(new GeneralPage(DanbooruSettings::self(), this), i18n("General"));
 | 
			
		||||
    dialog->addPage(new GeneralPage(DanbooruSettings::self(), this), i18n("General"),
 | 
			
		||||
        "table");
 | 
			
		||||
    connect(dialog, &KConfigDialog::settingsChanged, [this](){
 | 
			
		||||
        auto preferences = DanbooruSettings::self();
 | 
			
		||||
        qDebug() << preferences->boards();
 | 
			
		||||
        qDebug() << preferences->cacheSize();
 | 
			
		||||
        qDebug() << preferences->maxPosts();
 | 
			
		||||
        qDebug() << preferences->tagBlacklist();
 | 
			
		||||
        qDebug() << preferences->maxRating();
 | 
			
		||||
        m_service->setMaximumAllowedRating(ratingMap.value(preferences->maxRating()));
 | 
			
		||||
    });
 | 
			
		||||
    dialog->show();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@
 | 
			
		|||
#include <KSharedDataCache>
 | 
			
		||||
#include <KImageCache>
 | 
			
		||||
 | 
			
		||||
#include "libdanbooru/danboorupost.h"
 | 
			
		||||
 | 
			
		||||
class QQuickWidget;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -75,6 +76,7 @@ private:
 | 
			
		|||
    DanbooruService *m_service;
 | 
			
		||||
    DanbooruConnectWidget *m_connectWidget;
 | 
			
		||||
    KImageCache *m_cache;
 | 
			
		||||
    static QHash<int, DanbooruPost::Rating> ratingMap;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
} // namespace Danbooru
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue