r20254 by craig - #11988: Preselected glyphs hint bubble should also display the unicode name of the glyph and the name of the font (SimonAW)
scribus-commit
scribus-commit at lists.scribus.net
Thu Jul 16 21:38:14 UTC 2015
Author: craig
Date: Thu Jul 16 21:38:13 2015
New Revision: 20254
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20254
Log:
#11988: Preselected glyphs hint bubble should also display the unicode name of the glyph and the name of the font (SimonAW)
Modified:
trunk/Scribus/scribus/chartablemodel.cpp
trunk/Scribus/scribus/langmgr.cpp
trunk/Scribus/scribus/ui/charselect.cpp
trunk/Scribus/scribus/ui/charselect.h
trunk/Scribus/scribus/ui/charselect.ui
trunk/Scribus/scribus/ui/prefs_userinterface.cpp
trunk/Scribus/scribus/ui/unicodesearch.cpp
trunk/Scribus/scribus/ui/unicodesearch.h
Modified: trunk/Scribus/scribus/chartablemodel.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/chartablemodel.cpp
==============================================================================
--- trunk/Scribus/scribus/chartablemodel.cpp (original)
+++ trunk/Scribus/scribus/chartablemodel.cpp Thu Jul 16 21:38:13 2015
@@ -57,6 +57,15 @@
// tooltip
if (role == Qt::ToolTipRole)
return QString("Unicode:\n0x%1").arg(currentChar, 4, 16, QChar('0'));
+
+ // status tip
+ if ( role == Qt::StatusTipRole )
+ {
+ QString tmp = QString("%1").arg(currentChar, 4, 16, QChar('0')).toUpper();
+ QStringList lst;
+ lst << tmp << currentFont;
+ return lst;
+ }
// pixmap
if (role == Qt::DecorationRole)
Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Thu Jul 16 21:38:13 2015
@@ -394,8 +394,8 @@
if (langTable[i].m_transAvailable)
stringListToFill->append(langTable[i].m_transName);
}
- }
- stringListToFill->sort();
+ stringListToFill->sort();
+ }
}
void LanguageManager::fillInstalledHyphStringList(QStringList *stringListToFill)
Modified: trunk/Scribus/scribus/ui/charselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/ui/charselect.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.cpp (original)
+++ trunk/Scribus/scribus/ui/charselect.cpp Thu Jul 16 21:38:13 2015
@@ -39,12 +39,14 @@
m_userTableModel = new CharTableModel(this, 6, m_doc, PrefsManager::instance()->appPrefs.itemToolPrefs.textFont);
loadUserContent(ScPaths::getApplicationDataDir() + "charpalette.ucp");
+ m_unicodeSearchModel = new UnicodeSearchModel(this);
+
m_userTable->setModel(m_userTableModel);
m_userTable->setAcceptDrops(true);
// signals and slots connections
connect(m_userTable, SIGNAL(selectChar(uint, QString)), this, SLOT(userNewChar(uint, QString)));
- connect(m_userTableModel, SIGNAL(selectionChanged(QItemSelectionModel*)), m_userTable, SLOT(modelSelectionChanged(QItemSelectionModel*)));
+ connect(m_userTable->selectionModel(), SIGNAL(selectionChanged(const QItemSelection& ,const QItemSelection&)), this, SLOT(slot_selectionChanged(const QItemSelection&, const QItemSelection&)) );
connect(m_userTableModel, SIGNAL(rowAppended()), m_userTable, SLOT(resizeLastRow()));
connect(unicodeButton, SIGNAL(chosenUnicode(const QString &)), m_userTableModel, SLOT(appendUnicode(const QString &)));
connect(hideButton, SIGNAL(toggled(bool)), this, SLOT(hideButton_toggled(bool)));
@@ -154,6 +156,31 @@
cItem->itemText.applyCharStyle(pot, 1, nstyle);
m_doc->view()->DrawNew();
m_doc->changed();
+}
+
+void CharSelect::slot_selectionChanged( const QItemSelection& sel, const QItemSelection& )
+{
+ QModelIndexList indexes = sel.indexes();
+ if ( indexes.isEmpty() )
+ return;
+
+ QModelIndex index = indexes.at(0);
+ if ( !index.isValid() )
+ return;
+
+ // we retrieve a QStringList of two elements from data() encapsulated in a
+ // QVariant, so we should make sure first that we can convert to QStringList.
+ // Otherwise clear the status label
+ QVariant tmp = index.data(Qt::StatusTipRole);
+ if ( !tmp.canConvert(QMetaType::QStringList) )
+ {
+ m_statusLabel->setText(QString());
+ return;
+ }
+
+ QStringList lst = tmp.toStringList();
+ m_statusLabel->setText("<p><b>" + QString("%1").arg(m_unicodeSearchModel->descriptionFromHex(lst.at(0))).toUpper() +
+ "</b><br>" + QString(tr("Font: %2")).arg(lst.at(1)) + "</p>");
}
void CharSelect::openEnhanced()
@@ -317,6 +344,7 @@
)
{
m_userTableModel->setCharacters(CharClassDef());
+ m_statusLabel->setText(QString());
}
}
Modified: trunk/Scribus/scribus/ui/charselect.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/ui/charselect.h
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.h (original)
+++ trunk/Scribus/scribus/ui/charselect.h Thu Jul 16 21:38:13 2015
@@ -10,6 +10,7 @@
#include "scribusapi.h"
#include "scrpalettebase.h"
#include "chartablemodel.h"
+#include "unicodesearch.h"
#include "ui_charselect.h"
class PageItem;
@@ -64,6 +65,7 @@
ScribusDoc* m_doc;
//! \brief m_userTable model
CharTableModel * m_userTableModel;
+ UnicodeSearchModel *m_unicodeSearchModel;
CharSelectEnhanced * m_enhanced;
@@ -86,6 +88,7 @@
void slot_insertSpecialChar();
void slot_insertSpecialChars(const QString & chars);
void slot_insertUserSpecialChar(QChar, QString font);
+ void slot_selectionChanged( const QItemSelection&, const QItemSelection& );
void uniLoadButton_clicked();
void uniSaveButton_clicked();
void uniClearButton_clicked();
Modified: trunk/Scribus/scribus/ui/charselect.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/ui/charselect.ui
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.ui (original)
+++ trunk/Scribus/scribus/ui/charselect.ui Thu Jul 16 21:38:13 2015
@@ -81,6 +81,13 @@
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="m_statusLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
Modified: trunk/Scribus/scribus/ui/prefs_userinterface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/ui/prefs_userinterface.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterface.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_userinterface.cpp Thu Jul 16 21:38:13 2015
@@ -27,7 +27,8 @@
languageChange();
QStringList languageList;
- LanguageManager::instance()->fillInstalledGUIStringList(&languageList, true);
+ languageList<<"";
+ LanguageManager::instance()->fillInstalledGUIStringList(&languageList, false);
languageComboBox->addItems( languageList );
// qt styles
Modified: trunk/Scribus/scribus/ui/unicodesearch.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/ui/unicodesearch.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/unicodesearch.cpp (original)
+++ trunk/Scribus/scribus/ui/unicodesearch.cpp Thu Jul 16 21:38:13 2015
@@ -115,6 +115,16 @@
UnicodeSearchModel::~UnicodeSearchModel()
{
+}
+
+QString UnicodeSearchModel::descriptionFromHex(const QString& hex)
+{
+ foreach( UnicodeStruct I, m_unicode )
+ {
+ if ( I.hex == hex )
+ return I.description;
+ }
+ return QString();
}
int UnicodeSearchModel::rowCount(const QModelIndex & /*parent*/) const
Modified: trunk/Scribus/scribus/ui/unicodesearch.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20254&path=/trunk/Scribus/scribus/ui/unicodesearch.h
==============================================================================
--- trunk/Scribus/scribus/ui/unicodesearch.h (original)
+++ trunk/Scribus/scribus/ui/unicodesearch.h Thu Jul 16 21:38:13 2015
@@ -82,6 +82,9 @@
//! \brief Return hex-key for the row of given index. See m_keys.
QString hexData(const QModelIndex & index);
+ //! \brief Return character unicode description from hex code
+ QString descriptionFromHex(const QString& hex);
+
private:
//! \brief Easier to use QPair-like replacement
More information about the scribus-commit
mailing list