[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdesdk/lokalize/src
From: Nick Shaforostoff <shafff () ukr ! net>
Date: 2013-01-31 22:20:20
Message-ID: 20130131222020.56136AC86C () svn ! kde ! org
[Download RAW message or body]
SVN commit 1336639 by shaforo:
cheap optimizations for models (keep data in qvariant from the start)
M +18 -8 cataloglistview/catalogmodel.cpp
M +3 -1 cataloglistview/catalogmodel.h
M +1 -1 common/languagelistmodel.cpp
M +1 -1 main.cpp
M +1 -1 project/projectmodel.cpp
M +5 -5 project/projectmodel.h
M +2 -2 tm/qamodel.cpp
--- trunk/KDE/kdesdk/lokalize/src/cataloglistview/catalogmodel.cpp #1336638:1336639
@@ -1,7 +1,7 @@
/* ****************************************************************************
This file is part of Lokalize
- Copyright (C) 2007-2009 by Nick Shaforostoff <shafff@ukr.net>
+ Copyright (C) 2007-2013 by Nick Shaforostoff <shafff@ukr.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -35,11 +35,27 @@
#define DYNAMICFILTER_LIMIT 256
+QVector<QVariant> CatalogTreeModel::m_fonts;
+
+
CatalogTreeModel::CatalogTreeModel(QObject* parent, Catalog* catalog)
: QAbstractItemModel(parent)
, m_catalog(catalog)
, m_ignoreAccel(true)
{
+ if (m_fonts.isEmpty())
+ {
+ QVector<QFont> fonts(4, QApplication::font());
+ fonts[1].setItalic(true); //fuzzy
+
+ fonts[2].setBold(true); //modified
+
+ fonts[3].setItalic(true); //fuzzy
+ fonts[3].setBold(true); //modified
+
+ m_fonts.reserve(4);
+ for(int i=0;i<4;i++) m_fonts<<fonts.at(i);
+ }
connect(catalog,SIGNAL(signalEntryModified(DocPosition)),this,SLOT(reflectChanges(DocPosition)));
connect(catalog,SIGNAL(signalFileLoaded()),this,SLOT(fileLoaded()));
}
@@ -123,14 +139,8 @@
{
bool fuzzy=!m_catalog->isApproved(index.row());
bool modified=m_catalog->isModified(index.row());
- if (fuzzy || modified)
- {
- QFont font=QApplication::font();
- font.setItalic(fuzzy);
- font.setBold(modified);
- return font;
+ return m_fonts.at(fuzzy*1 | modified*2);
}
- }
else if (role==Qt::ForegroundRole)
{
if (m_catalog->isBookmarked(index.row()))
--- trunk/KDE/kdesdk/lokalize/src/cataloglistview/catalogmodel.h #1336638:1336639
@@ -1,7 +1,7 @@
/* ****************************************************************************
This file is part of Lokalize
- Copyright (C) 2007-2009 by Nick Shaforostoff <shafff@ukr.net>
+ Copyright (C) 2007-2013 by Nick Shaforostoff <shafff@ukr.net>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -81,6 +81,8 @@
private:
Catalog* m_catalog;
bool m_ignoreAccel;
+
+ static QVector<QVariant> m_fonts;
//DocPos m_prevChanged;
};
--- trunk/KDE/kdesdk/lokalize/src/common/languagelistmodel.cpp #1336638:1336639
@@ -77,7 +77,7 @@
{
if (role==Qt::DecorationRole)
{
- static QMap<QString,QIcon> iconCache;
+ static QMap<QString,QVariant> iconCache;
QString langCode=stringList().at(index.row());
if (!iconCache.contains(langCode))
--- trunk/KDE/kdesdk/lokalize/src/main.cpp #1336638:1336639
@@ -58,7 +58,7 @@
int main(int argc, char **argv)
{
KAboutData about("lokalize", 0, ki18nc("@title", "Lokalize"), version, \
ki18n(description),
- KAboutData::License_GPL, ki18nc("@info:credit", "(c) 2007-2012 \
Nick Shaforostoff\n(c) 1999-2006 The KBabel developers") /*, KLocalizedString(), 0, \
"shafff@ukr.net"*/); + KAboutData::License_GPL, \
ki18nc("@info:credit", "(c) 2007-2013 Nick Shaforostoff\n(c) 1999-2006 The KBabel \
developers") /*, KLocalizedString(), 0, "shafff@ukr.net"*/);
about.addAuthor( ki18n("Nick Shaforostoff"), KLocalizedString(), \
"shaforostoff@kde.ru" );
about.addCredit (ki18n("Google Inc."), ki18n("sponsored development as part of \
Google Summer Of Code program"), QByteArray(), "http://google.com");
about.addCredit (ki18n("Translate-toolkit"), ki18n("provided excellent \
cross-format converting scripts"), QByteArray(), \
"http://translate.sourceforge.net");
--- trunk/KDE/kdesdk/lokalize/src/project/projectmodel.cpp #1336638:1336639
@@ -1,7 +1,7 @@
/* ****************************************************************************
This file is part of Lokalize
- Copyright (C) 2007-2012 by Nick Shaforostoff <shafff@ukr.net>
+ Copyright (C) 2007-2013 by Nick Shaforostoff <shafff@ukr.net>
Copyright (C) 2009 by Viesturs Zarins <viesturs.zarins@mii.lu.lv>
This program is free software; you can redistribute it and/or
--- trunk/KDE/kdesdk/lokalize/src/project/projectmodel.h #1336638:1336639
@@ -1,7 +1,7 @@
/* ****************************************************************************
This file is part of Lokalize
- Copyright (C) 2007-2012 by Nick Shaforostoff <shafff@ukr.net>
+ Copyright (C) 2007-2013 by Nick Shaforostoff <shafff@ukr.net>
Copyright (C) 2009 by Viesturs Zarins <viesturs.zarins@mii.lu.lv>
This program is free software; you can redistribute it and/or
@@ -220,10 +220,10 @@
ProjectNode m_rootNode;
- KIcon m_dirIcon;
- KIcon m_poIcon;
- KIcon m_poComplIcon;
- KIcon m_potIcon;
+ QVariant m_dirIcon;
+ QVariant m_poIcon;
+ QVariant m_poComplIcon;
+ QVariant m_potIcon;
//for updating stats
QSet<ProjectNode *> m_dirsWaitingForMetadata;
--- trunk/KDE/kdesdk/lokalize/src/tm/qamodel.cpp #1336638:1336639
@@ -1,6 +1,6 @@
/*
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 2011-2012 nick <shafff@ukr.net>
+ This file is part of Lokalize
+ Copyright (C) 2011-2012 Nick Shaforostoff <shafff@ukr.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic