Skip to content

Commit

Permalink
Add the ability to enable/disable font previews in the editor dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
baumgarr committed Dec 12, 2016
1 parent 4102ad4 commit 5138881
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dialog/preferences/appearancepreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ AppearancePreferences::AppearancePreferences(QWidget *parent) :
alternateNoteListColors = new QCheckBox(tr("Alternate note list colors*"), this);
autosetUserid = new QCheckBox(tr("Set author on new notes."),this);
autosetUserid->setChecked(global.autosetUsername());
fontPreviewInDialog = new QCheckBox(tr("Preview fonts in editor diolag*"));
fontPreviewInDialog->setChecked(global.previewFontsInDialog());

traySingleClickAction = new QComboBox();
traySingleClickAction->addItem(tr("Show/Hide NixNote"), 0);
Expand Down Expand Up @@ -123,7 +125,8 @@ AppearancePreferences::AppearancePreferences(QWidget *parent) :
mainLayout->addWidget(forceWebFonts, row++, 1);
mainLayout->addWidget(showNoteListGrid,row,0);
mainLayout->addWidget(alternateNoteListColors,row++,1);
mainLayout->addWidget(autosetUserid, row++,0);
mainLayout->addWidget(autosetUserid, row,0);
mainLayout->addWidget(fontPreviewInDialog, row++, 1);

mainLayout->addWidget(defaultNotebookOnStartupLabel,row,0);
mainLayout->addWidget(defaultNotebookOnStartup, row++,1);
Expand Down Expand Up @@ -369,6 +372,8 @@ void AppearancePreferences::saveValues() {

global.settings->endGroup();

global.setPreviewFontsInDialog(fontPreviewInDialog->isChecked());

}


Expand Down
1 change: 1 addition & 0 deletions dialog/preferences/appearancepreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class AppearancePreferences : public QWidget
QComboBox *mouseMiddleClickAction;
QComboBox *systemNotifier;
QCheckBox *autosetUserid;
QCheckBox *fontPreviewInDialog;
QLabel *defaultNotebookOnStartupLabel;
QPushButton *previewButton;
bool webSettingsChanged;
Expand Down
18 changes: 18 additions & 0 deletions global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,3 +1239,21 @@ void Global::setDebugLevel() {


Global global;



// Should we preview fonts in the editor window?
bool Global::previewFontsInDialog() {
settings->beginGroup("Appearance");
bool value = settings->value("previewFonts", false).toBool();
settings->endGroup();
return value;
}


// Set the previewing of fonts in the editor window.
void Global::setPreviewFontsInDialog(bool value) {
settings->beginGroup("Appearance");
settings->setValue("previewFonts", value);
settings->endGroup();
}
2 changes: 2 additions & 0 deletions global.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ class Global
void setProxyEnabled(bool value);
void setSocks5Enabled(bool value);
QString systemNotifier();
bool previewFontsInDialog();
void setPreviewFontsInDialog(bool value);

// Search Behavior
void setClearNotebookOnSearch(bool value);
Expand Down
3 changes: 2 additions & 1 deletion gui/browserWidgets/editorbuttonbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ void EditorButtonBar::loadFontNames() {
QFont f;
global.getGuiFont(f);
f.setFamily(fontFamilies[i]);
fontNames->setItemData(i, QVariant(f), Qt::FontRole);
if (global.previewFontsInDialog())
fontNames->setItemData(i, QVariant(f), Qt::FontRole);
if (first) {
loadFontSizeComboBox(fontFamilies[i]);
first=false;
Expand Down
Binary file modified help/UserDocumentation.odt
Binary file not shown.
Binary file modified help/UserDocumentation.pdf
Binary file not shown.

0 comments on commit 5138881

Please sign in to comment.