mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Proposal for a more structured UI.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32962 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ddebdc4514
commit
8d0378b75d
@ -6,6 +6,7 @@
|
||||
*
|
||||
* \author Peter Kümmel
|
||||
* \author Pavel Sanda
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -34,23 +35,9 @@ namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
struct LevelButton : QCheckBox
|
||||
{
|
||||
LevelButton(const QString& name) : QCheckBox(name) {}
|
||||
Debug::Type level;
|
||||
|
||||
void setCheckStatusSilent(Qt::CheckState state) {
|
||||
blockSignals(true);
|
||||
setCheckState(state);
|
||||
blockSignals(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProgressViewWidget::ProgressViewWidget()
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +48,8 @@ GuiProgressView::~GuiProgressView()
|
||||
|
||||
|
||||
GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
|
||||
Qt::WindowFlags flags) : DockView(parent, "progress", "Debug/Progress window", area, flags)
|
||||
Qt::WindowFlags flags)
|
||||
: DockView(parent, "progress", "Debug/Progress window", area, flags)
|
||||
{
|
||||
widget_ = new ProgressViewWidget();
|
||||
#if QT_VERSION < 0x040400
|
||||
@ -78,25 +66,32 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
|
||||
widget_->outTE->setFont(font);
|
||||
widget_->tabWidget->widget(0)->setContentsMargins(-5, -7, 0, -7);
|
||||
|
||||
toggle_button = new LevelButton("Toggle ALL messages");
|
||||
toggle_button->level = Debug::ANY;
|
||||
toggle_button->setTristate(true);
|
||||
toggle_button->setCheckState(Qt::PartiallyChecked);
|
||||
widget_->settingsLayout->addWidget(toggle_button);
|
||||
connect(toggle_button, SIGNAL(stateChanged(int)), this, SLOT(tristateChanged(int)));
|
||||
connect(widget_->debugNoneRB, SIGNAL(clicked()),
|
||||
this, SLOT(debugSelectionChanged()));
|
||||
connect(widget_->debugSelectedRB, SIGNAL(clicked()),
|
||||
this, SLOT(debugSelectionChanged()));
|
||||
connect(widget_->debugAnyRB, SIGNAL(clicked()),
|
||||
this, SLOT(debugSelectionChanged()));
|
||||
widget_->debugMessagesTW->setEnabled(false);
|
||||
widget_->debugNoneRB->setChecked(true);
|
||||
|
||||
// ignore Debug::NONE and Debug::ANY
|
||||
int const level_count = Debug::levelCount() - 1;
|
||||
QTreeWidgetItem * item = 0;
|
||||
widget_->debugMessagesTW->setColumnCount(2);
|
||||
widget_->debugMessagesTW->headerItem()->setText(0, qt_("Debug Level"));
|
||||
widget_->debugMessagesTW->headerItem()->setText(1, qt_("Display"));
|
||||
for (int i = 1 ; i < level_count; i++) {
|
||||
item = new QTreeWidgetItem(widget_->debugMessagesTW);
|
||||
Debug::Type const level = Debug::value(i);
|
||||
LevelButton * box = new LevelButton(toqstr(Debug::description(level)));
|
||||
box->level = level;
|
||||
widget_->settingsLayout->addWidget(box, (i + 3) % 10, (i + 3) / 10);
|
||||
box->setChecked(false);
|
||||
level_buttons << box;
|
||||
connect(box, SIGNAL(stateChanged(int)), this, SLOT(levelChanged()));
|
||||
item->setText(0, toqstr(Debug::description(level)));
|
||||
item->setData(0, Qt::UserRole, int(level));
|
||||
item->setText(1, qt_("No"));
|
||||
}
|
||||
widget_->settingsLayout->activate();
|
||||
widget_->debugMessagesTW->resizeColumnToContents(0);
|
||||
connect(widget_->debugMessagesTW,
|
||||
SIGNAL(itemActivated(QTreeWidgetItem *, int)),
|
||||
this, SLOT(debugMessageActivated(QTreeWidgetItem *, int)));
|
||||
|
||||
GuiProgress * progress =
|
||||
dynamic_cast<GuiProgress *>(ProgressInterface::instance());
|
||||
@ -118,36 +113,46 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
|
||||
}
|
||||
|
||||
|
||||
void GuiProgressView::debugMessageActivated(QTreeWidgetItem * item, int)
|
||||
{
|
||||
if (item == 0)
|
||||
return;
|
||||
|
||||
QString const no = qt_("No");
|
||||
QString const yes = qt_("Yes");
|
||||
|
||||
bool selected = (item->text(1) == yes);
|
||||
item->setText(1, selected ? no : yes);
|
||||
|
||||
levelChanged();
|
||||
}
|
||||
|
||||
|
||||
void GuiProgressView::levelChanged()
|
||||
{
|
||||
int level = Debug::NONE;
|
||||
checked_buttons.clear();
|
||||
Q_FOREACH(LevelButton* button, level_buttons) {
|
||||
if (button->isChecked()) {
|
||||
level |= button->level;
|
||||
checked_buttons << button;
|
||||
}
|
||||
QTreeWidgetItemIterator it(widget_->debugMessagesTW);
|
||||
while (*it) {
|
||||
if ((*it)->text(1) == qt_("Yes"))
|
||||
level |= (*it)->data(0, Qt::UserRole).toInt();
|
||||
++it;
|
||||
}
|
||||
dispatch(FuncRequest(LFUN_DEBUG_LEVEL_SET, convert<string>(level)));
|
||||
|
||||
toggle_button->setCheckStatusSilent (Qt::PartiallyChecked);
|
||||
}
|
||||
|
||||
|
||||
void GuiProgressView::tristateChanged(int state)
|
||||
void GuiProgressView::debugSelectionChanged()
|
||||
{
|
||||
if (state != Qt::PartiallyChecked) {
|
||||
Q_FOREACH(LevelButton* button, level_buttons) {
|
||||
button->setCheckStatusSilent(toggle_button->checkState());
|
||||
}
|
||||
int level = (state == Qt::Checked ? Debug::ANY : Debug::NONE);
|
||||
dispatch(FuncRequest(LFUN_DEBUG_LEVEL_SET, convert<string>(level)));
|
||||
} else {
|
||||
Q_FOREACH(LevelButton* button, checked_buttons) {
|
||||
button->setCheckStatusSilent(Qt::Checked);
|
||||
}
|
||||
int level = Debug::NONE;
|
||||
if (widget_->debugAnyRB->isChecked())
|
||||
level = Debug::ANY;
|
||||
else if (widget_->debugSelectedRB->isChecked()) {
|
||||
widget_->debugMessagesTW->setEnabled(true);
|
||||
levelChanged();
|
||||
return;
|
||||
}
|
||||
widget_->debugMessagesTW->setEnabled(false);
|
||||
dispatch(FuncRequest(LFUN_DEBUG_LEVEL_SET, convert<string>(level)));
|
||||
}
|
||||
|
||||
|
||||
@ -220,8 +225,6 @@ void GuiProgressView::hideEvent(QHideEvent*)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Dialog * createGuiProgressView(GuiView & guiview)
|
||||
{
|
||||
#ifdef Q_WS_MACX
|
||||
|
@ -34,8 +34,6 @@ class QShowEvent;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
struct LevelButton;
|
||||
|
||||
|
||||
class ProgressViewWidget : public QWidget, public Ui::ProgressViewUi
|
||||
{
|
||||
@ -76,19 +74,15 @@ private Q_SLOTS:
|
||||
void appendText(QString const & text);
|
||||
void appendLyXErrText(QString const & text);
|
||||
void clearText();
|
||||
|
||||
void levelChanged();
|
||||
void tristateChanged(int state);
|
||||
void debugMessageActivated(QTreeWidgetItem *, int);
|
||||
void debugSelectionChanged();
|
||||
|
||||
private:
|
||||
ProgressViewWidget * widget_;
|
||||
|
||||
void levelChanged();
|
||||
void showEvent(QShowEvent*);
|
||||
void hideEvent(QHideEvent*);
|
||||
|
||||
QList<LevelButton*> level_buttons;
|
||||
QList<LevelButton*> checked_buttons;
|
||||
LevelButton* toggle_button;
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,16 +12,14 @@
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<vsizetype>13</vsizetype>
|
||||
<hsizetype>7</hsizetype>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -67,9 +65,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="outTE">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<vsizetype>13</vsizetype>
|
||||
<hsizetype>7</hsizetype>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Ignored">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -100,58 +96,92 @@
|
||||
<attribute name="title">
|
||||
<string>Settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea" >
|
||||
<property name="widgetResizable" >
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="sbarCB">
|
||||
<property name="toolTip">
|
||||
<string>Display statusbar messages?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Statusbar messages</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>480</width>
|
||||
<height>474</height>
|
||||
</rect>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<widget class="QTreeWidget" name="debugMessagesTW">
|
||||
<property name="toolTip">
|
||||
<string>Select the debug messages that should be displayed</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4" >
|
||||
<item>
|
||||
<layout class="QGridLayout" name="settingsLayout" >
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Debug messages</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="debugNoneRB">
|
||||
<property name="toolTip">
|
||||
<string>Display no debug messages</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="debugSelectedRB">
|
||||
<property name="toolTip">
|
||||
<string>Display the debug messages selected to the right</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&elected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="debugAnyRB">
|
||||
<property name="toolTip">
|
||||
<string>Display all debug messages</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>187</width>
|
||||
<height>404</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="autoClearCB">
|
||||
<property name="toolTip">
|
||||
<string>Automatic cleanup of the window before LaTeX compilation proceeds</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Automatic clear</string>
|
||||
<string>&Clear automatically</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="sbarCB" >
|
||||
<property name="text" >
|
||||
<string>Statusbar messages</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>----- Debugging levels -----</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user