|
GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
|
#include <Widget.h>
Inheritance diagram for GCW::Gui::AccountRegister::Widget:Public Types | |
| using | BaseModel = Model |
| Model. | |
| using | SortFilterModel = Wt::WSortFilterProxyModel |
| using | BatchEditModel = Wt::WBatchEditProxyModel |
Public Types inherited from Wt::WObject | |
| typedef void(WObject::* | Method) () |
Public Member Functions | |
| Widget () | |
| Constructor. | |
| auto | setAccountGuid (const std::string &_accountGuid) -> void |
| Set Account. | |
| auto | setDoubleLine (bool _state) -> void |
| auto | tableView () -> GCW::Gui::TableView * |
| Table View. | |
| auto | baseModel () -> std::shared_ptr< BaseModel > |
| auto | sortFilterModel () -> std::shared_ptr< SortFilterModel > |
| auto | batchEditModel () -> std::shared_ptr< BatchEditModel > |
| auto | statusBar () -> StatusBar * |
| Status Bar. | |
| auto | test () -> void |
| auto | setReadOnly (bool _state=true) -> void |
| Set Read Only. | |
| auto | jumpToAccount () -> Wt::Signal< std::string > & |
| Signal JumpToAccount. | |
| auto | selectSplit (const std::string &_guid) -> void |
| Select Split. | |
| auto | toJson () const -> Wt::Json::Object |
| Create View Properties JSON Object. | |
| auto | fromJson (const Wt::Json::Object &_jobj) -> bool |
| Set View Properties from JSON Object. | |
Public Member Functions inherited from Wt::WContainerWidget | |
| WContainerWidget () | |
| ~WContainerWidget () | |
| void | setLayout (std::unique_ptr< WLayout > layout) |
| Layout * | setLayout (std::unique_ptr< Layout > layout) |
| WLayout * | layout () const |
| virtual void | addWidget (std::unique_ptr< WWidget > widget) |
| Widget * | addWidget (std::unique_ptr< Widget > widget) |
| Widget * | addNew (Args &&...args) |
| virtual void | insertBefore (std::unique_ptr< WWidget > widget, WWidget *before) |
| Widget * | insertBefore (std::unique_ptr< Widget > widget, WWidget *before) |
| virtual void | insertWidget (int index, std::unique_ptr< WWidget > widget) |
| Widget * | insertWidget (int index, std::unique_ptr< Widget > widget) |
| Widget * | insertNew (int index, Args &&...args) |
| virtual std::unique_ptr< WWidget > | removeWidget (WWidget *widget) override |
| virtual void | clear () |
| virtual int | indexOf (WWidget *widget) const |
| virtual WWidget * | widget (int index) const |
| virtual int | count () const |
| void | setContentAlignment (WFlags< AlignmentFlag > contentAlignment) |
| void | setPadding (const WLength &padding, WFlags< Side > sides=AllSides) |
| WLength | padding (Side side) const |
| WFlags< AlignmentFlag > | contentAlignment () const |
| void | setOverflow (Overflow overflow, WFlags< Orientation > orientation=(Orientation::Horizontal|Orientation::Vertical)) |
| void | setList (bool list, bool ordered=false) |
| bool | isList () const |
| bool | isUnorderedList () const |
| bool | isOrderedList () const |
| EventSignal< WScrollEvent > & | scrolled () |
| int | scrollTop () const |
| int | scrollLeft () const |
| virtual std::unique_ptr< WWidget > | removeWidget (WWidget *widget) |
| std::unique_ptr< Widget > | removeWidget (Widget *widget) |
Public Member Functions inherited from Wt::WInteractWidget | |
| WInteractWidget () | |
| EventSignal< WKeyEvent > & | keyWentDown () |
| EventSignal< WKeyEvent > & | keyPressed () |
| EventSignal< WKeyEvent > & | keyWentUp () |
| EventSignal & | enterPressed () |
| EventSignal & | escapePressed () |
| EventSignal< WMouseEvent > & | clicked () |
| EventSignal< WMouseEvent > & | doubleClicked () |
| EventSignal< WMouseEvent > & | mouseWentDown () |
| EventSignal< WMouseEvent > & | mouseWentUp () |
| EventSignal< WMouseEvent > & | mouseWentOut () |
| EventSignal< WMouseEvent > & | mouseWentOver () |
| EventSignal< WMouseEvent > & | mouseMoved () |
| EventSignal< WMouseEvent > & | mouseDragged () |
| EventSignal< WMouseEvent > & | mouseWheel () |
| EventSignal< WTouchEvent > & | touchStarted () |
| EventSignal< WTouchEvent > & | touchEnded () |
| EventSignal< WTouchEvent > & | touchMoved () |
| EventSignal< WGestureEvent > & | gestureStarted () |
| EventSignal< WGestureEvent > & | gestureChanged () |
| EventSignal< WGestureEvent > & | gestureEnded () |
| void | setDraggable (const std::string &mimeType, WWidget *dragWidget=nullptr, bool isDragWidgetOnly=false, WObject *sourceWidget=nullptr) |
| void | unsetDraggable () |
| void | setMouseOverDelay (int delay) |
| int | mouseOverDelay () const |
| virtual void | setPopup (bool popup) override |
| virtual void | load () override |
| virtual bool | isEnabled () const override |
Public Member Functions inherited from Wt::WWebWidget | |
| WWebWidget () | |
| virtual std::vector< WWidget * > | children () const override |
| Signal & | childrenChanged () |
| virtual void | setPositionScheme (PositionScheme scheme) override |
| virtual PositionScheme | positionScheme () const override |
| virtual void | setOffsets (const WLength &offset, WFlags< Side > sides=AllSides) override |
| virtual WLength | offset (Side s) const override |
| virtual void | resize (const WLength &width, const WLength &height) override |
| virtual WLength | width () const override |
| virtual WLength | height () const override |
| virtual void | setMinimumSize (const WLength &width, const WLength &height) override |
| virtual WLength | minimumWidth () const override |
| virtual WLength | minimumHeight () const override |
| virtual void | setMaximumSize (const WLength &width, const WLength &height) override |
| virtual WLength | maximumWidth () const override |
| virtual WLength | maximumHeight () const override |
| virtual void | setLineHeight (const WLength &height) override |
| virtual WLength | lineHeight () const override |
| virtual void | setFloatSide (Side s) override |
| virtual Side | floatSide () const override |
| virtual void | setClearSides (WFlags< Side > sides) override |
| virtual WFlags< Side > | clearSides () const override |
| virtual void | setMargin (const WLength &margin, WFlags< Side > sides=AllSides) override |
| virtual WLength | margin (Side side) const override |
| virtual void | setHiddenKeepsGeometry (bool enabled) override |
| virtual bool | hiddenKeepsGeometry () const override |
| virtual void | setHidden (bool hidden, const WAnimation &animation=WAnimation()) override |
| virtual bool | isHidden () const override |
| virtual bool | isVisible () const override |
| virtual void | setDisabled (bool disabled) override |
| virtual bool | isDisabled () const override |
| virtual bool | isPopup () const override |
| virtual void | setInline (bool isInline) override |
| virtual bool | isInline () const override |
| virtual void | setDecorationStyle (const WCssDecorationStyle &style) override |
| virtual WCssDecorationStyle & | decorationStyle () override |
| virtual void | setStyleClass (const WString &styleClass) override |
| virtual WString | styleClass () const override |
| virtual void | addStyleClass (const WString &styleClass, bool force=false) override |
| virtual void | removeStyleClass (const WString &styleClass, bool force=false) override |
| virtual bool | hasStyleClass (const WString &styleClass) const override |
| virtual void | setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength()) override |
| virtual AlignmentFlag | verticalAlignment () const override |
| virtual WLength | verticalAlignmentLength () const override |
| virtual void | setToolTip (const WString &text, TextFormat textFormat=TextFormat::Plain) override |
| virtual void | setDeferredToolTip (bool enable, TextFormat textFormat=TextFormat::Plain) override |
| virtual WString | toolTip () const override |
| virtual void | refresh () override |
| virtual void | setAttributeValue (const std::string &name, const WString &value) override |
| virtual WString | attributeValue (const std::string &name) const override |
| virtual void | setJavaScriptMember (const std::string &name, const std::string &value) override |
| virtual std::string | javaScriptMember (const std::string &name) const override |
| virtual void | callJavaScriptMember (const std::string &name, const std::string &args) override |
| virtual bool | loaded () const override |
| virtual void | setId (const std::string &id) override |
| virtual WWidget * | find (const std::string &name) override |
| virtual WWidget * | findById (const std::string &id) override |
| virtual void | setSelectable (bool selectable) override |
| virtual void | doJavaScript (const std::string &javascript) override |
| virtual const std::string | id () const override |
| void | setLoadLaterWhenInvisible (bool) |
| std::string | htmlTagName () const |
| void | setHtmlTagName (const std::string &tag) |
| virtual void | setCanReceiveFocus (bool enabled) override |
| virtual bool | canReceiveFocus () const override |
| virtual bool | setFirstFocus () override |
| virtual void | setFocus (bool focus) override |
| virtual bool | hasFocus () const override |
| virtual void | setTabIndex (int index) override |
| virtual int | tabIndex () const override |
| EventSignal & | blurred () |
| EventSignal & | focussed () |
| virtual bool | scrollVisibilityEnabled () const final override |
| virtual void | setScrollVisibilityEnabled (bool enabled) final override |
| virtual int | scrollVisibilityMargin () const final override |
| virtual void | setScrollVisibilityMargin (int margin) final override |
| virtual Signal< bool > & | scrollVisibilityChanged () final override |
| virtual bool | isScrollVisible () const final override |
| virtual void | setThemeStyleEnabled (bool enabled) final override |
| virtual bool | isThemeStyleEnabled () const final override |
| virtual void | setObjectName (const std::string &name) override |
| void | setFocus () |
| virtual void | setFocus (bool focus)=0 |
Public Member Functions inherited from Wt::WWidget | |
| virtual | ~WWidget () |
| WWidget * | parent () const |
| std::unique_ptr< Widget > | removeWidget (Widget *widget) |
| std::unique_ptr< WWidget > | removeFromParent () |
| void | setWidth (const WLength &width) |
| void | setHeight (const WLength &height) |
| virtual void | positionAt (const WWidget *widget, Orientation orientation=Orientation::Vertical) |
| virtual void | toggleStyleClass (const WString &styleClass, bool add, bool force=false) |
| std::string | jsRef () const |
| void | setFocus () |
| virtual void | acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString()) |
| virtual void | stopAcceptDrops (const std::string &mimeType) |
| virtual void | htmlText (std::ostream &out) |
| bool | isRendered () const |
| void | hide () |
| void | animateHide (const WAnimation &animation) |
| void | show () |
| void | animateShow (const WAnimation &animation) |
| void | enable () |
| void | disable () |
| bool | layoutSizeAware () const |
Public Member Functions inherited from Wt::WObject | |
| void | addChild (std::unique_ptr< WObject > child) |
| Child * | addChild (std::unique_ptr< Child > child) |
| std::unique_ptr< WObject > | removeChild (WObject *child) |
| std::unique_ptr< Child > | removeChild (Child *child) |
| virtual std::string | objectName () const |
| void | resetLearnedSlots () |
| void | resetLearnedSlot (void(T::*method)()) |
| WStatelessSlot * | implementStateless (void(T::*method)()) |
| WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
| void | isNotStateless () |
| WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Public Member Functions inherited from Wt::Core::observable | |
| observable () noexcept | |
| virtual | ~observable () |
| auto | bindSafe (void(C::*method)(Args...)) noexcept |
| auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
| auto | bindSafe (const Function &function) noexcept |
Private Attributes | |
| Wt::WPopupMenu | m_popupMenu |
| std::string | m_accountGuid |
| std::shared_ptr< BaseModel > | m_baseModel |
| std::shared_ptr< Wt::WSortFilterProxyModel > | m_sortFilterModel |
| std::shared_ptr< Wt::WBatchEditProxyModel > | m_batchEditModel |
| GCW::Gui::TableView * | m_tableView = nullptr |
| StatusBar * | m_statusBar = nullptr |
| ToolBar * | m_toolBar = nullptr |
| Wt::WModelIndex | m_selectIndex |
| Wt::WModelIndex | m_clickedIndex |
| Wt::WModelIndex | m_rightClickIndex |
| Wt::Signal< std::string > | m_jumpToAccount |
Additional Inherited Members | |
Static Public Member Functions inherited from Wt::WWebWidget | |
| static std::string | jsStringLiteral (const std::string &v, char delimiter='\'') |
Static Public Member Functions inherited from Wt::WWidget | |
| static WString | tr (const char *key) |
Protected Member Functions inherited from Wt::WInteractWidget | |
| virtual void | propagateSetEnabled (bool enabled) override |
Protected Member Functions inherited from Wt::WWebWidget | |
| virtual void | enableAjax () override |
| virtual WStatelessSlot * | getStateless (Method method) override |
| virtual void | render (WFlags< RenderFlag > flags) override |
Protected Member Functions inherited from Wt::WWidget | |
| void | setLayoutSizeAware (bool sizeAware) |
| virtual void | layoutSizeChanged (int width, int height) |
| WWidget () | |
| virtual void | dropEvent (WDropEvent dropEvent) |
| virtual int | boxPadding (Orientation orientation) const |
| virtual int | boxBorder (Orientation orientation) const |
| void | scheduleRender (WFlags< RepaintFlag > flags=None) |
The AccountRegister is a widget that displays transactions from a single account within the system. It displays the account transactions in a spreadsheet-table-like format with multiple columns representing other field values such as; date, check-number, description... and so on.
The goal here is to make this widget behave just as closely as possible to the GnuCash interface, because gnucash is very slick and makes navigating the register a no-mouse-necessary affair. One of the problems with web-based interfaces, however, is trapping keys completely, such as the ~tab~ key. So... we'll see how this goes!
The register view also grants the user editing abilities. When the user clicks on fields that are ~not~ reconciled, and appropriate 'editor' will open. The editor depends on the column selected, and is generated by the column Delegates.
| GCW::Gui::AccountRegister::Widget::Widget | ( | ) |
Definition at line 91 of file Widget.h.
References m_baseModel.
|
inline |
Definition at line 93 of file Widget.h.
References m_batchEditModel.
Delete Row.
This Deletes a row based on it's row number.
Definition at line 191 of file Widget.cpp.
|
private |
Select Row.
This selects the row based on it's row number.
Definition at line 677 of file Widget.cpp.
|
private |
Edit Row.
This edits the row based on it's row number.
Definition at line 726 of file Widget.cpp.
References GCW::Gui::AccountRegister::Editor::editRow().
| auto GCW::Gui::AccountRegister::Widget::fromJson | ( | const Wt::Json::Object & | _jobj | ) | -> bool |
Set View Properties from JSON Object.
This accepts a JSON object containing all of the view properties and applys them to the view, essentially restoring it to its previous layout.
Definition at line 754 of file Widget.cpp.
Internal Initializer.
This takes care of all the basic initialization stuff.
Definition at line 25 of file Widget.cpp.
References Wt::WKeyEvent::charCode().
Referenced by Widget().
|
inline |
Signal JumpToAccount.
This signals when the user has clicked on the jump to account menu option.
Definition at line 117 of file Widget.h.
References m_jumpToAccount.
|
private |
Editor Helper.
Load the Data
This loads all of the transactions in to the register.
Definition at line 615 of file Widget.cpp.
References GCW::Gui::AccountRegister::ACTION, GCW::Gui::AccountRegister::asInt(), GCW::Gui::AccountRegister::BALANCE, GCW::Gui::AccountRegister::CREDIT, GCW::Gui::AccountRegister::DATE, GCW::Gui::AccountRegister::DEBIT, GCW::Gui::AccountRegister::DESCRIPTION, GCW::Gui::AccountRegister::RECONCILE, and GCW::Gui::AccountRegister::TRANSFER.
Assign Payment.
This allows the transaction to be assigned as a payment to an invoice
Definition at line 442 of file Widget.cpp.
Blank Transaction.
This will blank all the values in a transaction
Definition at line 370 of file Widget.cpp.
Cancel Transaction.
This will cancel the edits on the transaction. This would be the same if the user hit the <esc> key
Definition at line 345 of file Widget.cpp.
Delete a Row.
This will delete a row from the register
by default, the user will be asked to delete an item from the register, unless they have chosen to never be asked.
Definition at line 239 of file Widget.cpp.
References Wt::WDialog::accept(), GCW::Dbo::Prefrences::get(), Wt::WDialog::reject(), and TR.
Referenced by on_showPopup_triggered().
Definition at line 231 of file Widget.cpp.
Edit to Transaction.
This will Edit to the other side of the transaction
Definition at line 434 of file Widget.cpp.
Edit Exchange Rate.
This will edit the exchange rate on the transaction
Definition at line 394 of file Widget.cpp.
Enter Transaction.
This will enter the transaction, just like if the user hit the ENTER key
Definition at line 337 of file Widget.cpp.
Definition at line 215 of file Widget.cpp.
Go to Date.
This will jump to a specific date within the register view
Definition at line 378 of file Widget.cpp.
Jump to Transaction.
This will jump to the other side of the transaction
This function will emit the guid of the account of the 'other' split used in this transaction. But, a transaction may contain multiple splits. In that instance, this jump routine should make some different decisions about where to jump. In gnucash, it indicates that the jump will jump to the 'highest value' split... that could work.
Definition at line 410 of file Widget.cpp.
Referenced by on_showPopup_triggered().
Manage Document.
This opens a dialog that allows the user to attach a document to the transaction
Definition at line 353 of file Widget.cpp.
Open Document.
This allows the user to open the document attached to the transaction
Definition at line 362 of file Widget.cpp.
Remove Splits.
This will remove the splits from the transaction
Definition at line 329 of file Widget.cpp.
Definition at line 223 of file Widget.cpp.
Schedule a Transaction.
This will set up a scheduled transaction
Definition at line 402 of file Widget.cpp.
|
private |
Show Popup.
This responds to a mouse-right-click within the table view. When triggered, this will pop-up an environment-sensitive menu that the user can choose actions from. The context sensitivity is driven by the type of item that is on the row that the cursor was on with the click event was triggered.
Definition at line 450 of file Widget.cpp.
References on_delete_triggered(), on_jump_triggered(), and TR.
Definition at line 207 of file Widget.cpp.
Split Transaction.
This will split the current transaction
Definition at line 386 of file Widget.cpp.
|
private |
Clicked Handler.
This captures clicks within the table view
Definition at line 161 of file Widget.cpp.
Select Split.
Definition at line 709 of file Widget.cpp.
Set Account.
This sets the GUD of the account being represented by this view
Definition at line 572 of file Widget.cpp.
Definition at line 591 of file Widget.cpp.
|
inline |
Definition at line 92 of file Widget.h.
References m_sortFilterModel.
Status Bar.
This returns a pointer to the status bar
Definition at line 100 of file Widget.h.
References m_statusBar.
|
inline |
Definition at line 763 of file Widget.cpp.
| auto GCW::Gui::AccountRegister::Widget::toJson | ( | ) | const -> Wt::Json::Object |
Create View Properties JSON Object.
This will pack all of the Widget display variables in to a JSON object for restoration later.
Definition at line 745 of file Widget.cpp.
|
private |
|
private |
Definition at line 325 of file Widget.h.
Referenced by baseModel().
|
private |
Definition at line 327 of file Widget.h.
Referenced by batchEditModel().
|
private |
|
private |
Definition at line 334 of file Widget.h.
Referenced by jumpToAccount().
|
private |
|
private |
|
private |
|
private |
Definition at line 326 of file Widget.h.
Referenced by sortFilterModel().
Definition at line 329 of file Widget.h.
Referenced by statusBar().
|
private |
Definition at line 328 of file Widget.h.
Referenced by tableView().