More and more work.......

This commit is contained in:
Martin Rotter 2014-01-19 21:35:13 +01:00
parent baacd2c539
commit 6d0bdca99e
9 changed files with 78 additions and 24 deletions

View File

@ -288,7 +288,8 @@ set(APP_SOURCES
src/gui/statusbar.cpp
src/gui/iconfactory.cpp
src/gui/formcategorydetails.cpp
src/gui/closebutton.cpp
src/gui/plaintoolbutton.cpp
src/gui/lineeditwithstatus.cpp
# CORE sources.
src/core/debugging.cpp
@ -351,7 +352,8 @@ set(APP_HEADERS
src/gui/messagesview.h
src/gui/statusbar.h
src/gui/formcategorydetails.h
src/gui/closebutton.h
src/gui/plaintoolbutton.h
src/gui/lineeditwithstatus.h
# CORE headers.
src/core/settings.h

View File

@ -35,6 +35,7 @@
#define DOWNLOAD_TIMEOUT 5000
#define MESSAGES_VIEW_DEFAULT_COL 170
#define ELLIPSIS_LENGTH 3
#define MIN_CATEGORY_NAME_LENGTH 3
#define INTERNAL_URL_NEWSPAPER "@APP_LOW_NAME@:newspaper"
#define APP_DB_INIT_FILE "db_init.sql"

View File

@ -21,9 +21,6 @@ Settings::~Settings() {
qDebug("Deleting Settings instance.");
}
QSettings::Status Settings::checkSettings() {
qDebug("Syncing settings.");

View File

@ -59,19 +59,18 @@ FormCategoryDetailsAnswer FormCategoryDetails::exec(FeedsModelCategory *input_ca
return answer;
}
void FormCategoryDetails::apply() {
void FormCategoryDetails::apply() {
if (m_editableCategory == NULL) {
// add category
// Add the category.
FeedsModelRootItem *parent = static_cast<FeedsModelRootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
FeedsModelStandardCategory *cat = new FeedsModelStandardCategory();
FeedsModelStandardCategory *new_category = new FeedsModelStandardCategory();
cat->setTitle(m_ui->m_txtTitle->text());
cat->setCreationDate(QDateTime::currentDateTime());
cat->setDescription(m_ui->m_txtDescription->toPlainText());
cat->setIcon(m_ui->m_btnIcon->icon());
cat->setType(FeedsModelCategory::Standard);
new_category->setTitle(m_ui->m_txtTitle->text());
new_category->setCreationDate(QDateTime::currentDateTime());
new_category->setDescription(m_ui->m_txtDescription->toPlainText());
new_category->setIcon(m_ui->m_btnIcon->icon());
if (m_feedsModel->addItem(cat, parent)) {
if (m_feedsModel->addItem(new_category, parent)) {
accept();
}
else {

View File

@ -0,0 +1,25 @@
#include "gui/lineeditwithstatus.h"
#include "gui/plaintoolbutton.h"
#include "gui/baselineedit.h"
#include <QHBoxLayout>
LineEditWithStatus::LineEditWithStatus(QWidget *parent)
: QWidget(parent) {
m_layout = new QHBoxLayout(this);
m_txtInput = new BaseLineEdit(this);
m_btnStatus = new PlainToolButton(this);
// 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
}
LineEditWithStatus::~LineEditWithStatus() {
}

View File

@ -0,0 +1,28 @@
#ifndef LINEEDITWITHSTATUS_H
#define LINEEDITWITHSTATUS_H
#include <QWidget>
class BaseLineEdit;
class PlainToolButton;
class QHBoxLayout;
class LineEditWithStatus : public QWidget {
Q_OBJECT
public:
// Constructors and destructors.
explicit LineEditWithStatus(QWidget *parent = 0);
virtual ~LineEditWithStatus();
private:
BaseLineEdit *m_txtInput;
PlainToolButton *m_btnStatus;
QHBoxLayout *m_layout;
};
#endif // LINEEDITWITHSTATUS_H

View File

@ -1,4 +1,4 @@
#include "gui/closebutton.h"
#include "gui/plaintoolbutton.h"
#include <QToolButton>
#include <QStyle>
@ -7,16 +7,17 @@
#include <QStyleOption>
CloseButton::CloseButton(QWidget *parent) : QToolButton(parent) {
PlainToolButton::PlainToolButton(QWidget *parent) : QToolButton(parent) {
}
CloseButton::~CloseButton() {
PlainToolButton::~PlainToolButton() {
}
void CloseButton::paintEvent(QPaintEvent *e) {
void PlainToolButton::paintEvent(QPaintEvent *e) {
QPainter p(this);
icon().paint(&p, QRect(QPoint(0, 0), iconSize()));
/*
if (underMouse()) {
QStyleOptionFrameV3 style_option;
int frame_shape = QFrame::Sunken & QFrame::Shape_Mask;
@ -33,4 +34,5 @@ void CloseButton::paintEvent(QPaintEvent *e) {
&style_option, &p,
this);
}
*/
}

View File

@ -4,13 +4,13 @@
#include <QToolButton>
class CloseButton : public QToolButton {
class PlainToolButton : public QToolButton {
Q_OBJECT
public:
// Contructors and destructors.
explicit CloseButton(QWidget *parent = 0);
virtual ~CloseButton();
explicit PlainToolButton(QWidget *parent = 0);
virtual ~PlainToolButton();
protected:
// Custom look.

View File

@ -2,7 +2,7 @@
#include "core/defs.h"
#include "core/settings.h"
#include "gui/closebutton.h"
#include "gui/plaintoolbutton.h"
#include <QMouseEvent>
#include <QStyle>
@ -21,7 +21,7 @@ TabBar::~TabBar() {
void TabBar::setTabType(int index, const TabBar::TabType &type) {
switch (type) {
case TabBar::Closable: {
CloseButton *close_button = new CloseButton(this);
PlainToolButton *close_button = new PlainToolButton(this);
close_button->setIcon(IconThemeFactory::instance()->fromTheme("application-exit"));
close_button->setToolTip(tr("Close this tab."));
@ -48,7 +48,7 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
}
void TabBar::closeTabViaButton() {
CloseButton *close_button = qobject_cast<CloseButton*>(sender());
QAbstractButton *close_button = qobject_cast<QAbstractButton*>(sender());
QTabBar::ButtonPosition button_position = static_cast<ButtonPosition>(style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,
0,
this));