Skip to content

Commit

Permalink
Add support for outlined answers.
Browse files Browse the repository at this point in the history
  • Loading branch information
openforeveryone committed May 7, 2024
1 parent e7a6a2e commit 3acd229
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 108 deletions.
205 changes: 120 additions & 85 deletions appearance.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>445</width>
<height>291</height>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -16,7 +16,16 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
Expand Down Expand Up @@ -184,15 +193,33 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand All @@ -215,13 +242,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="gridColorButton">
<property name="text">
<string>Set Colour...</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
Expand All @@ -242,88 +262,103 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="gridColorButton">
<property name="text">
<string>Colour...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Background:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>248</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="bgcolorButton">
<property name="text">
<string>Colour...</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Background:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>248</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="bgcolorButton">
<property name="text">
<string>Colour...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Highlight:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>248</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="hlcolorButton">
<property name="text">
<string>Colour...</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Highlight:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>248</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Style:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="solidRadioButton">
<property name="text">
<string>Solid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="outlineRadioButton">
<property name="text">
<string>Outline</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="hlcolorButton">
<property name="text">
<string>Colour...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
Expand Down
4 changes: 3 additions & 1 deletion appearancedialog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2006-2023 M Wellings *
* Copyright (C) 2006-2024 M Wellings *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -72,6 +72,7 @@ void appearanceDialog::setDoc(WordSearchDoc *wsd)
gridWidth=wsd->getGridWidth();
gridlinewidthSpinBox->setValue(gridWidth);
showGridCheckBox->setChecked(wsd->getShowGrid());
outlineRadioButton->setChecked(!wsd->getHLSolid());
}

QString appearanceDialog::fontstring(QFont font)
Expand Down Expand Up @@ -179,6 +180,7 @@ void appearanceDialog::okPressed()
wsd->setWordsColor(wlColor);
wsd->setBgColor(bgColor);
wsd->setHlColor(hlColor);
wsd->setHlSolid(solidRadioButton->isChecked());
wsd->setGridColor(gridColor);
wsd->setGridWidth(gridWidth);
wsd->setShowGrid(showGridCheckBox->isChecked());
Expand Down
5 changes: 4 additions & 1 deletion wordsearchdoc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2006-2023 M Wellings *
* Copyright (C) 2006-2024 M Wellings *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -47,6 +47,7 @@ WordSearchDoc::WordSearchDoc(QWidget *parent)
wordlistorder=UserDefined;
bgColor=Qt::white;
hlColor=Qt::blue;
hlSolid=true;
}

void WordSearchDoc::Create()
Expand Down Expand Up @@ -417,6 +418,7 @@ int WordSearchDoc::OpenFromIO(QIODevice &file)
setBgColor(BGColor);
QColor HLColor;
HLColor.setNamedColor(DEFormat.firstChildElement("Highlight").attribute("color", "blue"));
setHlSolid(DEFormat.firstChildElement("Highlight").attribute("style", "solid")!="outline");
setHlColor(HLColor);
setShowGrid((DEFormat.firstChildElement("Grid").attribute("Visible","yes").toLower() == "yes" || wordsearch.attribute("Visible","yes").toLower() =="true"));
QColor GridColor;
Expand Down Expand Up @@ -616,6 +618,7 @@ bool WordSearchDoc::saveToIO(QIODevice &file){
QDomElement DEHighlight = doc.createElement("Highlight");
DEFormat.appendChild(DEHighlight);
DEHighlight.setAttribute( "color", getHLColor().name());
DEHighlight.setAttribute( "style", getHLSolid() ? "solid" : "outline");

QDomElement DEAllowedDirections = doc.createElement("AllowedDirections");
wordsearch.appendChild(DEAllowedDirections);
Expand Down
7 changes: 5 additions & 2 deletions wordsearchdoc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2006-2023 M Wellings *
* Copyright (C) 2006-2024 M Wellings *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -45,7 +45,8 @@ class WordSearchDoc : public QObject
QFont getWordsFont();
QFont getCLFont();
QColor getBGColor() {return bgColor;}
QColor getHLColor() {return hlColor;}
QColor getHLColor() {return hlColor;}
bool getHLSolid() {return hlSolid;}
QColor getWSColor() {return wsColor;}
QColor getTitleColor() {return titleColor;}
QColor getWLColor() {return wlColor;}
Expand Down Expand Up @@ -79,6 +80,7 @@ class WordSearchDoc : public QObject
QFont WordsFont;
QColor bgColor;
QColor hlColor;
bool hlSolid;
QColor titleColor;
QColor wsColor;
QColor wlColor;
Expand Down Expand Up @@ -115,6 +117,7 @@ public slots:
void setWordsColor(QColor wlColor) {this->wlColor = wlColor;}
void setBgColor(QColor bgColor) {this->bgColor = bgColor;}
void setHlColor(QColor hlColor) {this->hlColor = hlColor;}
void setHlSolid(bool hlSolid) {this->hlSolid = hlSolid;}
void setGridColor(QColor gridColor) {this->gridColor = gridColor;}
void setGridWidth(double gridWidth) {this->gridWidth = gridWidth;}
void setSize(int x, int y);
Expand Down
Loading

0 comments on commit 3acd229

Please sign in to comment.