Skip to content

Commit 84451e6

Browse files
committed
Review changes
1 parent b11c06c commit 84451e6

File tree

8 files changed

+19
-21
lines changed

8 files changed

+19
-21
lines changed

src/appleseed.studio/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ source_group ("mainwindow\\project" FILES
218218
)
219219

220220
set (mainwindow_pythonconsole_sources
221-
mainwindow/pythonconsole/fontsizechangeable.cpp
222-
mainwindow/pythonconsole/fontsizechangeable.h
223221
mainwindow/pythonconsole/linenumberarea.cpp
224222
mainwindow/pythonconsole/linenumberarea.h
225223
mainwindow/pythonconsole/outputredirector.cpp
@@ -232,6 +230,8 @@ set (mainwindow_pythonconsole_sources
232230
mainwindow/pythonconsole/pythonhighlighter.h
233231
mainwindow/pythonconsole/pythonoutput.cpp
234232
mainwindow/pythonconsole/pythonoutput.h
233+
mainwindow/pythonconsole/zoomableplaintextedit.cpp
234+
mainwindow/pythonconsole/zoomableplaintextedit.h
235235
)
236236
list (APPEND appleseed.studio_sources
237237
${mainwindow_pythonconsole_sources}

src/appleseed.studio/mainwindow/pythonconsole/pythonconsolewidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ PythonConsoleWidget::PythonConsoleWidget(QWidget* parent)
7676

7777
m_output = new PythonOutput(console_body);
7878

79-
console_body->addWidget(m_input);
8079
console_body->addWidget(m_output);
80+
console_body->addWidget(m_input);
8181

8282
m_action_new_file =
8383
new QAction(load_icons("project_new"), "New Python Script", this);
@@ -193,7 +193,7 @@ void PythonConsoleWidget::slot_clear_output()
193193

194194
void PythonConsoleWidget::slot_change_exec_selection_button_state()
195195
{
196-
bool is_enabled = m_input->textCursor().selection().isEmpty();
196+
const bool is_enabled = m_input->textCursor().selection().isEmpty();
197197
m_action_execute_selection->setEnabled(is_enabled);
198198
}
199199

src/appleseed.studio/mainwindow/pythonconsole/pythoneditor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace appleseed {
4444
namespace studio {
4545

4646
PythonEditor::PythonEditor(QWidget* parent)
47-
: FontSizeChangeable(parent)
47+
: ZoomablePlainTextEdit(parent)
4848
{
4949
setObjectName("python_editor");
5050
setUndoRedoEnabled(true);
@@ -80,7 +80,7 @@ void PythonEditor::keyPressEvent(QKeyEvent* event)
8080
{
8181
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
8282
event->setModifiers(event->modifiers() & ~Qt::ShiftModifier);
83-
FontSizeChangeable::keyPressEvent(event);
83+
ZoomablePlainTextEdit::keyPressEvent(event);
8484
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
8585
indent();
8686
}

src/appleseed.studio/mainwindow/pythonconsole/pythoneditor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define APPLESEED_STUDIO_MAINWINDOW_PYTHONCONSOLE_PYTHONEDITOR_H
3131

3232
// appleseed.studio headers.
33-
#include "mainwindow/pythonconsole/fontsizechangeable.h"
33+
#include "mainwindow/pythonconsole/zoomableplaintextedit.h"
3434

3535
// Qt headers.
3636
#include <QObject>
@@ -48,7 +48,7 @@ namespace appleseed {
4848
namespace studio {
4949

5050
class PythonEditor
51-
: public FontSizeChangeable
51+
: public ZoomablePlainTextEdit
5252
{
5353
Q_OBJECT
5454

src/appleseed.studio/mainwindow/pythonconsole/pythonoutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace appleseed {
3333
namespace studio {
3434

3535
PythonOutput::PythonOutput(QWidget* parent)
36-
: FontSizeChangeable(parent)
36+
: ZoomablePlainTextEdit(parent)
3737
{
3838
setObjectName("python_output");
3939
setUndoRedoEnabled(false);

src/appleseed.studio/mainwindow/pythonconsole/pythonoutput.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define APPLESEED_STUDIO_MAINWINDOW_PYTHONCONSOLE_PYTHONOUTPUT_H
3131

3232
// appleseed.studio headers.
33-
#include "mainwindow/pythonconsole/fontsizechangeable.h"
33+
#include "mainwindow/pythonconsole/zoomableplaintextedit.h"
3434

3535
// Qt headers.
3636
#include <QObject>
@@ -43,7 +43,7 @@ namespace appleseed {
4343
namespace studio {
4444

4545
class PythonOutput
46-
: public FontSizeChangeable
46+
: public ZoomablePlainTextEdit
4747
{
4848
Q_OBJECT
4949

src/appleseed.studio/mainwindow/pythonconsole/fontsizechangeable.cpp renamed to src/appleseed.studio/mainwindow/pythonconsole/zoomableplaintextedit.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
//
2828

2929
// Interface header.
30-
#include "fontsizechangeable.h"
30+
#include "zoomableplaintextedit.h"
3131

3232
namespace appleseed {
3333
namespace studio {
3434

35-
FontSizeChangeable::FontSizeChangeable(QWidget* parent)
35+
ZoomablePlainTextEdit::ZoomablePlainTextEdit(QWidget* parent)
3636
: QPlainTextEdit(parent)
3737
{
3838
}
3939

40-
void FontSizeChangeable::keyPressEvent(QKeyEvent* event)
40+
void ZoomablePlainTextEdit::keyPressEvent(QKeyEvent* event)
4141
{
4242
if (event->modifiers() & Qt::ControlModifier &&
4343
(event->key() == Qt::Key_Plus || event->key() == Qt::Key_Equal))
@@ -50,17 +50,15 @@ void FontSizeChangeable::keyPressEvent(QKeyEvent* event)
5050
QPlainTextEdit::keyPressEvent(event);
5151
}
5252

53-
void FontSizeChangeable::wheelEvent(QWheelEvent* event)
53+
void ZoomablePlainTextEdit::wheelEvent(QWheelEvent* event)
5454
{
5555
if (event->modifiers() & Qt::ControlModifier)
56-
// Minus here because if you turn wheel up delta is negative
57-
// while font should be incremented.
58-
change_font_size(- event->delta() / 120);
56+
change_font_size(event->delta() / 120);
5957
else
6058
QPlainTextEdit::wheelEvent(event);
6159
}
6260

63-
void FontSizeChangeable::change_font_size(const int delta)
61+
void ZoomablePlainTextEdit::change_font_size(const int delta)
6462
{
6563
int new_font_size = font().pointSize() + delta;
6664
QFont new_font = font();

src/appleseed.studio/mainwindow/pythonconsole/fontsizechangeable.h renamed to src/appleseed.studio/mainwindow/pythonconsole/zoomableplaintextedit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
namespace appleseed {
3737
namespace studio {
3838

39-
class FontSizeChangeable
39+
class ZoomablePlainTextEdit
4040
: public QPlainTextEdit
4141
{
4242
Q_OBJECT
4343

4444
public:
45-
FontSizeChangeable(QWidget* parent);
45+
ZoomablePlainTextEdit(QWidget* parent);
4646

4747
protected:
4848
void keyPressEvent(QKeyEvent* event);

0 commit comments

Comments
 (0)