Allow to configure infinite scrolling
This commit is contained in:
		
					parent
					
						
							
								939e114080
							
						
					
				
			
			
				commit
				
					
						44d632258d
					
				
			
		
					 4 changed files with 51 additions and 32 deletions
				
			
		| 
						 | 
					@ -42,5 +42,10 @@
 | 
				
			||||||
            <default>true</default>
 | 
					            <default>true</default>
 | 
				
			||||||
        </entry>
 | 
					        </entry>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <entry name="InfiniteScrolling" type="Bool">
 | 
				
			||||||
 | 
					            <label>Enable infinite scrolling in the thumbnail view</label>
 | 
				
			||||||
 | 
					            <default>true</default>
 | 
				
			||||||
 | 
					        </entry>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </group>
 | 
					    </group>
 | 
				
			||||||
</kcfg>
 | 
					</kcfg>
 | 
				
			||||||
| 
						 | 
					@ -115,6 +115,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
 | 
				
			||||||
    ctxt->setContextProperty("danbooruService", m_service);
 | 
					    ctxt->setContextProperty("danbooruService", m_service);
 | 
				
			||||||
    m_view->setSource(QUrl::fromLocalFile(qmlViewPath));
 | 
					    m_view->setSource(QUrl::fromLocalFile(qmlViewPath));
 | 
				
			||||||
    m_view->rootObject()->setProperty("poolMode", QVariant(false));
 | 
					    m_view->rootObject()->setProperty("poolMode", QVariant(false));
 | 
				
			||||||
 | 
					    ctxt->setContextProperty("infiniteScroll", DanbooruSettings::self()->infiniteScrolling());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    statusBar()->addPermanentWidget(m_connectWidget);
 | 
					    statusBar()->addPermanentWidget(m_connectWidget);
 | 
				
			||||||
    statusBar()->hide();
 | 
					    statusBar()->hide();
 | 
				
			||||||
| 
						 | 
					@ -246,6 +247,9 @@ void DanbooruMainWindow::loadSettings()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_tagWidget->setBlackList(DanbooruSettings::self()->tagBlacklist());
 | 
					    m_tagWidget->setBlackList(DanbooruSettings::self()->tagBlacklist());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_view->rootContext()->setContextProperty("infiniteScroll",
 | 
				
			||||||
 | 
					                                              DanbooruSettings::self()->infiniteScrolling());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,6 @@ Rectangle {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    property bool poolMode: false;
 | 
					    property bool poolMode: false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    KRun {
 | 
					    KRun {
 | 
				
			||||||
        id: runner
 | 
					        id: runner
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -205,8 +204,9 @@ Rectangle {
 | 
				
			||||||
            Component.onCompleted: { currentIndex = -1; forceActiveFocus()}
 | 
					            Component.onCompleted: { currentIndex = -1; forceActiveFocus()}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            onAtYEndChanged: {
 | 
					            onAtYEndChanged: {
 | 
				
			||||||
                if (grid.atYEnd && danbooruModel.rowCount > 0 && !rootObj.poolMode) {
 | 
					
 | 
				
			||||||
                     danbooruService.nextPostPage()
 | 
					                if (grid.atYEnd && danbooruModel.rowCount() > 0 && !rootObj.poolMode && infiniteScroll) {
 | 
				
			||||||
 | 
					                     danbooruService.nextPostPage();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,14 +36,26 @@
 | 
				
			||||||
         <bool>true</bool>
 | 
					         <bool>true</bool>
 | 
				
			||||||
        </property>
 | 
					        </property>
 | 
				
			||||||
        <layout class="QGridLayout" name="gridLayout">
 | 
					        <layout class="QGridLayout" name="gridLayout">
 | 
				
			||||||
         <item row="2" column="0">
 | 
					         <item row="1" column="1">
 | 
				
			||||||
          <widget class="QCheckBox" name="kcfg_AutoDownload">
 | 
					          <widget class="KComboBox" name="kcfg_MaxRating">
 | 
				
			||||||
           <property name="toolTip">
 | 
					           <property name="toolTip">
 | 
				
			||||||
            <string>Automatically download posts after connecting.</string>
 | 
					            <string>Only include posts up to this rating level.</string>
 | 
				
			||||||
           </property>
 | 
					           </property>
 | 
				
			||||||
 | 
					           <item>
 | 
				
			||||||
            <property name="text">
 | 
					            <property name="text">
 | 
				
			||||||
            <string>Automatically download posts</string>
 | 
					             <string>Safe</string>
 | 
				
			||||||
            </property>
 | 
					            </property>
 | 
				
			||||||
 | 
					           </item>
 | 
				
			||||||
 | 
					           <item>
 | 
				
			||||||
 | 
					            <property name="text">
 | 
				
			||||||
 | 
					             <string>Questionable</string>
 | 
				
			||||||
 | 
					            </property>
 | 
				
			||||||
 | 
					           </item>
 | 
				
			||||||
 | 
					           <item>
 | 
				
			||||||
 | 
					            <property name="text">
 | 
				
			||||||
 | 
					             <string>Explicit</string>
 | 
				
			||||||
 | 
					            </property>
 | 
				
			||||||
 | 
					           </item>
 | 
				
			||||||
          </widget>
 | 
					          </widget>
 | 
				
			||||||
         </item>
 | 
					         </item>
 | 
				
			||||||
         <item row="0" column="0">
 | 
					         <item row="0" column="0">
 | 
				
			||||||
| 
						 | 
					@ -73,26 +85,24 @@
 | 
				
			||||||
           </property>
 | 
					           </property>
 | 
				
			||||||
          </widget>
 | 
					          </widget>
 | 
				
			||||||
         </item>
 | 
					         </item>
 | 
				
			||||||
         <item row="1" column="1">
 | 
					         <item row="2" column="0">
 | 
				
			||||||
          <widget class="KComboBox" name="kcfg_MaxRating">
 | 
					          <widget class="QCheckBox" name="kcfg_AutoDownload">
 | 
				
			||||||
           <property name="toolTip">
 | 
					           <property name="toolTip">
 | 
				
			||||||
            <string>Only include posts up to this rating level.</string>
 | 
					            <string>Automatically download posts after connecting.</string>
 | 
				
			||||||
           </property>
 | 
					           </property>
 | 
				
			||||||
           <item>
 | 
					 | 
				
			||||||
           <property name="text">
 | 
					           <property name="text">
 | 
				
			||||||
             <string>Safe</string>
 | 
					            <string>Automatically download posts</string>
 | 
				
			||||||
           </property>
 | 
					           </property>
 | 
				
			||||||
 | 
					          </widget>
 | 
				
			||||||
         </item>
 | 
					         </item>
 | 
				
			||||||
           <item>
 | 
					         <item row="3" column="0">
 | 
				
			||||||
 | 
					          <widget class="QCheckBox" name="kcfg_InfiniteScrolling">
 | 
				
			||||||
 | 
					           <property name="toolTip">
 | 
				
			||||||
 | 
					            <string>Allow downloading new posts by simply scrolling to the end of the thumbnail view.</string>
 | 
				
			||||||
 | 
					           </property>
 | 
				
			||||||
           <property name="text">
 | 
					           <property name="text">
 | 
				
			||||||
             <string>Questionable</string>
 | 
					            <string>Enable infinite scrolling</string>
 | 
				
			||||||
           </property>
 | 
					           </property>
 | 
				
			||||||
           </item>
 | 
					 | 
				
			||||||
           <item>
 | 
					 | 
				
			||||||
            <property name="text">
 | 
					 | 
				
			||||||
             <string>Explicit</string>
 | 
					 | 
				
			||||||
            </property>
 | 
					 | 
				
			||||||
           </item>
 | 
					 | 
				
			||||||
          </widget>
 | 
					          </widget>
 | 
				
			||||||
         </item>
 | 
					         </item>
 | 
				
			||||||
        </layout>
 | 
					        </layout>
 | 
				
			||||||
| 
						 | 
					@ -104,16 +114,16 @@
 | 
				
			||||||
  </layout>
 | 
					  </layout>
 | 
				
			||||||
 </widget>
 | 
					 </widget>
 | 
				
			||||||
 <customwidgets>
 | 
					 <customwidgets>
 | 
				
			||||||
  <customwidget>
 | 
					 | 
				
			||||||
   <class>KEditListWidget</class>
 | 
					 | 
				
			||||||
   <extends>QWidget</extends>
 | 
					 | 
				
			||||||
   <header>keditlistwidget.h</header>
 | 
					 | 
				
			||||||
  </customwidget>
 | 
					 | 
				
			||||||
  <customwidget>
 | 
					  <customwidget>
 | 
				
			||||||
   <class>KComboBox</class>
 | 
					   <class>KComboBox</class>
 | 
				
			||||||
   <extends>QComboBox</extends>
 | 
					   <extends>QComboBox</extends>
 | 
				
			||||||
   <header>kcombobox.h</header>
 | 
					   <header>kcombobox.h</header>
 | 
				
			||||||
  </customwidget>
 | 
					  </customwidget>
 | 
				
			||||||
 | 
					  <customwidget>
 | 
				
			||||||
 | 
					   <class>KEditListWidget</class>
 | 
				
			||||||
 | 
					   <extends>QWidget</extends>
 | 
				
			||||||
 | 
					   <header>keditlistwidget.h</header>
 | 
				
			||||||
 | 
					  </customwidget>
 | 
				
			||||||
 </customwidgets>
 | 
					 </customwidgets>
 | 
				
			||||||
 <resources/>
 | 
					 <resources/>
 | 
				
			||||||
 <connections/>
 | 
					 <connections/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue