#include <QPushButton>
#include <QSpinBox>
#include <QGridLayout>
+#include <QtDebug>
IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow,
- QWidget* parent) :
- KVBox(parent),
- m_mainWindow(mainWindow),
- m_iconSize(0),
- m_previewSize(0),
- m_iconSizeButton(0),
- m_textWidthBox(0),
- m_fontRequester(0),
- m_textlinesCountBox(0),
- m_arrangementBox(0),
- m_gridSpacingBox(0)
+ QWidget* parent) :
+ KVBox(parent),
+ m_mainWindow(mainWindow),
+ m_iconSize(0),
+ m_previewSize(0),
+ m_iconSizeButton(0),
+ m_textWidthBox(0),
+ m_fontRequester(0),
+ m_textlinesCountBox(0),
+ m_arrangementBox(0),
+ m_gridSpacingBox(0)
{
const int spacing = KDialog::spacingHint();
const int margin = KDialog::marginHint();
m_iconSize = settings->iconSize();
m_previewSize = settings->previewSize();
- KHBox* sizesLayout = new KHBox(this);
- sizesLayout->setSpacing(spacing);
- sizesLayout->setSizePolicy(sizePolicy);
-
- m_iconSizeButton = new QPushButton(i18n("Change icon and preview size..."), this);
+ m_iconSizeButton = new QPushButton(i18n("Change Icon && Preview Size..."), this);
connect(m_iconSizeButton, SIGNAL(clicked()),
this, SLOT(openIconSizeDialog()));
const int remainingWidth = settings->gridWidth() - settings->iconSize();
if (leftToRightArrangement) {
textWidthIndex = (remainingWidth - LeftToRightBase) / LeftToRightInc;
- }
- else {
+ } else {
textWidthIndex = (remainingWidth - TopToBottomBase) / TopToBottomInc;
}
+ // ensure that chosen index is always valid
+ textWidthIndex = qMax(textWidthIndex, 0);
+ textWidthIndex = qMin(textWidthIndex, m_textWidthBox->count() - 1);
m_textWidthBox->setCurrentIndex(textWidthIndex);
QLabel* arrangementLabel = new QLabel(i18n("Arrangement:"), gridGroup);
m_arrangementBox = new QComboBox(gridGroup);
- m_arrangementBox->addItem(i18n("Left to right"));
- m_arrangementBox->addItem(i18n("Top to bottom"));
+ m_arrangementBox->addItem(i18n("Left to Right"));
+ m_arrangementBox->addItem(i18n("Top to Bottom"));
m_arrangementBox->setCurrentIndex(leftToRightArrangement ? 0 : 1);
QLabel* gridSpacingLabel = new QLabel(i18n("Grid spacing:"), gridGroup);
}
IconsViewSettingsPage::~IconsViewSettingsPage()
-{
-}
+{}
void IconsViewSettingsPage::applySettings()
{
if (arrangement == QListView::TopToBottom) {
gridWidth += TopToBottomBase + textSizeIndex * TopToBottomInc;
gridHeight += fontSize * 6;
- }
- else {
+ } else {
gridWidth += LeftToRightBase + textSizeIndex * LeftToRightInc;
}