diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp index 2b996634..d81bad55 100644 --- a/Graphs/gGraphView.cpp +++ b/Graphs/gGraphView.cpp @@ -19,15 +19,38 @@ const int mouse_movement_threshold=6; void InitGraphs() { if (!_graph_init) { - defaultfont=new QFont("Sans Serif",10); + + if (!PREF.Exists("FontGraph")) { + PREF["FontGraph"]="Sans Serif"; + PREF["FontGraphSize"]=10; + PREF["FontGraphBold"]=false; + PREF["FontGraphItalic"]=false; + } + if (!PREF.Exists("FontTitle")) { + PREF["FontTitle"]="Serif"; + PREF["FontTitleSize"]=11; + PREF["FontTitleBold"]=true; + PREF["FontTitleItalic"]=false; + } + if (!PREF.Exists("FontBig")) { + PREF["FontBig"]="Serif"; + PREF["FontBigSize"]=35; + PREF["FontBigBold"]=false; + PREF["FontBigItalic"]=false; + } + + defaultfont=new QFont(PREF["FontGraph"].toString(),PREF["FontGraphSize"].toInt(),PREF["FontGraphBold"].toBool() ? QFont::Bold : QFont::Normal,PREF["FontGraphItalic"].toBool()); + mediumfont=new QFont(PREF["FontTitle"].toString(),PREF["FontTitleSize"].toInt(),PREF["FontTitleBold"].toBool() ? QFont::Bold : QFont::Normal,PREF["FontTitleItalic"].toBool()); + bigfont=new QFont(PREF["FontBig"].toString(),PREF["FontBigSize"].toInt(),PREF["FontBigBold"].toBool() ? QFont::Bold : QFont::Normal,PREF["FontBigItalic"].toBool()); + // defaultfont->setPixelSize(11); - mediumfont=new QFont("Serif",11); - bigfont=new QFont("Serif",35); + //mediumfont=new QFont("Serif",11); + //bigfont=new QFont("Serif",35); defaultfont->setStyleHint(QFont::SansSerif,QFont::OpenGLCompatible); mediumfont->setStyleHint(QFont::SansSerif,QFont::OpenGLCompatible); bigfont->setStyleHint(QFont::Serif ,QFont::OpenGLCompatible); - mediumfont->setBold(true); + //mediumfont->setBold(true); _graph_init=true; } } diff --git a/daily.cpp b/daily.cpp index 049027e1..20df9b40 100644 --- a/daily.cpp +++ b/daily.cpp @@ -203,6 +203,8 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw) ui->calendar->setWeekdayTextFormat(Qt::Sunday, format); ui->tabWidget->setCurrentWidget(ui->details); + + ui->webView->settings()->setFontSize(QWebSettings::DefaultFontSize,QApplication::font().pointSize()); } Daily::~Daily() diff --git a/daily.ui b/daily.ui index 65e54fa7..84dc14df 100644 --- a/daily.ui +++ b/daily.ui @@ -89,14 +89,8 @@ 0 - - - Sans Serif - 10 - - - 1 + 3 true @@ -120,12 +114,6 @@ 0 - - - Sans Serif - 9 - - IBeamCursor @@ -151,12 +139,6 @@ - - - Sans Serif - 10 - - QAbstractItemView::NoEditTriggers @@ -254,11 +236,6 @@ - - - true - - i @@ -269,11 +246,6 @@ - - - true - - u @@ -281,12 +253,6 @@ - - - 75 - true - - B diff --git a/docs/index.html b/docs/index.html index 9d157262..286c5ac0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,9 +1,5 @@ - diff --git a/main.cpp b/main.cpp index 0d62fd74..6aa414eb 100644 --- a/main.cpp +++ b/main.cpp @@ -100,13 +100,22 @@ int main(int argc, char *argv[]) //if (!PREF.Exists("Profile")) PREF["Profile"]=getUserName(); - /*int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf"); - QStringList ffam=QFontDatabase::applicationFontFamilies(id); + //int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf"); + /* QFontDatabase fdb; + QStringList ffam=fdb.families(); for (QStringList::iterator i=ffam.begin();i!=ffam.end();i++) { qDebug() << "Loaded Font: " << (*i); - }*/ + } */ - a.setFont(QFont("Sans Serif",10)); + if (!PREF.Exists("FontApplication")) { + PREF["FontApplication"]="Sans Serif"; + PREF["FontApplicationSize"]=10; + PREF["FontApplicationBold"]=false; + PREF["FontApplicationItalic"]=false; + } + + + QApplication::setFont(QFont(PREF["FontApplication"].toString(),PREF["FontApplicationSize"].toInt(),PREF["FontApplicationBold"].toBool() ? QFont::Bold : QFont::Normal,PREF["FontApplicationItalic"].toBool())); qInstallMsgHandler(MyOutputHandler); diff --git a/mainwindow.ui b/mainwindow.ui index b600712b..163ef4c9 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -22,12 +22,6 @@ 16777215 - - - Sans Serif - 10 - - SleepyHead diff --git a/overview.ui b/overview.ui index d7e8ec5a..a865a152 100644 --- a/overview.ui +++ b/overview.ui @@ -10,11 +10,6 @@ 393 - - - Sans Serif - - Form diff --git a/preferencesdialog.cpp b/preferencesdialog.cpp index 115b9379..1f5249d3 100644 --- a/preferencesdialog.cpp +++ b/preferencesdialog.cpp @@ -4,6 +4,10 @@ #include "ui_preferencesdialog.h" #include "SleepLib/machine_common.h" +extern QFont * defaultfont; +extern QFont * mediumfont; +extern QFont * bigfont; + PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : QDialog(parent), ui(new Ui::PreferencesDialog), @@ -33,6 +37,27 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : val=(*profile)["IgnoreShorterSessions"].toInt(); ui->IgnoreSlider->setValue(val); + ui->applicationFont->setCurrentFont(QApplication::font()); + ui->applicationFontSize->setValue(QApplication::font().pointSize()); + ui->applicationFontBold->setChecked(QApplication::font().weight()==QFont::Bold); + ui->applicationFontItalic->setChecked(QApplication::font().italic()); + + ui->graphFont->setCurrentFont(*defaultfont); + ui->graphFontSize->setValue(defaultfont->pointSize()); + ui->graphFontBold->setChecked(defaultfont->weight()==QFont::Bold); + ui->graphFontItalic->setChecked(defaultfont->italic()); + + ui->titleFont->setCurrentFont(*mediumfont); + ui->titleFontSize->setValue(mediumfont->pointSize()); + ui->titleFontBold->setChecked(mediumfont->weight()==QFont::Bold); + ui->titleFontItalic->setChecked(mediumfont->italic()); + + ui->bigFont->setCurrentFont(*bigfont); + ui->bigFontSize->setValue(bigfont->pointSize()); + ui->bigFontBold->setChecked(bigfont->weight()==QFont::Bold); + ui->bigFontItalic->setChecked(bigfont->italic()); + + if (val>0) { ui->IgnoreLCD->display(val); } else ui->IgnoreLCD->display(tr("OFF")); @@ -144,6 +169,45 @@ void PreferencesDialog::Save() (*profile)["IntentionalLeak"]=ui->intentionalLeakEdit->value(); (*profile)["EnableMultithreading"]=ui->useMultithreading->isChecked(); + PREF["FontApplication"]=ui->applicationFont->currentText(); + PREF["FontApplicationSize"]=ui->applicationFontSize->value(); + PREF["FontApplicationBold"]=ui->applicationFontBold->isChecked(); + PREF["FontApplicationItalic"]=ui->applicationFontItalic->isChecked(); + + PREF["FontGraph"]=ui->graphFont->currentText(); + PREF["FontGraphSize"]=ui->graphFontSize->value(); + PREF["FontGraphBold"]=ui->graphFontBold->isChecked(); + PREF["FontGraphItalic"]=ui->graphFontItalic->isChecked(); + + PREF["FontTitle"]=ui->titleFont->currentText(); + PREF["FontTitleSize"]=ui->titleFontSize->value(); + PREF["FontTitleBold"]=ui->titleFontBold->isChecked(); + PREF["FontTitleItalic"]=ui->titleFontItalic->isChecked(); + + PREF["FontBig"]=ui->bigFont->currentText(); + PREF["FontBigSize"]=ui->bigFontSize->value(); + PREF["FontBigBold"]=ui->bigFontBold->isChecked(); + PREF["FontBigItalic"]=ui->bigFontItalic->isChecked(); + + QFont font=ui->applicationFont->currentFont(); + font.setPointSize(ui->applicationFontSize->value()); + font.setWeight(ui->applicationFontBold->isChecked()?QFont::Bold : QFont::Normal); + font.setItalic(ui->applicationFontItalic->isChecked()); + QApplication::setFont(font); + + *defaultfont=ui->graphFont->currentFont(); + defaultfont->setWeight(ui->graphFontBold->isChecked()?QFont::Bold : QFont::Normal); + defaultfont->setItalic(ui->graphFontItalic->isChecked()); + + *mediumfont=ui->titleFont->currentFont(); + mediumfont->setWeight(ui->titleFontBold->isChecked()?QFont::Bold : QFont::Normal); + mediumfont->setItalic(ui->titleFontItalic->isChecked()); + + *bigfont=ui->bigFont->currentFont(); + bigfont->setWeight(ui->bigFontBold->isChecked()?QFont::Bold : QFont::Normal); + bigfont->setItalic(ui->bigFontItalic->isChecked()); + + for (QHash::iterator i=m_new_colors.begin();i!=m_new_colors.end();i++) { schema::Channel &chan=schema::channel[i.key()]; if (!chan.isNull()) { @@ -170,3 +234,23 @@ void PreferencesDialog::on_IgnoreSlider_valueChanged(int position) ui->IgnoreLCD->display(position); } else ui->IgnoreLCD->display(tr("OFF")); } + +void PreferencesDialog::on_applicationFontSize_valueChanged(int arg1) +{ + ui->applicationFont->currentFont().setPointSize(arg1); +} + +void PreferencesDialog::on_graphFontSize_valueChanged(int arg1) +{ + ui->graphFont->currentFont().setPointSize(arg1); +} + +void PreferencesDialog::on_titleFontSize_valueChanged(int arg1) +{ + ui->titleFont->currentFont().setPointSize(arg1); +} + +void PreferencesDialog::on_bigFontSize_valueChanged(int arg1) +{ + ui->bigFont->currentFont().setPointSize(arg1); +} diff --git a/preferencesdialog.h b/preferencesdialog.h index 11e0f4ff..711a2f28 100644 --- a/preferencesdialog.h +++ b/preferencesdialog.h @@ -29,6 +29,14 @@ private slots: void on_IgnoreSlider_valueChanged(int value); + void on_applicationFontSize_valueChanged(int arg1); + + void on_graphFontSize_valueChanged(int arg1); + + void on_titleFontSize_valueChanged(int arg1); + + void on_bigFontSize_valueChanged(int arg1); + private: Ui::PreferencesDialog *ui; Profile * profile; diff --git a/preferencesdialog.ui b/preferencesdialog.ui index b5f94a10..5052633e 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -29,7 +29,7 @@ - 3 + 4 @@ -507,6 +507,201 @@ p, li { white-space: pre-wrap; } + + + Fonts + + + + + + Application Fonts + + + + + + + 0 + 0 + + + + Application + + + + + + + + + + 6 + + + 30 + + + 10 + + + + + + + + 0 + 0 + + + + Graph Text + + + + + + + + + + 6 + + + 40 + + + 11 + + + + + + + + 0 + 0 + + + + Graph Titles + + + + + + + + + + 6 + + + 40 + + + 14 + + + + + + + Big Text + + + + + + + + + + 6 + + + 72 + + + 18 + + + + + + + Italic + + + + + + + Bold + + + + + + + Bold + + + + + + + Italic + + + + + + + Bold + + + + + + + Italic + + + + + + + Bold + + + + + + + Italic + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + +