Option to display history in reverse order #150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Look at "Unsolved concern" section, there's a change may break current stable release.
close #149
QXT
NO_QXT
This code come with no Qxt library.
So every code wrapped inside
#ifndef
will compile and run.System tray menu data
qlippersystemtray.cpp
QlipperModel::clearHistory()
is atqlippermodel.cpp
.When clearing history, a sample clipboard item will created like this:
History is stored in
m_dynamic
, andbeginInsertRows
seems to be able to decide where to insert a clipboard item.System tray menu interface
qlippersystemtray.cpp
There is
m_shortcutMenu = new QMenuView();
, and related code to bind events.m_shortcutMenu->setModel(m_model);
tells the menu where to get data.m_model
is created bym_model = new QlipperModel(this);
How the data goes in system tray menu
qlippermodel.cpp
There are two types of data in system tray menu,
one is
m_sticky
and another ism_dynamic
.m_dynamic
is the list that stores copied data,m_sticky can be ignored right now.
The program is hard coded to put data on top of the list by use
m_dynamic.prepend(item);
, to reverse the order, change this code tom_sticky.append(item);
When it come to interface
In QCreator, double click to open
qlipperpreferencesdialog.ui
so "Check box" could be dragged from "Design" tab into setting interface.
UI is layout based, multiple checkbox could stay inside same line,
if thier width is smaller than certain amout.
Otherwise, force two wide checkbox into same line,
setting window width will increase.
Get interface value in code
"qlipperpreferences.h"
There is "bool clearItemsOnExit() const;",
write similar code aside to get user interface value.
Typically a checkbox definiation looks like:
To use the function, call from other place:
Old data
qlippermodel.cpp
When copy content same as exist value, it will picked from data list,
and put to top of the menu, then do font bold.
By doing test, I should put this data to end of the menu,
change bold position from
sticky_count + 1
to end of the menu.The variable to determine a font is bold or not seems to be
m_currentIndex
.The code to move data to top seems to be
The code use erase to remove range of element at once instead of one by one.
At the beginning, I guess this ensure that all old data will be deleted in signle event.
But later the code use
-1
to determine how many data to be removed.I should update exist code to use ranged remove,
but exist behavior is stable, best not to touch it.
Normal order:
Reverse order:
Move data
qlippermodel.cpp
The code with reverse order:
However, Qt API
beginMoveRows
seems to have a index start from 0,but the above code send
count
as parameter instead ofcount - 1
.If I use
count - 1
,endMoveRows()
will crash the program.I must assume that this code is based on
count
and have code hack in somewhere else.Bold it
qlippermodel.cpp
Look all references to
m_currentIndex
, one of them located atThis code not need to update.
To update it use
reverseOrder
:Unsolved concern
Debug mode save setting crash
An unknwon exception will crash the program when the code runs to
This crash only happens in Debug mode but not Release mode.
A quick fix to avoid this suggested by code AI: