/*! \file XdxfSettingsDialog.cpp
*/
-//Created by Mateusz Półrola
+
#include "XdxfSettingsDialog.h"
#include <QDebug>
QDialog(parent)
{
this->plugin = plugin;
- verticalLayout = new QVBoxLayout();
- setLayout(verticalLayout);
+
+ verticalLayout = new QVBoxLayout;
+
+ QWidget* w = new QWidget;
+ w->setLayout(verticalLayout);
setWindowTitle(tr("XDXF Settings"));
infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
tr("From: ") + plugin->langFrom() + "\n" +
tr("To: ") + plugin->langTo() + "\n" +
- tr("Description: ") + plugin->name());
-
- verticalLayout->addWidget(infoLabel);
-
- browseLayout = new QHBoxLayout();
- verticalLayout->addLayout(browseLayout);
-
- browseButton = new QPushButton(tr("Browse"));
- browseLabel = new QLabel(tr("Dictionary file: ") +
- plugin->settings()->value("path"));
+ tr("Description: ") + plugin->name() + "\n" +
+ tr("License: ") + plugin->infoNote());
+ infoLabel->setWordWrap(true);
- browseLayout->addWidget(browseLabel);
- browseLayout->addWidget(browseButton,0, Qt::AlignRight);
+ verticalLayout->addWidget(infoLabel);
- cacheLayout = new QHBoxLayout();
- verticalLayout->insertLayout(-1,cacheLayout,0);
- accentsCheckBox = new QCheckBox(tr("Strip accents \n(searching takes more time, "
- "but spelling don't have to be exact)"));
- verticalLayout->addWidget(accentsCheckBox);
+ accentsCheckBox = new QCheckBox(tr("Strip accents"));
+ /*(searching takes more time, "
+ "but spelling don't have to be exact)*/
if(plugin->settings()->value("strip_accents") == "true")
accentsCheckBox->setChecked(true);
else
accentsCheckBox->setChecked(false);
- cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches (may take some time)"),this);
+ cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches"));
+/*(may take some time)*/
if(plugin->settings()->value("cached") == "true") {
cacheCheckBox->setChecked(true);
accentsCheckBox->setChecked(true);
_generateCache = false;
}
+ accentsToolButton = new QToolButton;
+ cacheToolButton = new QToolButton;
+
+ accentsToolButton->setIcon(QIcon::fromTheme("general_information"));
+ cacheToolButton->setIcon(QIcon::fromTheme("general_information"));
+
+ cacheLayout = new QHBoxLayout;
+ accentsLayout = new QHBoxLayout;
+
+ accentsLayout->addWidget(accentsCheckBox);
+ accentsLayout->addWidget(accentsToolButton);
+
cacheLayout->addWidget(cacheCheckBox);
+ cacheLayout->addWidget(cacheToolButton);
+
+ verticalLayout->addLayout(cacheLayout);
+ verticalLayout->addLayout(accentsLayout);
+
+
saveButton = new QPushButton(tr("Save settings"));
verticalLayout->addWidget(saveButton);
- setModal(true);
+ scrollArea = new QScrollArea;
+ scrollArea->setWidget(w);
+
+
+ QHBoxLayout* layout = new QHBoxLayout();
+
+ scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ scrollArea->setWidgetResizable(true);
+ layout->addWidget(scrollArea);
+ setLayout(layout);
- connect(browseButton, SIGNAL(clicked()),
- this, SLOT(selectFile()));
+
+
+ setModal(true);
connect(saveButton, SIGNAL(clicked()),
this, SLOT(accept()));
lastAccents = state;
}
-
void XdxfSettingsDialog::setGenerateCache(bool generate) {
_generateCache = generate;
return _generateCache;
}
-void XdxfSettingsDialog::selectFile() {
- QString fileName = QFileDialog::getOpenFileName(this,
- tr("Select dictionary file"),
- "",
- tr("XDXF Files (*.xdxf)"),
- NULL,
- NULL);
- if (!fileName.isEmpty()) {
- browseLabel->setText(tr("Dictionary file: ") + fileName);
- _dicitonaryFilePath = fileName;
- }
-}
-
QString XdxfSettingsDialog::dicitonaryFilePath() {
return _dicitonaryFilePath;
}