|
| 1 | +## Commands |
| 2 | + |
| 3 | +Always use the following environment variables for all `build/copyq` and |
| 4 | +`build/copyq-tests` commands: |
| 5 | + |
| 6 | + export COPYQ_SESSION_NAME="test" |
| 7 | + export COPYQ_SETTINGS_PATH="build/copyq-test-conf" |
| 8 | + export COPYQ_ITEM_DATA_PATH="build/copyq-test-data" |
| 9 | + export COPYQ_PLUGINS="" |
| 10 | + export COPYQ_DEFAULT_ICON="1" |
| 11 | + export COPYQ_SESSION_COLOR="#f90" |
| 12 | + export COPYQ_THEME_PREFIX="$PWD/shared/themes" |
| 13 | + export COPYQ_PASSWORD="TEST123" |
| 14 | + export COPYQ_LOG_LEVEL="DEBUG" |
| 15 | + export QT_LOGGING_RULES="*.debug=true;qt.*.debug=false" |
| 16 | + export QT_QPA_PLATFORM="minimal" |
| 17 | + |
| 18 | +Run CMake to configure build: |
| 19 | + |
| 20 | + cmake -B build -G Ninja \ |
| 21 | + -DCMAKE_BUILD_TYPE=Debug \ |
| 22 | + -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ |
| 23 | + -DCMAKE_INSTALL_PREFIX=$PWD/build/install \ |
| 24 | + -DCMAKE_CXX_FLAGS="-ggdb -fdiagnostics-color" \ |
| 25 | + -DWITH_TESTS=ON \ |
| 26 | + -DPEDANTIC=ON . |
| 27 | + |
| 28 | +Build: `cmake -B build --build` |
| 29 | + |
| 30 | +Install: `cmake -B build --target install` |
| 31 | + |
| 32 | +Run tests after build: `build/copyq-tests $TEST_FUNCTIONS` |
| 33 | + |
| 34 | +Run tests for specific plugin: `build/copyq-tests PLUGINS:sync $TEST_FUNCTIONS` |
| 35 | + |
| 36 | +List tests function names: `build/copyq-tests -functions` |
| 37 | + |
| 38 | +List tests function names for a plugin: `build/copyq-tests PLUGINS:image -functions` |
| 39 | + |
| 40 | +Start the server process: `build/copyq` |
| 41 | + |
| 42 | +In case any process exits with exit code 11 (SIGSEGV) use `coredumpctl` utility |
| 43 | +to find the root cause. |
| 44 | + |
| 45 | +Stop the server process: `build/copyq exit` |
| 46 | + |
| 47 | +List server and client logs (server process does not need to run): `build/copyq logs` |
| 48 | + |
| 49 | +Run a script - requires server to be running: |
| 50 | + |
| 51 | + build/copyq source script.js |
| 52 | + |
| 53 | + # the above command is equivalent to |
| 54 | + build/copyq 'source("script.js")' |
| 55 | + |
| 56 | +Scripting API documentation is in @docs/scripting-api.rst. |
| 57 | + |
| 58 | +Useful scripts (omit the `tab(...)` call to use the default tab): |
| 59 | + |
| 60 | +- `tab('TAB1'); add('ITEM')` - prepend ITEM text item to the TAB1 tab |
| 61 | +- `tab('TAB1'); size()` - item count in the TAB1 tab |
| 62 | +- `tab('TAB1'); read(0,1,2)` - read items at indexes 0, 1 and 2 in the TAB1 tab |
| 63 | +- `config()` - list configuration options with current value and description |
| 64 | +- `config('check_clipboard', 'false')` - set an option |
| 65 | + |
| 66 | +## Project structure |
| 67 | + |
| 68 | +- @plugins - code for various plugins build as dynamic modules loaded optionally by the app |
| 69 | +- @src - main app code |
| 70 | +- @src/app - wrappers for QCoreApplication object |
| 71 | +- @src/common - common functionality, client/server local socket handling, logging |
| 72 | +- @src/gui - GUI widgets and some helper modules |
| 73 | +- @src/item - tab and item data handling, serialization code |
| 74 | +- @src/platform - platform-specific code |
| 75 | +- @src/scriptable - scripting capabilities |
| 76 | +- @src/tests - tests for the main app |
| 77 | +- @src/ui - Qt widget definition files (XML) |
| 78 | +- @qxt - code to handle global system-wide shortcuts |
0 commit comments