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>
 | 
			
		||||
        </entry>
 | 
			
		||||
 | 
			
		||||
        <entry name="InfiniteScrolling" type="Bool">
 | 
			
		||||
            <label>Enable infinite scrolling in the thumbnail view</label>
 | 
			
		||||
            <default>true</default>
 | 
			
		||||
        </entry>
 | 
			
		||||
 | 
			
		||||
    </group>
 | 
			
		||||
</kcfg>
 | 
			
		||||
| 
						 | 
				
			
			@ -115,6 +115,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
 | 
			
		|||
    ctxt->setContextProperty("danbooruService", m_service);
 | 
			
		||||
    m_view->setSource(QUrl::fromLocalFile(qmlViewPath));
 | 
			
		||||
    m_view->rootObject()->setProperty("poolMode", QVariant(false));
 | 
			
		||||
    ctxt->setContextProperty("infiniteScroll", DanbooruSettings::self()->infiniteScrolling());
 | 
			
		||||
 | 
			
		||||
    statusBar()->addPermanentWidget(m_connectWidget);
 | 
			
		||||
    statusBar()->hide();
 | 
			
		||||
| 
						 | 
				
			
			@ -246,6 +247,9 @@ void DanbooruMainWindow::loadSettings()
 | 
			
		|||
 | 
			
		||||
    m_tagWidget->setBlackList(DanbooruSettings::self()->tagBlacklist());
 | 
			
		||||
 | 
			
		||||
    m_view->rootContext()->setContextProperty("infiniteScroll",
 | 
			
		||||
                                              DanbooruSettings::self()->infiniteScrolling());
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,6 @@ Rectangle {
 | 
			
		|||
 | 
			
		||||
    property bool poolMode: false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    KRun {
 | 
			
		||||
        id: runner
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -205,8 +204,9 @@ Rectangle {
 | 
			
		|||
            Component.onCompleted: { currentIndex = -1; forceActiveFocus()}
 | 
			
		||||
 | 
			
		||||
            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>
 | 
			
		||||
        </property>
 | 
			
		||||
        <layout class="QGridLayout" name="gridLayout">
 | 
			
		||||
         <item row="2" column="0">
 | 
			
		||||
          <widget class="QCheckBox" name="kcfg_AutoDownload">
 | 
			
		||||
         <item row="1" column="1">
 | 
			
		||||
          <widget class="KComboBox" name="kcfg_MaxRating">
 | 
			
		||||
           <property name="toolTip">
 | 
			
		||||
            <string>Automatically download posts after connecting.</string>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="text">
 | 
			
		||||
            <string>Automatically download posts</string>
 | 
			
		||||
            <string>Only include posts up to this rating level.</string>
 | 
			
		||||
           </property>
 | 
			
		||||
           <item>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Safe</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </item>
 | 
			
		||||
           <item>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Questionable</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </item>
 | 
			
		||||
           <item>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Explicit</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </item>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="0" column="0">
 | 
			
		||||
| 
						 | 
				
			
			@ -73,26 +85,24 @@
 | 
			
		|||
           </property>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
         <item row="1" column="1">
 | 
			
		||||
          <widget class="KComboBox" name="kcfg_MaxRating">
 | 
			
		||||
         <item row="2" column="0">
 | 
			
		||||
          <widget class="QCheckBox" name="kcfg_AutoDownload">
 | 
			
		||||
           <property name="toolTip">
 | 
			
		||||
            <string>Only include posts up to this rating level.</string>
 | 
			
		||||
            <string>Automatically download posts after connecting.</string>
 | 
			
		||||
           </property>
 | 
			
		||||
           <property name="text">
 | 
			
		||||
            <string>Automatically download posts</string>
 | 
			
		||||
           </property>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </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">
 | 
			
		||||
            <string>Enable infinite scrolling</string>
 | 
			
		||||
           </property>
 | 
			
		||||
           <item>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Safe</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </item>
 | 
			
		||||
           <item>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Questionable</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </item>
 | 
			
		||||
           <item>
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Explicit</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </item>
 | 
			
		||||
          </widget>
 | 
			
		||||
         </item>
 | 
			
		||||
        </layout>
 | 
			
		||||
| 
						 | 
				
			
			@ -104,16 +114,16 @@
 | 
			
		|||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <customwidgets>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>KEditListWidget</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
   <header>keditlistwidget.h</header>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>KComboBox</class>
 | 
			
		||||
   <extends>QComboBox</extends>
 | 
			
		||||
   <header>kcombobox.h</header>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
  <customwidget>
 | 
			
		||||
   <class>KEditListWidget</class>
 | 
			
		||||
   <extends>QWidget</extends>
 | 
			
		||||
   <header>keditlistwidget.h</header>
 | 
			
		||||
  </customwidget>
 | 
			
		||||
 </customwidgets>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue