Updated nl translation. Initial implementation of line edit with custom status icon.

This commit is contained in:
Martin Rotter 2014-01-21 13:47:12 +01:00
parent 2cbdc4d87e
commit 5ae43964cc
8 changed files with 124 additions and 48 deletions

View File

@ -16,11 +16,11 @@
</message>
<message>
<source>Feed update started</source>
<translation type="unfinished"></translation>
<translation>Feed update is gestart</translation>
</message>
<message>
<source>Updated feed &apos;%1&apos;</source>
<translation type="unfinished"></translation>
<translation>Update feed &apos;%1&apos;</translation>
</message>
</context>
<context>
@ -299,27 +299,27 @@
</message>
<message>
<source>Open selected messages in internal browser</source>
<translation>Open geselecteerde bericht in externe webbrowser</translation>
<translation>Open geselecteerde berichten met ingebouwde webbrowser</translation>
</message>
<message>
<source>Open selected messages in internal browser.</source>
<translation>Open geselecteerde bericht in externe webbrowser.</translation>
<translation>Open geselecteerde berichten met ingebouwde webbrowser.</translation>
</message>
<message>
<source>Open selected source articles in external browser</source>
<translation>Open geselecteerde bron artikelen in externe webbrowser</translation>
<translation>Open geselecteerde bron artikelen met externe webbrowser</translation>
</message>
<message>
<source>Open selected source articles in external browser.</source>
<translation>Open geselecteerde bron artikelen in externe webbrowser.</translation>
<translation>Open geselecteerde bron artikelen met externe webbrowser.</translation>
</message>
<message>
<source>Open selected source articles in internal browser</source>
<translation>Open geselecteerde bron artikelen in interne webbrowser</translation>
<translation>Open geselecteerde bron artikelen met ingebouwde webbrowser</translation>
</message>
<message>
<source>Open selected source messages in internal browser.</source>
<translation>Open geselecteerde bron artikelen in interne webbrowser.</translation>
<translation>Open geselecteerde bron artikelen met ingebouwde webbrowser.</translation>
</message>
<message>
<source>Add new &amp;category</source>
@ -383,27 +383,27 @@
</message>
<message>
<source>&amp;Delete selected feed/category</source>
<translation type="unfinished"></translation>
<translation>&amp;Verwijder geselecteerde feed/categorie</translation>
</message>
<message>
<source>Delete selected feed/category.</source>
<translation type="unfinished"></translation>
<translation>Verwijder geselecteerde feed/categorie.</translation>
</message>
<message>
<source>Mark all messages (without message filters) from selected feeds as read.</source>
<translation type="unfinished"></translation>
<translation>Markeer alle berichten (zonder berichten filters) van geselecteerde feeds als gelezen.</translation>
</message>
<message>
<source>Mark all messages (without message filters) from selected feeds as unread.</source>
<translation type="unfinished"></translation>
<translation>Markeer alle berichten (zonder berichten filters) van geselecteerde feeds als ongelezen.</translation>
</message>
<message>
<source>Remove all messages from selected feeds.</source>
<translation type="unfinished"></translation>
<translation>Verwijder alle berichten van geselecteerde feeds.</translation>
</message>
<message>
<source>Displays all messages from selected feeds/categories in a new &quot;newspaper mode&quot; tab. Note that messages are not set as read automatically.</source>
<translation type="unfinished"></translation>
<translation>Toon alle berichten van geselecteerde feeds/categorieën in een nieuwe &quot;Krantweergave modus&quot; tabblad. Onthoud dat de berichten niet zijn ingesteld als automatisch gelezen.</translation>
</message>
</context>
<context>
@ -746,7 +746,7 @@
</message>
<message>
<source>Use sample arguments for</source>
<translation type="unfinished"></translation>
<translation>Gebruik voorbeeld argumenten voor</translation>
</message>
</context>
<context>
@ -878,11 +878,11 @@
</message>
<message>
<source>Problem with starting external web browser</source>
<translation type="unfinished"></translation>
<translation>Probleem om externe webbrowser te starten</translation>
</message>
<message>
<source>External web browser could not be started.</source>
<translation type="unfinished"></translation>
<translation>Externe webbrowser kon niet worden gestart.</translation>
</message>
</context>
<context>
@ -946,7 +946,8 @@ Deze categorie bevat geen nested items.</translation>
<message>
<source>%1 (standard category)
%2%3</source>
<translation type="unfinished"></translation>
<translation>%1 (standaard categorie)
%2%3</translation>
</message>
<message>
<source>%1 (%2)
@ -954,7 +955,11 @@ Deze categorie bevat geen nested items.</translation>
Encoding: %4
Language: %5</source>
<translation type="unfinished"></translation>
<translation>%1 (%2)
%3
Codering: %4
Taal: %5</translation>
</message>
</context>
<context>
@ -972,11 +977,11 @@ Language: %5</source>
<name>StatusBar</name>
<message>
<source>Fullscreen mode</source>
<translation type="unfinished"></translation>
<translation>Beeldvullende modus</translation>
</message>
<message>
<source>Switch application between fulscreen/normal states right from this status bar icon.</source>
<translation type="unfinished"></translation>
<translation>Wissel Rssguard tussen volledige scherm/normale staat vanaf deze statusbar pictogram.</translation>
</message>
</context>
<context>

View File

@ -7,6 +7,7 @@
#include "core/feedsmodel.h"
#include "gui/iconthemefactory.h"
#include "gui/feedsview.h"
#include "gui/baselineedit.h"
#include <QLineEdit>
#include <QTextEdit>
@ -25,6 +26,8 @@ FormCategoryDetails::FormCategoryDetails(FeedsModel *model, QWidget *parent)
connect(m_ui->m_buttonBox, SIGNAL(accepted()),
this, SLOT(apply()));
connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(onTitleChanged(QString)));
}
FormCategoryDetails::~FormCategoryDetails() {
@ -36,8 +39,8 @@ void FormCategoryDetails::setEditableCategory(FeedsModelCategory *editable_categ
// TODO: Setup the dialog according to the category.
// so remove this category from category combobox!!
m_ui->m_txtTitle->setText(editable_category->title());
m_ui->m_txtDescription->setText(editable_category->description());
m_ui->m_txtTitle->lineEdit()->setText(editable_category->title());
m_ui->m_txtDescription->lineEdit()->setText(editable_category->description());
m_ui->m_btnIcon->setIcon(editable_category->icon());
}
@ -65,9 +68,9 @@ void FormCategoryDetails::apply() {
FeedsModelRootItem *parent = static_cast<FeedsModelRootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
FeedsModelStandardCategory *new_category = new FeedsModelStandardCategory();
new_category->setTitle(m_ui->m_txtTitle->text());
new_category->setTitle(m_ui->m_txtTitle->lineEdit()->text());
new_category->setCreationDate(QDateTime::currentDateTime());
new_category->setDescription(m_ui->m_txtDescription->toPlainText());
new_category->setDescription(m_ui->m_txtDescription->lineEdit()->text());
new_category->setIcon(m_ui->m_btnIcon->icon());
if (m_feedsModel->addItem(new_category, parent)) {
@ -82,6 +85,15 @@ void FormCategoryDetails::apply() {
}
}
void FormCategoryDetails::onTitleChanged(const QString &new_title){
if (m_ui->m_txtTitle->lineEdit()->text().size() >= MIN_CATEGORY_NAME_LENGTH) {
m_ui->m_txtTitle->setStatus(LineEditWithStatus::Ok, tr("This category name is ok."));
}
else {
m_ui->m_txtTitle->setStatus(LineEditWithStatus::Error, tr("This category name is too short."));
}
}
void FormCategoryDetails::initialize() {
m_ui = new Ui::FormCategoryDetails();
m_ui->setupUi(this);

View File

@ -46,6 +46,9 @@ class FormCategoryDetails : public QDialog {
protected slots:
void apply();
// Trigerred when title/description changes.
void onTitleChanged(const QString &new_title);
protected:
// Sets the category which will be edited.
// NOTE: This is used for editing categories.

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>346</width>
<height>199</height>
<height>180</height>
</rect>
</property>
<property name="minimumSize">
@ -22,6 +22,9 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="m_lblParentCategory">
<property name="text">
@ -40,16 +43,6 @@
<property name="text">
<string>Title</string>
</property>
<property name="buddy">
<cstring>m_txtTitle</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_txtTitle">
<property name="placeholderText">
<string>Title of the category</string>
</property>
</widget>
</item>
<item row="2" column="0">
@ -82,15 +75,11 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="LineEditWithStatus" name="m_txtTitle" native="true"/>
</item>
<item row="2" column="1">
<widget class="QTextEdit" name="m_txtDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="LineEditWithStatus" name="m_txtDescription" native="true"/>
</item>
</layout>
</item>
@ -106,6 +95,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>

View File

@ -2,6 +2,7 @@
#include "gui/plaintoolbutton.h"
#include "gui/baselineedit.h"
#include "gui/iconthemefactory.h"
#include <QHBoxLayout>
@ -12,14 +13,53 @@ LineEditWithStatus::LineEditWithStatus(QWidget *parent)
m_txtInput = new BaseLineEdit(this);
m_btnStatus = new PlainToolButton(this);
// TODO: nastavit korektni ikony
m_iconInformation = IconThemeFactory::instance()->fromTheme("help-about");
m_iconWarning = IconThemeFactory::instance()->fromTheme("application-exit");
m_iconError = IconThemeFactory::instance()->fromTheme("application-exit");
m_iconOk = IconThemeFactory::instance()->fromTheme("application-exit");
// Set correct size for the tool button.
int txt_input_height = m_txtInput->sizeHint().height();
m_btnStatus->setFixedSize(txt_input_height, txt_input_height);
// Compose the layout.
m_layout->setMargin(0);
m_layout->setSpacing(0);
m_layout->addWidget(m_txtInput);
m_layout->addWidget(m_btnStatus);
// TODO: pokracovat tady, podle MarkedLineEditu z qonverteru
setLayout(m_layout);
setStatus(Information, QString());
}
LineEditWithStatus::~LineEditWithStatus() {
}
void LineEditWithStatus::setStatus(LineEditWithStatus::StatusType status,
const QString &tooltip_text) {
switch (status) {
case Information:
m_btnStatus->setIcon(m_iconInformation);
break;
case Warning:
m_btnStatus->setIcon(m_iconWarning);
break;
case Error:
m_btnStatus->setIcon(m_iconError);
break;
case Ok:
m_btnStatus->setIcon(m_iconOk);
break;
default:
break;
}
// Setup the tooltip text.
m_btnStatus->setToolTip(tooltip_text);
}

View File

@ -2,6 +2,7 @@
#define LINEEDITWITHSTATUS_H
#include <QWidget>
#include <QIcon>
class BaseLineEdit;
@ -12,6 +13,13 @@ class LineEditWithStatus : public QWidget {
Q_OBJECT
public:
enum StatusType {
Information,
Warning,
Error,
Ok
};
// Constructors and destructors.
explicit LineEditWithStatus(QWidget *parent = 0);
virtual ~LineEditWithStatus();
@ -22,11 +30,23 @@ class LineEditWithStatus : public QWidget {
// pak bude proste navazani na textEdited() a tam si bude uzivatel
// widgetu nastavovat pres to setStatus co chce on
// Sets custom status for this control.
void setStatus(StatusType status, const QString &tooltip_text);
// Access to line edit.
inline BaseLineEdit *lineEdit() const {
return m_txtInput;
}
private:
BaseLineEdit *m_txtInput;
PlainToolButton *m_btnStatus;
QHBoxLayout *m_layout;
QIcon m_iconInformation;
QIcon m_iconWarning;
QIcon m_iconError;
QIcon m_iconOk;
};
#endif // LINEEDITWITHSTATUS_H

View File

@ -15,7 +15,7 @@ PlainToolButton::~PlainToolButton() {
void PlainToolButton::paintEvent(QPaintEvent *e) {
QPainter p(this);
icon().paint(&p, QRect(QPoint(0, 0), iconSize()));
icon().paint(&p, QRect(QPoint(0, 0), size()));
/*
if (underMouse()) {

View File

@ -26,7 +26,6 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
close_button->setIcon(IconThemeFactory::instance()->fromTheme("application-exit"));
close_button->setToolTip(tr("Close this tab."));
close_button->setText(tr("Close tab"));
close_button->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
close_button->setFixedSize(iconSize());
// Close underlying tab when button is clicked.