Skip to content

Commit

Permalink
More touch-ups 🍩
Browse files Browse the repository at this point in the history
- Hotfix for issue with collapsible panels, where panels beginning collapsed were not recorded as such and no default value for expansion was present
- Updated Readme with info about files
  • Loading branch information
fairybow committed Feb 20, 2023
1 parent 7f32110 commit e69e9da
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions Fernanda/docs/To-do.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
- [x] ~~Minify fountain CSS~~

### Splitter[^1]
- [ ] On open, if you drag to collapse a widget, it will expand to default instead of saved size (is there a way to determine the percentage open needed to mimic the saved state from qbytearray?)
- [ ] Increase trigger area, slightly beyond visible boundaries
- [ ] Preview handle should animate to the left and not right
- [ ] Add ability to hover mouse for length of time and activate collapse/expand
Expand Down
17 changes: 16 additions & 1 deletion Fernanda/src/Splitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void Splitter::loadConfig()
SplitterHandle* Splitter::createHandle()
{
auto handle = new SplitterHandle(orientation(), this);
connect(handle, &SplitterHandle::askIsInitialized, this, &Splitter::initialize);
connect(handle, &SplitterHandle::askStoreWidths, this, &Splitter::storeWidths);
connect(handle, &SplitterHandle::askToggleExpansion, this, &Splitter::toggleExpansion);
return handle;
Expand All @@ -106,7 +107,9 @@ void Splitter::expand(Info& widgetInfo)
widgetInfo.state = State::Expanded;
auto& handle_index = widgetInfo.handleIndex;
auto& stored_width = widgetInfo.width;
moveSplitter(((handle_index < 2) ? stored_width : (askWindowSize().width() - stored_width)), handle_index);
(widgetInfo.width < 1)
? moveSplitter(((handle_index < 2) ? (askWindowSize().width() * 0.2) : (askWindowSize().width() * 0.4)), handle_index)
: moveSplitter(((handle_index < 2) ? stored_width : (askWindowSize().width() - stored_width)), handle_index);
}

void Splitter::uncollapseAll()
Expand All @@ -121,6 +124,18 @@ void Splitter::uncollapseAll()
}
}

void Splitter::initialize()
{
if (isInitialized) return;
for (auto& widget_info : widgets)
{
if (widget_info.width) continue;
widget_info.state = State::Collapsed;
}
storeWidths();
isInitialized = true;
}

void Splitter::storeWidths()
{
for (auto& widget_info : widgets)
Expand Down
3 changes: 3 additions & 0 deletions Fernanda/src/Splitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ class Splitter : public QSplitter
Info preview = Info{ 2, 2 };
QVector<Info> widgets = { pane, editor, preview };

bool isInitialized = false;

void collapse(Info& widgetInfo);
void expand(Info& widgetInfo);
void uncollapseAll();

private slots:
void initialize();
void storeWidths();
void toggleExpansion(SplitterHandle* handlePointer);
void checkStates(int position, int index);
Expand Down
5 changes: 5 additions & 0 deletions Fernanda/src/SplitterHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class SplitterHandle : public QSplitterHandle
setFixedWidth(splitter()->handleWidth());
result = true;
break;
case QEvent::MouseButtonRelease:
askIsInitialized();
result = true;
break;
case QEvent::MouseButtonDblClick:
expanding->stop();
askStoreWidths();
Expand All @@ -69,6 +73,7 @@ class SplitterHandle : public QSplitterHandle
}

signals:
void askIsInitialized();
void askStoreWidths();
void askToggleExpansion(SplitterHandle* handlePointer);
};
Expand Down
1 change: 0 additions & 1 deletion Fernanda/src/StartCop.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class StartCop : public QObject
}

private slots:

void focusMainWindow()
{
for (auto& widget : QApplication::allWidgets())
Expand Down
4 changes: 2 additions & 2 deletions Fernanda/src/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

#pragma once

#define VER_FILEVERSION 0,24,1,50
#define VER_FILEVERSION_STR "v0.24.1-beta50"
#define VER_FILEVERSION 0,24,2,51
#define VER_FILEVERSION_STR "v0.24.2-beta51"
#define VER_PRODUCTVERSION VER_FILEVERSION
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
#define VER_COMPANYNAME_STR "@fairybow"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Solarized theme palettes by [@altercation](https://github.com/altercation/solari
**Samples:**
<a id="features-samples"></a>

A sample project, `Candide.story`, can be created from the `Help` menu, along with sample themes and a sample font.
A sample project, `Candide.story`, can be created from the `Help` menu, along with sample [themes](#features-themes) and a sample font.

---

Expand All @@ -151,7 +151,7 @@ A sample project, `Candide.story`, can be created from the `Help` menu, along wi
- They can also be opened with [7-zip](https://www.7-zip.org/), and the contents viewed and/or copied elsewhere
- Items deleted (cut) within Fernanda are moved to a `.cut` folder within the `.story` archive

If you want to manually rename, move, or delete items within a `.story` file via 7-zip, be sure to delete `story.xml`, too, so that it can be remade on next open. (You will lose any reorderings that are at the same directory level, as well as same-level, file-on-file parenting).
The Story files are, of course, meant to be opened and edited with Fernanda. However, if you need to, you can also access their content via 7-Zip. If you choose to manually rename, move, or delete items within a `.story` file outside Fernanda, be sure to delete `story.xml` (at the root), too, so that it can be remade on next open. (You will lose any reorderings that are at the same directory level, as well as same-level, file-on-file parenting).

---

Expand Down

0 comments on commit e69e9da

Please sign in to comment.