window: get number of columns from config
このコミットが含まれているのは:
コミット
5eb09540c6
@ -1,6 +1,6 @@
|
|||||||
#include "settingsprovider.h"
|
#include "settingsprovider.h"
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
SettingsProvider::SettingsProvider(QSettings &settings)
|
SettingsProvider::SettingsProvider(QSettings &settings)
|
||||||
{
|
{
|
||||||
@ -19,9 +19,12 @@ QStringList SettingsProvider::systemApplicationsEntriesPaths() const
|
|||||||
return settings->value("sysAppsPaths", "/usr/share/applications/").toStringList();
|
return settings->value("sysAppsPaths", "/usr/share/applications/").toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SettingsProvider::getMaxCols() const
|
||||||
|
{
|
||||||
|
return settings->value("maxColumns", 3).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
bool SettingsProvider::singleInstanceMode() const
|
bool SettingsProvider::singleInstanceMode() const
|
||||||
{
|
{
|
||||||
return settings->value("singleInstance", true).toBool();
|
return settings->value("singleInstance", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
#ifndef SETTINGSPROVIDER_H
|
#ifndef SETTINGSPROVIDER_H
|
||||||
#define SETTINGSPROVIDER_H
|
#define SETTINGSPROVIDER_H
|
||||||
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
class SettingsProvider
|
class SettingsProvider
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsProvider(QSettings &settings);
|
SettingsProvider(QSettings &settings);
|
||||||
virtual QStringList userEntriesPaths() const;
|
virtual QStringList userEntriesPaths() const;
|
||||||
virtual QStringList systemApplicationsEntriesPaths() const;
|
virtual QStringList systemApplicationsEntriesPaths() const;
|
||||||
|
virtual int getMaxCols() const;
|
||||||
virtual bool singleInstanceMode() const;
|
virtual bool singleInstanceMode() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
#include "window.h"
|
|
||||||
#include "entryprovider.h"
|
#include "entryprovider.h"
|
||||||
|
#include "window.h"
|
||||||
Window::Window(EntryProvider &entryProvider, SettingsProvider &configProvider)
|
Window::Window(EntryProvider &entryProvider, SettingsProvider &configProvider)
|
||||||
{
|
{
|
||||||
this->entryProvider = &entryProvider;
|
this->entryProvider = &entryProvider;
|
||||||
@ -324,6 +324,7 @@ void Window::filterGridFor(QString filter)
|
|||||||
int currow = 0;
|
int currow = 0;
|
||||||
int curcol = 0;
|
int curcol = 0;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
const int MAX_COLS = this->settingsProvider->getMaxCols();
|
||||||
for(EntryPushButton *button : this->systemEntryButtons)
|
for(EntryPushButton *button : this->systemEntryButtons)
|
||||||
{
|
{
|
||||||
if(button->getName().contains(filter, Qt::CaseInsensitive))
|
if(button->getName().contains(filter, Qt::CaseInsensitive))
|
||||||
@ -335,7 +336,7 @@ void Window::filterGridFor(QString filter)
|
|||||||
}
|
}
|
||||||
grid->addWidget(button, currow, curcol++);
|
grid->addWidget(button, currow, curcol++);
|
||||||
this->buttonsInGrid.append(button);
|
this->buttonsInGrid.append(button);
|
||||||
if(curcol == 3)
|
if(curcol == MAX_COLS)
|
||||||
{
|
{
|
||||||
curcol = 0;
|
curcol = 0;
|
||||||
++currow;
|
++currow;
|
||||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする