Some fixes for message previewer.

This commit is contained in:
Martin Rotter 2015-06-23 16:06:32 +02:00
parent fccf25e1f6
commit ed4c293a3b
7 changed files with 56 additions and 51 deletions

View File

@ -502,7 +502,6 @@ set(APP_HEADERS
src/core/feedsproxymodel.h
src/core/feeddownloader.h
src/core/feedsimportexportmodel.h
src/core/feedsselection.h
# NETWORK-WEB headers.
src/network-web/webpage.h

View File

@ -9,6 +9,7 @@ Added:
Fixed:
<ul>
<li>Internal message previewer is now cleared only once when switching feeds.</li>
<li>Database cleanup tools now do support "shrinking" in in-memory databases, althouth it is bit hacky.</li>
<li>Google suggest API now prevents completion if ENTER in address textbox is hit.</li>
<li>Double-clickin on message now results in opening source article in mini web browser.</li>

View File

@ -46,6 +46,37 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH));
// Load information from embedded text files.
loadLicenseAndInformation();
// Load additional paths information.
loadSettingsAndPaths();
}
FormAbout::~FormAbout() {
qDebug("Destroying FormAbout instance.");
delete m_ui;
}
void FormAbout::loadSettingsAndPaths() {
if (qApp->settings()->type() == SettingsProperties::Portable) {
m_ui->m_txtPathsSettingsType->setText(tr("FULLY portable"));
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->applicationDirPath() +
QDir::separator() +
QString(APP_DB_SQLITE_PATH)));
}
else {
m_ui->m_txtPathsSettingsType->setText(tr("PARTIALLY portable"));
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->homeFolderPath() +
QDir::separator() +
QString(APP_LOW_H_NAME) +
QDir::separator() +
QString(APP_DB_SQLITE_PATH)));
}
m_ui->m_txtPathsSettingsFile->setText(QDir::toNativeSeparators(qApp->settings()->fileName()));
}
void FormAbout::loadLicenseAndInformation() {
QTextStream text_stream;
QFile file;
text_stream.setDevice(&file);
@ -103,21 +134,4 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
QString::number(QDateTime::currentDateTime().date().year()),
APP_AUTHOR,
APP_NAME));
// Load additional paths information.
if (qApp->settings()->type() == SettingsProperties::Portable) {
m_ui->m_txtPathsSettingsType->setText(tr("FULLY portable"));
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->applicationDirPath() + QDir::separator() + QString(APP_DB_SQLITE_PATH)));
}
else {
m_ui->m_txtPathsSettingsType->setText(tr("PARTIALLY portable"));
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QString(APP_DB_SQLITE_PATH)));
}
m_ui->m_txtPathsSettingsFile->setText(QDir::toNativeSeparators(qApp->settings()->fileName()));
}
FormAbout::~FormAbout() {
qDebug("Destroying FormAbout instance.");
delete m_ui;
}

View File

@ -38,8 +38,10 @@ class FormAbout : public QDialog {
virtual ~FormAbout();
private:
void loadLicenseAndInformation();
void loadSettingsAndPaths();
Ui::FormAbout *m_ui;
};
#endif // FORMABOUT_H

View File

@ -241,10 +241,6 @@ void MessagesView::loadFeeds(const FeedsSelection &selection) {
Qt::SortOrder ord = static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderMessages)).toInt());
sortByColumn(col, ord);
// Messages are loaded, make sure that previously
// active message is not shown in browser.
emit currentMessagesRemoved();
}
void MessagesView::openSelectedSourceMessagesExternally() {

View File

@ -15,23 +15,21 @@
// You should have received a copy of the GNU General Public License
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "squeezelabel.h"
#include "gui/squeezelabel.h"
SqueezeLabel::SqueezeLabel(QWidget *parent)
: QLabel(parent)
{
SqueezeLabel::SqueezeLabel(QWidget *parent) : QLabel(parent) {
}
void SqueezeLabel::paintEvent(QPaintEvent *event)
{
if (m_SqueezedTextCache != text()) {
m_SqueezedTextCache = text();
QFontMetrics fm = fontMetrics();
if (fm.width(m_SqueezedTextCache) > contentsRect().width()) {
QString elided = fm.elidedText(text(), Qt::ElideMiddle, width());
setText(elided);
}
void SqueezeLabel::paintEvent(QPaintEvent *event) {
if (m_squeezedTextCache != text()) {
m_squeezedTextCache = text();
QFontMetrics fm = fontMetrics();
if (fm.width(m_squeezedTextCache) > contentsRect().width()) {
setText(fm.elidedText(text(), Qt::ElideMiddle, width()));
}
QLabel::paintEvent(event);
}
}
QLabel::paintEvent(event);
}

View File

@ -18,25 +18,20 @@
#ifndef SQUEEZELABEL_H
#define SQUEEZELABEL_H
#include <qlabel.h>
#include <QLabel>
/*
A label that will squeeze the set text to fit within the size of the
widget. The text will be elided in the middle.
*/
class SqueezeLabel : public QLabel
{
class SqueezeLabel : public QLabel {
Q_OBJECT
public:
SqueezeLabel(QWidget *parent = 0);
public:
explicit SqueezeLabel(QWidget *parent = 0);
protected:
protected:
void paintEvent(QPaintEvent *event);
private:
QString m_SqueezedTextCache;
private:
QString m_squeezedTextCache;
};
#endif // SQUEEZELABEL_H