提交 1df7f3d0 authored 作者: João Mesquita's avatar João Mesquita

Add individual font configuration for each log level. User feature request.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@15477 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 9dbce7f9
......@@ -45,7 +45,7 @@ ESLconnection *ServerManager::getESLconnection(QString pluginName, QString name)
item->data(0, ServerManager::Name).toByteArray()));
if ( _ESLpoolCount.contains(name) )
qDebug() << "Something really bad happened here.";
QList<QString> pluginRefs;
pluginRefs.append(pluginName);
_ESLpoolCount.insert(name, pluginRefs);
......
......@@ -6,16 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<width>483</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
......@@ -24,18 +24,12 @@
<height>318</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>372</width>
<height>318</height>
</size>
</property>
<property name="title">
<string>Colors</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLineEdit" name="lineConsole">
<property name="minimumSize">
......@@ -105,6 +99,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnConsoleFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -178,6 +179,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnAlertFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -251,6 +259,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCritFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -324,6 +339,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnErrorFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -397,6 +419,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnWarningFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -470,6 +499,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnNoticeFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -543,6 +579,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnInfoFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -616,24 +659,18 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDebugFont">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
......
......@@ -83,6 +83,22 @@ void ConsolePlugin::addConfigItems(SettingsDialog *settings, QMap<QListWidgetIte
consoleConfigPage->setupUi(base);
QObject::connect(consoleConfigPage->btnConsoleFont, SIGNAL(clicked()),
this, SLOT(changeConsoleFont()));
QObject::connect(consoleConfigPage->btnAlertFont, SIGNAL(clicked()),
this, SLOT(changeAlertFont()));
QObject::connect(consoleConfigPage->btnCritFont, SIGNAL(clicked()),
this, SLOT(changeCriticalFont()));
QObject::connect(consoleConfigPage->btnErrorFont, SIGNAL(clicked()),
this, SLOT(changeErrorFont()));
QObject::connect(consoleConfigPage->btnWarningFont, SIGNAL(clicked()),
this, SLOT(changeWarningFont()));
QObject::connect(consoleConfigPage->btnNoticeFont, SIGNAL(clicked()),
this, SLOT(changeNoticeFont()));
QObject::connect(consoleConfigPage->btnInfoFont, SIGNAL(clicked()),
this, SLOT(changeInfoFont()));
QObject::connect(consoleConfigPage->btnDebugFont, SIGNAL(clicked()),
this, SLOT(changeDebugFont()));
QObject::connect(consoleConfigPage->btnBackgroundConsole, SIGNAL(clicked()),
this, SLOT(changeConsoleBackgroundColor()));
QObject::connect(consoleConfigPage->btnBackgroundAlert, SIGNAL(clicked()),
......@@ -218,13 +234,21 @@ void ConsolePlugin::readSettings()
settings.beginGroup("Console");
consoleConfigPage->lineConsole->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_EMERG)).value<QPalette>());
consoleConfigPage->lineConsole->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_EMERG)).value<QFont>());
consoleConfigPage->lineAlert->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ALERT)).value<QPalette>());
consoleConfigPage->lineAlert->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_ALERT)).value<QFont>());
consoleConfigPage->lineCritical->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_CRIT)).value<QPalette>());
consoleConfigPage->lineCritical->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_CRIT)).value<QFont>());
consoleConfigPage->lineError->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ERROR)).value<QPalette>());
consoleConfigPage->lineError->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_ERROR)).value<QFont>());
consoleConfigPage->lineWarning->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_WARNING)).value<QPalette>());
consoleConfigPage->lineWarning->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_WARNING)).value<QFont>());
consoleConfigPage->lineNotice->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_NOTICE)).value<QPalette>());
consoleConfigPage->lineNotice->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_NOTICE)).value<QFont>());
consoleConfigPage->lineInfo->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_INFO)).value<QPalette>());
consoleConfigPage->lineInfo->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_INFO)).value<QFont>());
consoleConfigPage->lineDebug->setPalette(settings.value(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_DEBUG)).value<QPalette>());;
consoleConfigPage->lineDebug->setFont(settings.value(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_DEBUG)).value<QFont>());
settings.endGroup();
}
......@@ -234,16 +258,104 @@ void ConsolePlugin::writeSettings()
QSettings settings;
settings.beginGroup("Console");
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_EMERG), consoleConfigPage->lineConsole->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_EMERG), consoleConfigPage->lineConsole->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ALERT), consoleConfigPage->lineAlert->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_ALERT), consoleConfigPage->lineAlert->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_CRIT), consoleConfigPage->lineCritical->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_CRIT), consoleConfigPage->lineCritical->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_ERROR), consoleConfigPage->lineError->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_ERROR), consoleConfigPage->lineError->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_WARNING), consoleConfigPage->lineWarning->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_WARNING), consoleConfigPage->lineWarning->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_NOTICE), consoleConfigPage->lineNotice->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_NOTICE), consoleConfigPage->lineNotice->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_INFO), consoleConfigPage->lineInfo->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_INFO), consoleConfigPage->lineInfo->font());
settings.setValue(QString("log-level-%1-palette").arg(ESL_LOG_LEVEL_DEBUG), consoleConfigPage->lineDebug->palette());
settings.setValue(QString("log-level-%1-font").arg(ESL_LOG_LEVEL_DEBUG), consoleConfigPage->lineDebug->font());
settings.endGroup();
}
void ConsolePlugin::changeConsoleFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineConsole->font(), this);
if (ok)
{
consoleConfigPage->lineConsole->setFont(font);
}
}
void ConsolePlugin::changeAlertFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineAlert->font(), this);
if (ok)
{
consoleConfigPage->lineAlert->setFont(font);
}
}
void ConsolePlugin::changeWarningFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineWarning->font(), this);
if (ok)
{
consoleConfigPage->lineWarning->setFont(font);
}
}
void ConsolePlugin::changeCriticalFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineCritical->font(), this);
if (ok)
{
consoleConfigPage->lineCritical->setFont(font);
}
}
void ConsolePlugin::changeErrorFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineError->font(), this);
if (ok)
{
consoleConfigPage->lineError->setFont(font);
}
}
void ConsolePlugin::changeNoticeFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineNotice->font(), this);
if (ok)
{
consoleConfigPage->lineNotice->setFont(font);
}
}
void ConsolePlugin::changeInfoFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineInfo->font(), this);
if (ok)
{
consoleConfigPage->lineInfo->setFont(font);
}
}
void ConsolePlugin::changeDebugFont()
{
bool ok;
QFont font = QFontDialog::getFont(&ok, consoleConfigPage->lineDebug->font(), this);
if (ok)
{
consoleConfigPage->lineDebug->setFont(font);
}
}
void ConsolePlugin::changeConsoleBackgroundColor()
{
QColor color = QColorDialog::getColor(consoleConfigPage->lineConsole->palette().color(QPalette::Base), this);
......
......@@ -82,6 +82,14 @@ private slots:
void pastebinLog();
void findText();
void showRealtimeStats();
void changeConsoleFont();
void changeAlertFont();
void changeCriticalFont();
void changeErrorFont();
void changeWarningFont();
void changeNoticeFont();
void changeInfoFont();
void changeDebugFont();
void changeConsoleBackgroundColor();
void changeAlertBackgroundColor();
void changeCriticalBackgroundColor();
......
......@@ -215,8 +215,10 @@ void ConsoleTabWidget::addNewConsoleItem(QStandardItem *item)
QSettings settings;
settings.beginGroup("Console");
QPalette palette = settings.value(QString("log-level-%1-palette").arg(item->data(Qt::UserRole).toInt())).value<QPalette>();
QFont font = settings.value(QString("log-level-%1-font").arg(item->data(Qt::UserRole).toInt())).value<QFont>();
item->setBackground(palette.base());
item->setForeground(palette.text());
item->setFont(font);
sourceModel->appendRow(item);
}
......
......@@ -48,7 +48,6 @@ void ConsoleModel::timerEvent(QTimerEvent *e)
{
if (!_listInsertModel.isEmpty())
{
qDebug() << "Are we being called like crazy?";
int inserted_items = 0;
int toBeInserted = 0;
if (_listInsertModel.size() < batchSize)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论