Show actual fonts in font dropdowns (#2080)
* Show actual fonts in font dropwdowns
This commit is contained in:
parent
f71888abe7
commit
b66bc4e313
12 changed files with 202 additions and 61 deletions
|
@ -429,6 +429,7 @@ void TFontManager::getAllFamilies(vector<wstring> &families) const {
|
||||||
|
|
||||||
QStringList::const_iterator it = qFamilies.begin();
|
QStringList::const_iterator it = qFamilies.begin();
|
||||||
for (; it != qFamilies.end(); ++it) {
|
for (; it != qFamilies.end(); ++it) {
|
||||||
|
if (!m_pimpl->m_qfontdb->isPrivateFamily(*it))
|
||||||
families.push_back(it->toStdWString());
|
families.push_back(it->toStdWString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,13 @@ public:
|
||||||
void notifyToolChanged() { emit toolChanged(); }
|
void notifyToolChanged() { emit toolChanged(); }
|
||||||
|
|
||||||
void notifyToolCursorTypeChanged() { emit toolCursorTypeChanged(); }
|
void notifyToolCursorTypeChanged() { emit toolCursorTypeChanged(); }
|
||||||
|
|
||||||
|
void notifyToolComboBoxListChanged(std::string id) {
|
||||||
|
emit toolComboBoxListChanged(id);
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void toolComboBoxListChanged(std::string);
|
||||||
void toolSwitched();
|
void toolSwitched();
|
||||||
void toolChanged();
|
void toolChanged();
|
||||||
void toolEditingFinished();
|
void toolEditingFinished();
|
||||||
|
|
|
@ -146,7 +146,7 @@ public:
|
||||||
enum SingleValueWidgetType { SLIDER = 0, FIELD };
|
enum SingleValueWidgetType { SLIDER = 0, FIELD };
|
||||||
void setSingleValueWidgetType(int type) { m_singleValueWidgetType = type; }
|
void setSingleValueWidgetType(int type) { m_singleValueWidgetType = type; }
|
||||||
|
|
||||||
enum EnumWidgetType { COMBOBOX = 0, POPUPBUTTON };
|
enum EnumWidgetType { COMBOBOX = 0, POPUPBUTTON, FONTCOMBOBOX };
|
||||||
void setEnumWidgetType(int type) { m_enumWidgetType = type; }
|
void setEnumWidgetType(int type) { m_enumWidgetType = type; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -238,6 +238,8 @@ public:
|
||||||
|
|
||||||
void setInterfaceFont(std::string font);
|
void setInterfaceFont(std::string font);
|
||||||
QString getInterfaceFont() { return m_interfaceFont; }
|
QString getInterfaceFont() { return m_interfaceFont; }
|
||||||
|
void setInterfaceFontStyle(std::string style);
|
||||||
|
QString getInterfaceFontStyle() { return m_interfaceFontStyle; }
|
||||||
void setInterfaceFontWeight(int weight);
|
void setInterfaceFontWeight(int weight);
|
||||||
int getInterfaceFontWeight() { return m_interfaceFontWeight; }
|
int getInterfaceFontWeight() { return m_interfaceFontWeight; }
|
||||||
|
|
||||||
|
@ -589,7 +591,7 @@ private:
|
||||||
|
|
||||||
QString m_units, m_cameraUnits, m_scanLevelType, m_currentRoomChoice,
|
QString m_units, m_cameraUnits, m_scanLevelType, m_currentRoomChoice,
|
||||||
m_oldUnits, m_oldCameraUnits, m_ffmpegPath, m_shortcutPreset,
|
m_oldUnits, m_oldCameraUnits, m_ffmpegPath, m_shortcutPreset,
|
||||||
m_customProjectRoot, m_interfaceFont;
|
m_customProjectRoot, m_interfaceFont, m_interfaceFontStyle;
|
||||||
QString m_fastRenderPath;
|
QString m_fastRenderPath;
|
||||||
|
|
||||||
double m_defLevelWidth, m_defLevelHeight, m_defLevelDpi;
|
double m_defLevelWidth, m_defLevelHeight, m_defLevelDpi;
|
||||||
|
|
|
@ -365,6 +365,17 @@ void ToolOptionControlBuilder::visit(TEnumProperty *p) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case FONTCOMBOBOX: {
|
||||||
|
if (p->getQStringName() != "") {
|
||||||
|
QLabel *label = addLabel(p);
|
||||||
|
m_panel->addLabel(p->getName(), label);
|
||||||
|
}
|
||||||
|
ToolOptionFontCombo *obj = new ToolOptionFontCombo(m_tool, p, m_toolHandle);
|
||||||
|
control = obj;
|
||||||
|
widget = obj;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case COMBOBOX:
|
case COMBOBOX:
|
||||||
default: {
|
default: {
|
||||||
if (p->getQStringName() != "") {
|
if (p->getQStringName() != "") {
|
||||||
|
@ -1526,22 +1537,28 @@ TypeToolOptionsBox::TypeToolOptionsBox(QWidget *parent, TTool *tool,
|
||||||
assert(props->getPropertyCount() > 0);
|
assert(props->getPropertyCount() > 0);
|
||||||
|
|
||||||
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);
|
||||||
|
builder.setEnumWidgetType(ToolOptionControlBuilder::FONTCOMBOBOX);
|
||||||
if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
|
if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);
|
||||||
|
builder.setEnumWidgetType(ToolOptionControlBuilder::COMBOBOX);
|
||||||
|
if (tool && tool->getProperties(1)) tool->getProperties(1)->accept(builder);
|
||||||
|
|
||||||
m_layout->addStretch(0);
|
m_layout->addStretch(0);
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
ToolOptionCombo *fontField =
|
|
||||||
dynamic_cast<ToolOptionCombo *>(m_controls.value("Font:"));
|
ToolOptionFontCombo *fontField =
|
||||||
|
dynamic_cast<ToolOptionFontCombo *>(m_controls.value("Font:"));
|
||||||
ret &&connect(fontField, SIGNAL(currentIndexChanged(int)), this,
|
ret &&connect(fontField, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(onFieldChanged()));
|
SLOT(onFieldChanged()));
|
||||||
|
|
||||||
#ifndef MACOSX
|
//#ifndef MACOSX
|
||||||
ToolOptionCombo *styleField =
|
ToolOptionCombo *styleField =
|
||||||
dynamic_cast<ToolOptionCombo *>(m_controls.value("Style:"));
|
dynamic_cast<ToolOptionCombo *>(m_controls.value("Style:"));
|
||||||
ret &&connect(styleField, SIGNAL(currentIndexChanged(int)), this,
|
ret &&connect(styleField, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(onFieldChanged()));
|
SLOT(onFieldChanged()));
|
||||||
#endif
|
ret &&connect(toolHandle, SIGNAL(toolComboBoxListChanged(std::string)),
|
||||||
|
styleField, SLOT(reloadComboBoxList(std::string)));
|
||||||
|
//#endif
|
||||||
|
|
||||||
ToolOptionCombo *sizeField =
|
ToolOptionCombo *sizeField =
|
||||||
dynamic_cast<ToolOptionCombo *>(m_controls.value("Size:"));
|
dynamic_cast<ToolOptionCombo *>(m_controls.value("Size:"));
|
||||||
|
|
|
@ -571,9 +571,17 @@ ToolOptionCombo::ToolOptionCombo(TTool *tool, TEnumProperty *property,
|
||||||
setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
connect(this, SIGNAL(activated(int)), this, SLOT(onActivated(int)));
|
connect(this, SIGNAL(activated(int)), this, SLOT(onActivated(int)));
|
||||||
// synchronize the state with the same widgets in other tool option bars
|
// synchronize the state with the same widgets in other tool option bars
|
||||||
if (toolHandle)
|
if (toolHandle) {
|
||||||
connect(this, SIGNAL(activated(int)), toolHandle, SIGNAL(toolChanged()));
|
connect(this, SIGNAL(activated(int)), toolHandle, SIGNAL(toolChanged()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ToolOptionCombo::reloadComboBoxList(std::string id) {
|
||||||
|
if (id == "" || m_property->getName() != id) return;
|
||||||
|
loadEntries();
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -682,6 +690,58 @@ void ToolOptionCombo::doOnActivated(int index) {
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
|
ToolOptionFontCombo::ToolOptionFontCombo(TTool *tool, TEnumProperty *property,
|
||||||
|
ToolHandle *toolHandle)
|
||||||
|
: QFontComboBox()
|
||||||
|
, ToolOptionControl(tool, property->getName(), toolHandle)
|
||||||
|
, m_property(property) {
|
||||||
|
setMaximumWidth(250);
|
||||||
|
m_property->addListener(this);
|
||||||
|
setSizeAdjustPolicy(QFontComboBox::AdjustToContents);
|
||||||
|
connect(this, SIGNAL(activated(int)), this, SLOT(onActivated(int)));
|
||||||
|
// synchronize the state with the same widgets in other tool option bars
|
||||||
|
if (toolHandle)
|
||||||
|
connect(this, SIGNAL(activated(int)), toolHandle, SIGNAL(toolChanged()));
|
||||||
|
|
||||||
|
updateStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ToolOptionFontCombo::updateStatus() {
|
||||||
|
QString value = QString::fromStdWString(m_property->getValue());
|
||||||
|
int index = findText(value);
|
||||||
|
if (index >= 0 && index != currentIndex()) setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ToolOptionFontCombo::onActivated(int index) {
|
||||||
|
const TEnumProperty::Range &range = m_property->getRange();
|
||||||
|
if (index < 0 || index >= (int)range.size()) return;
|
||||||
|
|
||||||
|
std::wstring item = range[index];
|
||||||
|
m_property->setValue(item);
|
||||||
|
notifyTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ToolOptionFontCombo::doShowPopup() {
|
||||||
|
if (!isInVisibleViewer(this)) return;
|
||||||
|
if (Preferences::instance()->getDropdownShortcutsCycleOptions()) {
|
||||||
|
const TEnumProperty::Range &range = m_property->getRange();
|
||||||
|
int theIndex = currentIndex() + 1;
|
||||||
|
if (theIndex >= (int)range.size()) theIndex = 0;
|
||||||
|
onActivated(theIndex);
|
||||||
|
setCurrentIndex(theIndex);
|
||||||
|
} else {
|
||||||
|
if (isVisible()) showPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
ToolOptionPopupButton::ToolOptionPopupButton(TTool *tool,
|
ToolOptionPopupButton::ToolOptionPopupButton(TTool *tool,
|
||||||
TEnumProperty *property)
|
TEnumProperty *property)
|
||||||
: PopupButton()
|
: PopupButton()
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QFontComboBox>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -202,7 +203,30 @@ protected:
|
||||||
public:
|
public:
|
||||||
ToolOptionCombo(TTool *tool, TEnumProperty *property,
|
ToolOptionCombo(TTool *tool, TEnumProperty *property,
|
||||||
ToolHandle *toolHandle = 0);
|
ToolHandle *toolHandle = 0);
|
||||||
|
void updateStatus() override;
|
||||||
|
|
||||||
|
TEnumProperty *getProperty() const { return m_property; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void reloadComboBoxList(std::string);
|
||||||
void loadEntries();
|
void loadEntries();
|
||||||
|
void onActivated(int);
|
||||||
|
void doShowPopup();
|
||||||
|
void doOnActivated(int);
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class ToolOptionFontCombo final : public QFontComboBox,
|
||||||
|
public ToolOptionControl {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TEnumProperty *m_property;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ToolOptionFontCombo(TTool *tool, TEnumProperty *property,
|
||||||
|
ToolHandle *toolHandle = 0);
|
||||||
void updateStatus() override;
|
void updateStatus() override;
|
||||||
|
|
||||||
TEnumProperty *getProperty() const { return m_property; }
|
TEnumProperty *getProperty() const { return m_property; }
|
||||||
|
@ -211,7 +235,6 @@ public slots:
|
||||||
|
|
||||||
void onActivated(int);
|
void onActivated(int);
|
||||||
void doShowPopup();
|
void doShowPopup();
|
||||||
void doOnActivated(int);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -295,7 +295,7 @@ class TypeTool final : public TTool {
|
||||||
TEnumProperty m_typeFaceMenu;
|
TEnumProperty m_typeFaceMenu;
|
||||||
TBoolProperty m_vertical;
|
TBoolProperty m_vertical;
|
||||||
TEnumProperty m_size;
|
TEnumProperty m_size;
|
||||||
TPropertyGroup m_prop;
|
TPropertyGroup m_prop[2];
|
||||||
|
|
||||||
// valori correnti di alcune Properties,
|
// valori correnti di alcune Properties,
|
||||||
// duplicati per permettere controlli sulla validita' o per ottimizzazione
|
// duplicati per permettere controlli sulla validita' o per ottimizzazione
|
||||||
|
@ -389,7 +389,9 @@ public:
|
||||||
|
|
||||||
bool onPropertyChanged(std::string propertyName) override;
|
bool onPropertyChanged(std::string propertyName) override;
|
||||||
|
|
||||||
TPropertyGroup *getProperties(int targetType) override { return &m_prop; }
|
TPropertyGroup *getProperties(int targetType) override {
|
||||||
|
return &m_prop[targetType];
|
||||||
|
}
|
||||||
|
|
||||||
int getColorClass() const { return 1; }
|
int getColorClass() const { return 1; }
|
||||||
|
|
||||||
|
@ -421,15 +423,15 @@ TypeTool::TypeTool()
|
||||||
, m_size("Size:") // W_ToolOptions_Size
|
, m_size("Size:") // W_ToolOptions_Size
|
||||||
, m_undo(0) {
|
, m_undo(0) {
|
||||||
bind(TTool::CommonLevels | TTool::EmptyTarget);
|
bind(TTool::CommonLevels | TTool::EmptyTarget);
|
||||||
m_prop.bind(m_fontFamilyMenu);
|
m_prop[0].bind(m_fontFamilyMenu);
|
||||||
// Su mac non e' visibile il menu dello style perche' e' stato inserito nel
|
// Su mac non e' visibile il menu dello style perche' e' stato inserito nel
|
||||||
// nome
|
// nome
|
||||||
// della font.
|
// della font.
|
||||||
//#ifndef MACOSX
|
//#ifndef MACOSX
|
||||||
m_prop.bind(m_typeFaceMenu);
|
m_prop[1].bind(m_typeFaceMenu);
|
||||||
//#endif
|
//#endif
|
||||||
m_prop.bind(m_size);
|
m_prop[1].bind(m_size);
|
||||||
m_prop.bind(m_vertical);
|
m_prop[1].bind(m_vertical);
|
||||||
m_vertical.setId("Orientation");
|
m_vertical.setId("Orientation");
|
||||||
m_fontFamilyMenu.setId("TypeFont");
|
m_fontFamilyMenu.setId("TypeFont");
|
||||||
m_typeFaceMenu.setId("TypeStyle");
|
m_typeFaceMenu.setId("TypeStyle");
|
||||||
|
@ -537,6 +539,9 @@ void TypeTool::initTypeFaces() {
|
||||||
it != typefaces.end(); ++it)
|
it != typefaces.end(); ++it)
|
||||||
m_typeFaceMenu.addValue(*it);
|
m_typeFaceMenu.addValue(*it);
|
||||||
if (m_typeFaceMenu.isValue(oldTypeface)) m_typeFaceMenu.setValue(oldTypeface);
|
if (m_typeFaceMenu.isValue(oldTypeface)) m_typeFaceMenu.setValue(oldTypeface);
|
||||||
|
|
||||||
|
TTool::getApplication()->getCurrentTool()->notifyToolComboBoxListChanged(
|
||||||
|
m_typeFaceMenu.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "tsimplecolorstyles.h"
|
#include "tsimplecolorstyles.h"
|
||||||
#include "toonz/imagestyles.h"
|
#include "toonz/imagestyles.h"
|
||||||
#include "tvectorbrushstyle.h"
|
#include "tvectorbrushstyle.h"
|
||||||
|
#include "tfont.h"
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
#include "tipc.h"
|
#include "tipc.h"
|
||||||
|
@ -682,16 +683,26 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont *myFont;
|
QFont *myFont;
|
||||||
std::string fontName =
|
QString fontName = Preferences::instance()->getInterfaceFont();
|
||||||
Preferences::instance()->getInterfaceFont().toStdString();
|
QString fontStyle = Preferences::instance()->getInterfaceFontStyle();
|
||||||
std::string isBold =
|
|
||||||
Preferences::instance()->getInterfaceFontWeight() ? "Yes" : "No";
|
TFontManager *fontMgr = TFontManager::instance();
|
||||||
myFont = new QFont(QString::fromStdString(fontName));
|
std::vector<std::wstring> typefaces;
|
||||||
|
fontMgr->loadFontNames();
|
||||||
|
fontMgr->setFamily(fontName.toStdWString());
|
||||||
|
fontMgr->getAllTypefaces(typefaces);
|
||||||
|
|
||||||
|
bool isBold = false, isItalic = false, hasKerning = false;
|
||||||
|
isBold = fontMgr->isBold(fontName, fontStyle);
|
||||||
|
isItalic = fontMgr->isItalic(fontName, fontStyle);
|
||||||
|
hasKerning = fontMgr->hasKerning();
|
||||||
|
|
||||||
|
myFont = new QFont(fontName);
|
||||||
myFont->setPixelSize(EnvSoftwareCurrentFontSize);
|
myFont->setPixelSize(EnvSoftwareCurrentFontSize);
|
||||||
if (strcmp(isBold.c_str(), "Yes") == 0)
|
myFont->setBold(isBold);
|
||||||
myFont->setBold(true);
|
myFont->setItalic(isItalic);
|
||||||
else
|
myFont->setKerning(hasKerning);
|
||||||
myFont->setBold(false);
|
|
||||||
a.setFont(*myFont);
|
a.setFont(*myFont);
|
||||||
|
|
||||||
QAction *action = CommandManager::instance()->getAction("MI_OpenTMessage");
|
QAction *action = CommandManager::instance()->getAction("MI_OpenTMessage");
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QFontComboBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -353,10 +354,31 @@ void PreferencesPopup::onDropdownShortcutsCycleOptionsChanged(int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
void PreferencesPopup::rebuilldFontStyleList() {
|
||||||
|
TFontManager *instance = TFontManager::instance();
|
||||||
|
std::vector<std::wstring> typefaces;
|
||||||
|
QString font = m_interfaceFont->currentText();
|
||||||
|
instance->loadFontNames();
|
||||||
|
instance->setFamily(font.toStdWString());
|
||||||
|
instance->getAllTypefaces(typefaces);
|
||||||
|
m_interfaceFontStyle->clear();
|
||||||
|
for (std::vector<std::wstring>::iterator it = typefaces.begin();
|
||||||
|
it != typefaces.end(); ++it)
|
||||||
|
m_interfaceFontStyle->addItem(QString::fromStdWString(*it));
|
||||||
|
}
|
||||||
|
|
||||||
void PreferencesPopup::onInterfaceFontChanged(int index) {
|
void PreferencesPopup::onInterfaceFontChanged(int index) {
|
||||||
QString font = m_interfaceFont->currentText();
|
QString font = m_interfaceFont->currentText();
|
||||||
m_pref->setInterfaceFont(font.toStdString());
|
m_pref->setInterfaceFont(font.toStdString());
|
||||||
|
|
||||||
|
QString oldTypeface = m_interfaceFontStyle->currentText();
|
||||||
|
rebuilldFontStyleList();
|
||||||
|
if (!oldTypeface.isEmpty()) {
|
||||||
|
int newIndex = m_interfaceFontStyle->findText(oldTypeface);
|
||||||
|
if (newIndex < 0) newIndex = 0;
|
||||||
|
m_interfaceFontStyle->setCurrentIndex(newIndex);
|
||||||
|
}
|
||||||
|
|
||||||
if (font.contains("Comic Sans"))
|
if (font.contains("Comic Sans"))
|
||||||
DVGui::warning(tr("Life is too short for Comic Sans"));
|
DVGui::warning(tr("Life is too short for Comic Sans"));
|
||||||
if (font.contains("Wingdings"))
|
if (font.contains("Wingdings"))
|
||||||
|
@ -365,8 +387,9 @@ void PreferencesPopup::onInterfaceFontChanged(int index) {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void PreferencesPopup::onInterfaceFontWeightChanged(int index) {
|
void PreferencesPopup::onInterfaceFontStyleChanged(int index) {
|
||||||
m_pref->setInterfaceFontWeight(index);
|
QString style = m_interfaceFontStyle->itemText(index);
|
||||||
|
m_pref->setInterfaceFontStyle(style.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1313,8 +1336,8 @@ PreferencesPopup::PreferencesPopup()
|
||||||
new QLabel(tr("* Changes will take effect the next time you run Toonz"));
|
new QLabel(tr("* Changes will take effect the next time you run Toonz"));
|
||||||
note_interface->setStyleSheet("font-size: 10px; font: italic;");
|
note_interface->setStyleSheet("font-size: 10px; font: italic;");
|
||||||
|
|
||||||
m_interfaceFont = new QComboBox(this);
|
m_interfaceFont = new QFontComboBox(this);
|
||||||
m_interfaceFontWeight = new QComboBox(this);
|
m_interfaceFontStyle = new QComboBox(this);
|
||||||
|
|
||||||
m_colorCalibration =
|
m_colorCalibration =
|
||||||
new QGroupBox(tr("Color Calibration using 3D Look-up Table *"));
|
new QGroupBox(tr("Color Calibration using 3D Look-up Table *"));
|
||||||
|
@ -1661,32 +1684,10 @@ PreferencesPopup::PreferencesPopup()
|
||||||
viewerZoomCenterComboBox->addItems(zoomCenters);
|
viewerZoomCenterComboBox->addItems(zoomCenters);
|
||||||
viewerZoomCenterComboBox->setCurrentIndex(m_pref->getViewerZoomCenter());
|
viewerZoomCenterComboBox->setCurrentIndex(m_pref->getViewerZoomCenter());
|
||||||
|
|
||||||
TFontManager *instance = TFontManager::instance();
|
|
||||||
bool validFonts;
|
|
||||||
try {
|
|
||||||
instance->loadFontNames();
|
|
||||||
validFonts = true;
|
|
||||||
} catch (TFontLibraryLoadingError &) {
|
|
||||||
validFonts = false;
|
|
||||||
// TMessage::error(toString(e.getMessage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (validFonts) {
|
|
||||||
std::vector<std::wstring> names;
|
|
||||||
instance->getAllFamilies(names);
|
|
||||||
|
|
||||||
for (std::vector<std::wstring>::iterator it = names.begin();
|
|
||||||
it != names.end(); ++it)
|
|
||||||
m_interfaceFont->addItem(QString::fromStdWString(*it));
|
|
||||||
|
|
||||||
m_interfaceFont->setCurrentText(m_pref->getInterfaceFont());
|
m_interfaceFont->setCurrentText(m_pref->getInterfaceFont());
|
||||||
}
|
|
||||||
|
|
||||||
QStringList fontStyles;
|
rebuilldFontStyleList();
|
||||||
fontStyles << "Regular"
|
m_interfaceFontStyle->setCurrentText(m_pref->getInterfaceFontStyle());
|
||||||
<< "Bold";
|
|
||||||
m_interfaceFontWeight->addItems(fontStyles);
|
|
||||||
m_interfaceFontWeight->setCurrentIndex(m_pref->getInterfaceFontWeight());
|
|
||||||
|
|
||||||
m_colorCalibration->setCheckable(true);
|
m_colorCalibration->setCheckable(true);
|
||||||
m_colorCalibration->setChecked(m_pref->isColorCalibrationEnabled());
|
m_colorCalibration->setChecked(m_pref->isColorCalibrationEnabled());
|
||||||
|
@ -2092,8 +2093,8 @@ PreferencesPopup::PreferencesPopup()
|
||||||
{
|
{
|
||||||
fontLay->addWidget(m_interfaceFont);
|
fontLay->addWidget(m_interfaceFont);
|
||||||
fontLay->addSpacing(10);
|
fontLay->addSpacing(10);
|
||||||
fontLay->addWidget(new QLabel(tr("Weight *:")));
|
fontLay->addWidget(new QLabel(tr("Style *:")));
|
||||||
fontLay->addWidget(m_interfaceFontWeight);
|
fontLay->addWidget(m_interfaceFontStyle);
|
||||||
fontLay->addStretch(1);
|
fontLay->addStretch(1);
|
||||||
}
|
}
|
||||||
interfaceBottomLay->addLayout(fontLay, 4, 1, 1, 5);
|
interfaceBottomLay->addLayout(fontLay, 4, 1, 1, 5);
|
||||||
|
@ -2714,8 +2715,8 @@ PreferencesPopup::PreferencesPopup()
|
||||||
this, SLOT(onViewerZoomCenterChanged(int)));
|
this, SLOT(onViewerZoomCenterChanged(int)));
|
||||||
ret = ret && connect(m_interfaceFont, SIGNAL(currentIndexChanged(int)), this,
|
ret = ret && connect(m_interfaceFont, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(onInterfaceFontChanged(int)));
|
SLOT(onInterfaceFontChanged(int)));
|
||||||
ret = ret && connect(m_interfaceFontWeight, SIGNAL(currentIndexChanged(int)),
|
ret = ret && connect(m_interfaceFontStyle, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(onInterfaceFontWeightChanged(int)));
|
this, SLOT(onInterfaceFontStyleChanged(int)));
|
||||||
ret = ret && connect(replaceAfterSaveLevelAsCB, SIGNAL(stateChanged(int)),
|
ret = ret && connect(replaceAfterSaveLevelAsCB, SIGNAL(stateChanged(int)),
|
||||||
this, SLOT(onReplaceAfterSaveLevelAsChanged(int)));
|
this, SLOT(onReplaceAfterSaveLevelAsChanged(int)));
|
||||||
ret =
|
ret =
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QFontComboBox>
|
||||||
|
|
||||||
//==============================================================
|
//==============================================================
|
||||||
|
|
||||||
|
@ -55,9 +56,10 @@ private:
|
||||||
*m_defLevelType, *m_autocreationType, *m_levelFormatNames,
|
*m_defLevelType, *m_autocreationType, *m_levelFormatNames,
|
||||||
*m_columnIconOm, *m_unitOm, *m_cameraUnitOm, *m_importPolicy,
|
*m_columnIconOm, *m_unitOm, *m_cameraUnitOm, *m_importPolicy,
|
||||||
*m_vectorSnappingTargetCB, *m_dropdownShortcutsCycleOptionsCB,
|
*m_vectorSnappingTargetCB, *m_dropdownShortcutsCycleOptionsCB,
|
||||||
*m_interfaceFont, *m_interfaceFontWeight, *m_guidedDrawingStyle,
|
*m_guidedDrawingStyle, *m_functionEditorToggle, *m_cursorBrushType,
|
||||||
*m_functionEditorToggle, *m_cursorBrushType, *m_cursorBrushStyle,
|
*m_cursorBrushStyle, *m_xsheetLayout, *m_interfaceFontStyle;
|
||||||
*m_xsheetLayout;
|
|
||||||
|
QFontComboBox *m_interfaceFont;
|
||||||
|
|
||||||
DVGui::MeasuredDoubleLineEdit *m_defLevelWidth, *m_defLevelHeight;
|
DVGui::MeasuredDoubleLineEdit *m_defLevelWidth, *m_defLevelHeight;
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ private:
|
||||||
private:
|
private:
|
||||||
// QWidget* create(const QString& lbl, bool def, const char* slot);
|
// QWidget* create(const QString& lbl, bool def, const char* slot);
|
||||||
void rebuildFormatsList();
|
void rebuildFormatsList();
|
||||||
|
void rebuilldFontStyleList();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
@ -202,7 +205,7 @@ private slots:
|
||||||
void onShortcutCommandsWhileRenamingCellClicked(int);
|
void onShortcutCommandsWhileRenamingCellClicked(int);
|
||||||
void onWatchFileSystemClicked(int);
|
void onWatchFileSystemClicked(int);
|
||||||
void onInterfaceFontChanged(int index);
|
void onInterfaceFontChanged(int index);
|
||||||
void onInterfaceFontWeightChanged(int index);
|
void onInterfaceFontStyleChanged(int index);
|
||||||
void onXsheetLayoutChanged(int index);
|
void onXsheetLayoutChanged(int index);
|
||||||
void onPathAliasPriorityChanged(int index);
|
void onPathAliasPriorityChanged(int index);
|
||||||
void onShowCurrentTimelineChanged(int);
|
void onShowCurrentTimelineChanged(int);
|
||||||
|
|
|
@ -231,6 +231,7 @@ Preferences::Preferences()
|
||||||
#else
|
#else
|
||||||
, m_interfaceFont("Helvetica")
|
, m_interfaceFont("Helvetica")
|
||||||
#endif
|
#endif
|
||||||
|
, m_interfaceFontStyle("Regular")
|
||||||
, m_interfaceFontWeight(0)
|
, m_interfaceFontWeight(0)
|
||||||
, m_defLevelWidth(0.0)
|
, m_defLevelWidth(0.0)
|
||||||
, m_defLevelHeight(0.0)
|
, m_defLevelHeight(0.0)
|
||||||
|
@ -635,6 +636,10 @@ Preferences::Preferences()
|
||||||
QString interfaceFont = m_settings->value("interfaceFont").toString();
|
QString interfaceFont = m_settings->value("interfaceFont").toString();
|
||||||
if (interfaceFont != "") m_interfaceFont = interfaceFont;
|
if (interfaceFont != "") m_interfaceFont = interfaceFont;
|
||||||
setInterfaceFont(m_interfaceFont.toStdString());
|
setInterfaceFont(m_interfaceFont.toStdString());
|
||||||
|
QString interfaceFontStyle =
|
||||||
|
m_settings->value("interfaceFontStyle").toString();
|
||||||
|
if (interfaceFontStyle != "") m_interfaceFontStyle = interfaceFontStyle;
|
||||||
|
setInterfaceFontStyle(m_interfaceFontStyle.toStdString());
|
||||||
getValue(*m_settings, "interfaceFontWeight", m_interfaceFontWeight);
|
getValue(*m_settings, "interfaceFontWeight", m_interfaceFontWeight);
|
||||||
getValue(*m_settings, "useNumpadForSwitchingStyles",
|
getValue(*m_settings, "useNumpadForSwitchingStyles",
|
||||||
m_useNumpadForSwitchingStyles);
|
m_useNumpadForSwitchingStyles);
|
||||||
|
@ -1319,6 +1324,13 @@ void Preferences::setInterfaceFont(std::string font) {
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
|
void Preferences::setInterfaceFontStyle(std::string style) {
|
||||||
|
m_interfaceFontStyle = QString::fromStdString(style);
|
||||||
|
m_settings->setValue("interfaceFontStyle", m_interfaceFontStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
void Preferences::setInterfaceFontWeight(int weight) {
|
void Preferences::setInterfaceFontWeight(int weight) {
|
||||||
m_interfaceFontWeight = weight;
|
m_interfaceFontWeight = weight;
|
||||||
m_settings->setValue("interfaceFontWeight", m_interfaceFontWeight);
|
m_settings->setValue("interfaceFontWeight", m_interfaceFontWeight);
|
||||||
|
|
Loading…
Reference in a new issue