Skip to content

Commit

Permalink
Merge pull request #1301 from davidlamhauge/issue1082_camera_overlay_…
Browse files Browse the repository at this point in the history
…system

Issue1082 camera overlay system
  • Loading branch information
candyface authored Mar 1, 2020
2 parents f3ce5d9 + 70ba9d5 commit 904486e
Show file tree
Hide file tree
Showing 25 changed files with 664 additions and 44 deletions.
8 changes: 8 additions & 0 deletions app/data/app.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
<file>icons/new/arrow-horizontal.png</file>
<file>icons/new/arrow-selectmove.png</file>
<file>icons/new/arrow-vertical.png</file>
<file>icons/overlayCenter.png</file>
<file>icons/overlayGoldenRatio.png</file>
<file>icons/overlaySafe.png</file>
<file>icons/overlayThirds.png</file>
<file>icons/overlay_center.png</file>
<file>icons/overlay_godenratio.png</file>
<file>icons/overlay_safe.png</file>
<file>icons/overlay_third.png</file>
</qresource>
<qresource prefix="/app">
<file>icons/onion-blue.png</file>
Expand Down
Binary file added app/data/icons/overlayCenter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlayGoldenRatio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlayGoldenRatio_org.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlaySafe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlaySafe_org.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlayThirds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlay_center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlay_godenratio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlay_safe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/icons/overlay_third.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions app/src/displayoptionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ void DisplayOptionWidget::makeConnections()
{
connect(ui->mirrorButton, &QToolButton::clicked, this, &DisplayOptionWidget::toggleMirror);
connect(ui->mirrorVButton, &QToolButton::clicked, this, &DisplayOptionWidget::toggleMirrorV);
connect(ui->overlayCenterButton, &QToolButton::clicked, this, &DisplayOptionWidget::toggleOverlayCenter);
connect(ui->overlayThirdsButton, &QToolButton::clicked, this, &DisplayOptionWidget::toggleOverlayThirds);
connect(ui->overlayGoldenRatioButton, &QToolButton::clicked, this, &DisplayOptionWidget::toggleOverlayGoldenRatio);
connect(ui->overlaySafeAreaButton, &QToolButton::clicked, this, &DisplayOptionWidget::toggleOverlaySafeAreas);

PreferenceManager* prefs = editor()->preference();
ScribbleArea* pScriArea = editor()->getScribbleArea();
Expand All @@ -80,6 +84,25 @@ void DisplayOptionWidget::updateUI()
SignalBlocker b2(ui->outLinesButton);
ui->outLinesButton->setChecked(prefs->isOn(SETTING::OUTLINES));

SignalBlocker b9(ui->overlayCenterButton);
ui->overlayCenterButton->setChecked(prefs->isOn(SETTING::OVERLAY_CENTER));

SignalBlocker b10(ui->overlayThirdsButton);
ui->overlayThirdsButton->setChecked(prefs->isOn(SETTING::OVERLAY_THIRDS));

SignalBlocker b11(ui->overlayGoldenRatioButton);
ui->overlayGoldenRatioButton->setChecked(prefs->isOn(SETTING::OVERLAY_GOLDEN));

SignalBlocker b12(ui->overlaySafeAreaButton);
ui->overlaySafeAreaButton->setChecked(prefs->isOn(SETTING::OVERLAY_SAFE));

if (prefs->isOn(SETTING::ACTION_SAFE_ON) || prefs->isOn(SETTING::TITLE_SAFE_ON))
{
ui->overlaySafeAreaButton->setEnabled(true);
} else {
ui->overlaySafeAreaButton->setEnabled(false);
}

ViewManager* view = editor()->view();

SignalBlocker b3(ui->mirrorButton);
Expand All @@ -98,3 +121,27 @@ void DisplayOptionWidget::toggleMirrorV(bool isOn)
{
editor()->view()->flipVertical(isOn);
}

void DisplayOptionWidget::toggleOverlayCenter(bool isOn)
{
editor()->view()->setOverlayCenter(isOn);
editor()->preference()->set(SETTING::OVERLAY_CENTER, isOn);
}

void DisplayOptionWidget::toggleOverlayThirds(bool isOn)
{
editor()->view()->setOverlayThirds(isOn);
editor()->preference()->set(SETTING::OVERLAY_THIRDS, isOn);
}

void DisplayOptionWidget::toggleOverlayGoldenRatio(bool isOn)
{
editor()->view()->setOverlayGoldenRatio(isOn);
editor()->preference()->set(SETTING::OVERLAY_GOLDEN, isOn);
}

void DisplayOptionWidget::toggleOverlaySafeAreas(bool isOn)
{
editor()->view()->setOverlaySafeAreas(isOn);
editor()->preference()->set(SETTING::OVERLAY_SAFE, isOn);
}
4 changes: 4 additions & 0 deletions app/src/displayoptionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class DisplayOptionWidget : public BaseDockWidget
private slots:
void toggleMirror(bool);
void toggleMirrorV(bool);
void toggleOverlayCenter(bool isOn);
void toggleOverlayThirds(bool isOn);
void toggleOverlayGoldenRatio(bool isOn);
void toggleOverlaySafeAreas(bool isOn);

private:
void makeConnections();
Expand Down
59 changes: 58 additions & 1 deletion app/src/preferencesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ GeneralPage::GeneralPage() : ui(new Ui::GeneralPage)
connect(ui->dottedCursorBox, &QCheckBox::stateChanged, this, &GeneralPage::dottedCursorCheckboxStateChanged);
connect(ui->gridSizeInputW, spinValueChanged, this, &GeneralPage::gridWidthChanged);
connect(ui->gridSizeInputH, spinValueChanged, this, &GeneralPage::gridHeightChanged);
connect(ui->actionSafeCheckBox, &QCheckBox::stateChanged, this, &GeneralPage::actionSafeCheckBoxStateChanged);
connect(ui->actionSafeInput, spinValueChanged, this, &GeneralPage::actionSafeAreaChanged);
connect(ui->titleSafeCheckBox, &QCheckBox::stateChanged, this, &GeneralPage::titleSafeCheckBoxStateChanged);
connect(ui->titleSafeInput, spinValueChanged, this, &GeneralPage::titleSafeAreaChanged);
connect(ui->safeHelperTextCheckbox, &QCheckBox::stateChanged, this, &GeneralPage::SafeAreaHelperTextCheckBoxStateChanged);
connect(ui->gridCheckBox, &QCheckBox::stateChanged, this, &GeneralPage::gridCheckBoxStateChanged);
connect(ui->framePoolSizeSpin, spinValueChanged, this, &GeneralPage::frameCacheNumberChanged);
}
Expand Down Expand Up @@ -198,6 +203,20 @@ void GeneralPage::updateValues()
ui->gridSizeInputH->setValue(mManager->getInt(SETTING::GRID_SIZE_H));
SignalBlocker b8(ui->gridCheckBox);
ui->gridCheckBox->setChecked(mManager->isOn(SETTING::GRID));
SignalBlocker b16(ui->actionSafeCheckBox);

bool actionSafeOn = mManager->isOn(SETTING::ACTION_SAFE_ON);
ui->actionSafeCheckBox->setChecked(actionSafeOn);
SignalBlocker b14(ui->actionSafeInput);
ui->actionSafeInput->setValue(mManager->getInt(SETTING::ACTION_SAFE));
SignalBlocker b17(ui->titleSafeCheckBox);
bool titleSafeOn = mManager->isOn(SETTING::TITLE_SAFE_ON);
ui->titleSafeCheckBox->setChecked(titleSafeOn);
SignalBlocker b15(ui->titleSafeInput);
ui->titleSafeInput->setValue(mManager->getInt(SETTING::TITLE_SAFE));

SignalBlocker b18(ui->safeHelperTextCheckbox);
ui->safeHelperTextCheckbox->setChecked(mManager->isOn(SETTING::OVERLAY_SAFE_HELPER_TEXT_ON));

SignalBlocker b9(ui->highResBox);
ui->highResBox->setChecked(mManager->isOn(SETTING::HIGH_RESOLUTION));
Expand Down Expand Up @@ -285,6 +304,44 @@ void GeneralPage::gridHeightChanged(int value)
mManager->set(SETTING::GRID_SIZE_H, value);
}

void GeneralPage::actionSafeCheckBoxStateChanged(int b)
{
mManager->set(SETTING::ACTION_SAFE_ON, b != Qt::Unchecked);
updateSafeHelperTextEnabledState();
}

void GeneralPage::actionSafeAreaChanged(int value)
{
mManager->set(SETTING::ACTION_SAFE, value);
}

void GeneralPage::titleSafeCheckBoxStateChanged(int b)
{
mManager->set(SETTING::TITLE_SAFE_ON, b != Qt::Unchecked);
updateSafeHelperTextEnabledState();
}

void GeneralPage::updateSafeHelperTextEnabledState()
{
if (ui->actionSafeCheckBox->isChecked() == false && ui->titleSafeCheckBox->isChecked() == false) {
ui->safeHelperTextCheckbox->setEnabled(false);
ui->labSafeHelperText->setEnabled(false);
} else {
ui->safeHelperTextCheckbox->setEnabled(true);
ui->labSafeHelperText->setEnabled(true);
}
}

void GeneralPage::SafeAreaHelperTextCheckBoxStateChanged(int b)
{
mManager->set(SETTING::OVERLAY_SAFE_HELPER_TEXT_ON, b != Qt::Unchecked);
}

void GeneralPage::titleSafeAreaChanged(int value)
{
mManager->set(SETTING::TITLE_SAFE, value);
}

void GeneralPage::gridCheckBoxStateChanged(int b)
{
mManager->set(SETTING::GRID, b != Qt::Unchecked);
Expand Down Expand Up @@ -460,7 +517,7 @@ void FilesPage::initPreset()
ui->presetListWidget->addItem(defaultItem);

bool ok = true;
for (const QString key : mPresetSettings->allKeys())
for (const QString& key : mPresetSettings->allKeys())
{
int index = key.toInt(&ok);
if (!ok || index == 0 || !mPresetDir.exists(QString("%1.pclx").arg(index))) continue;
Expand Down
8 changes: 8 additions & 0 deletions app/src/preferencesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public slots:
void updateValues();
void gridWidthChanged(int value);
void gridHeightChanged(int value);
void actionSafeCheckBoxStateChanged(int b);
void actionSafeAreaChanged(int value);
void titleSafeCheckBoxStateChanged(int b);
void titleSafeAreaChanged(int value);
void SafeAreaHelperTextCheckBoxStateChanged(int b);

signals:
void windowOpacityChange(int value);
Expand All @@ -94,6 +99,9 @@ private slots:
void frameCacheNumberChanged(int value);

private:

void updateSafeHelperTextEnabledState();

Ui::GeneralPage* ui = nullptr;
PreferenceManager* mManager = nullptr;
};
Expand Down
131 changes: 109 additions & 22 deletions app/ui/displayoption.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>156</width>
<height>140</height>
<width>204</width>
<height>204</height>
</rect>
</property>
<property name="windowTitle">
<string comment="Window title of display options like .">Display</string>
</property>
<widget class="QWidget" name="innerWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
Expand Down Expand Up @@ -64,7 +49,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="3">
<widget class="QToolButton" name="outLinesButton">
<property name="toolTip">
<string>Show outlines only</string>
Expand All @@ -90,7 +75,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QToolButton" name="thinLinesButton">
<property name="mouseTracking">
<bool>false</bool>
Expand Down Expand Up @@ -122,7 +107,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="1">
<widget class="QToolButton" name="mirrorVButton">
<property name="toolTip">
<string>Vertical flip</string>
Expand All @@ -148,6 +133,110 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="overlayCenterButton">
<property name="toolTip">
<string>Overlay shows field center</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../data/app.qrc">
<normaloff>:/icons/overlay_center.png</normaloff>:/icons/overlay_center.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="overlayThirdsButton">
<property name="toolTip">
<string>Overlay shows field in thirds</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../data/app.qrc">
<normaloff>:/icons/overlay_third.png</normaloff>:/icons/overlay_third.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="overlayGoldenRatioButton">
<property name="toolTip">
<string>Overlay shows field in Golden Ratio</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../data/app.qrc">
<normaloff>:/icons/overlay_godenratio.png</normaloff>:/icons/overlay_godenratio.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="overlaySafeAreaButton">
<property name="toolTip">
<string>Overlay shows field safe areas</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../data/app.qrc">
<normaloff>:/icons/overlay_safe.png</normaloff>:/icons/overlay_safe.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand All @@ -169,8 +258,6 @@
<tabstops>
<tabstop>mirrorButton</tabstop>
<tabstop>thinLinesButton</tabstop>
<tabstop>mirrorVButton</tabstop>
<tabstop>outLinesButton</tabstop>
</tabstops>
<resources>
<include location="../data/app.qrc"/>
Expand Down
Loading

0 comments on commit 904486e

Please sign in to comment.