Commit Graph

111 Commits (542846edb1b2321a43e363676841fc335370dd28)

Author SHA1 Message Date
Jos van den Oever 5c5126d84b Allow explicit adding of include directories and libraries to link 2019-02-25 23:47:00 +01:00
Jos van den Oever ca98081000 Make it possible to specify C++ header files via mod build 2019-02-24 10:27:12 +01:00
Jos van den Oever 10ddeda5cb Add placeholder variable name in generated code 2019-02-13 07:57:25 +01:00
Jos van den Oever bba4964e31 Fix error where Cargo.toml could not be found
And improve the error message
2019-02-08 22:00:20 +01:00
Jos van den Oever ad94fb1036 cargo fmt 2019-01-22 00:03:50 +01:00
Jos van den Oever 7c8bb6a535 Add function to choose what Qt modules to link to 2019-01-21 23:29:13 +01:00
Jos van den Oever ecd135f311 Fix build with rust <= 1.30
A required lifetime was missing.
2018-12-10 00:32:20 +01:00
Jos van den Oever b41b1be336 Add anonymous parameter placeholders to generated code
As of Rust 1.31, missing parameter placeholders in functions
give a compile error. This commit adds more of them.
2018-12-10 00:12:49 +01:00
Jos van den Oever 319991e77f Add anonymous parameter placeholders to generated code
As of Rust 1.31, missing parameter placeholders in functions
give a compile error. This commit adds them.
2018-12-09 23:45:46 +01:00
Owen Nelson 325ffc2a2c Add support for Rust 2018 edition projects.
Summary:
After enabling 2018 edition on my cargo project, the use statements
generated in the interface module no longer resolve.

Prefixing module paths with `crate::` brings things back into alignment.

Unsure if this is how you'd like to approach the issue, but I'm happy to revise the patch based on your feedback.

Test Plan:
STEPS TO REPRODUCE
1. create a new cargo project based on the template
2. update your toolchain to >= 1.31
3. add `edition = "2018"` to the package section of your Cargo.toml
4. run `cargo build`

OBSERVED RESULT

Build fails since generated code tries to import crate-local modules as if they are top level crates.

EXPECTED RESULT

Build completes successfully.

Reviewers: vandenoever

Differential Revision: https://phabricator.kde.org/D17447
2018-12-09 23:34:40 +01:00
Jos van den Oever 4acf7e3176 Resolve resource path relative to qrc path 2018-11-24 12:46:47 +01:00
Carl Schwan ec81047ac1
Use pattern matching instead of if and else that return true and false
Differential Revision: https://phabricator.kde.org/D16576
2018-11-01 10:30:05 +01:00
Jos van den Oever 89c86642f8 Print the c++ library that cargo should link against
This is used when calling "cargo build" when no actual recompile is needed.

BUG: 400393
2018-10-28 22:05:20 +01:00
Jos van den Oever 385ae17bb7 Pass the emitter as mutable. It is pointless otherwise. 2018-10-26 00:32:02 +02:00
Jos van den Oever b603a2262b Only allow mutable objects to call back into C++
When an object calls into C++, that C++ code may again call into Rust.
The original call might have an immutable reference and the nested
call could receive a mutable reference. That is not allowed and
undefined behaviour. For this reason, calling into C++ is only allowed
from mutable objects.
2018-10-25 18:06:19 +02:00
Jos van den Oever 4a38793882 Add documentation and tweak function name 2018-10-10 00:07:25 +02:00
Jos van den Oever 08876fd757 Take changes in .h and .cpp files into account during build 2018-10-09 18:11:37 +02:00
Jos van den Oever ea876ec81d Add functions for building Qt applications with Cargo 2018-10-09 00:05:56 +02:00
Jos van den Oever df91226979 Expose function for reading the configuration 2018-09-30 00:10:22 +02:00
Jos van den Oever fac04fd6d4 Remove unneeded annotations 2018-09-29 23:47:23 +02:00
Jos van den Oever 13d8d1cf1d Use AtomicPtr instead of Mutex 2018-09-29 23:28:24 +02:00
Jos van den Oever fe9731819f Use the version number from Cargo.toml 2018-09-28 23:54:42 +02:00
Jos van den Oever 6ee8ca626d Add function to create bindings from runtime Config object 2018-09-28 23:38:44 +02:00
Jos van den Oever baaa8f230c Use full include path to Qt headers 2018-09-28 22:36:56 +02:00
Jos van den Oever d7860d9031 Also check for module directory 2018-09-28 18:40:01 +02:00
Jos van den Oever 034e5526cf Add missing ? 2018-09-28 18:08:19 +02:00
Jos van den Oever b3e43ae1d2 Handle result of write! and writeln!
This is probably the patch with the largest amount of question marks added to code ever.
2018-09-28 18:05:10 +02:00
Jos van den Oever d6e88b0ab6 Add missing file 2018-09-28 12:24:30 +02:00
Jos van den Oever d7e4f1362d Port rust_qt_binding_generator from C++ to Rust 2018-09-28 12:11:57 +02:00
Friedrich W. H. Kossebau d5029d7217 Use Q_SIGNALS/Q_EMIT instead of signals/emit in generated sources
Summary:
Avoid potential clashes on symbols/macros from other libraries
Allows to use the generated header in projects which have
DQT_NO_SIGNALS_SLOTS_KEYWORDS or DQT_NO_KEYWORDS set

Reviewers: vandenoever

Reviewed By: vandenoever

Differential Revision: https://phabricator.kde.org/D15545
2018-09-16 19:25:26 +02:00
Friedrich W. H. Kossebau dff4e2a0d2 Use nullptr in generated C++ sources
Reviewers: vandenoever

Reviewed By: vandenoever

Differential Revision: https://phabricator.kde.org/D15553
2018-09-16 19:14:54 +02:00
Friedrich W. H. Kossebau 1ce86bd5d5 Add break; statements in the generated switch code for model::data()
Summary:
Compiler complains about generated code with
warning: this statement may fall through
and is slightly right, as the code might fall through if a role is used
which is not catched for a column.

Reviewers: vandenoever

Reviewed By: vandenoever

Differential Revision: https://phabricator.kde.org/D15541
2018-09-15 22:02:17 +02:00
Jos van den Oever 0192124c70 Fix some clippy issues in written and generated code 2018-09-11 23:29:06 +02:00
Jos van den Oever 9549c50217 Automatically update index when calling layoutChanged 2018-09-11 23:06:52 +02:00
Jos van den Oever f0eb78457b Make the model struct that emits model signals clonable 2018-09-08 23:13:20 +02:00
Jos van den Oever 96376517c6 Add bindings for layoutAboutToBeChanged and layoutChanged 2018-09-08 22:48:59 +02:00
Jos van den Oever b702c980af Add bindings for beginMoveRows and endMoveRows 2018-09-08 21:54:34 +02:00
Jos van den Oever 2a3123eda3 Consistently use Option instead of two arguments (value and bool) 2018-09-08 21:12:00 +02:00
Jos van den Oever 754214e7b4 snapshot 2018-09-08 20:47:48 +02:00
Jos van den Oever 32fed925e9 Intruduce rustByFunction
rustByFunction lets a getter get a value even if it is not possible
to return a value by reference.
rustByFunction passes a getter function in the getter. This can be
called with the value instead of returning a reference.
2018-08-26 19:47:25 +02:00
Jos van den Oever 73b9c89b30 Check function parameters and return type for use of QString and QByteArray 2018-08-05 19:51:38 +02:00
Jos van den Oever cdc50304b3 Remove unneeded boolean hasStringWrite 2018-08-05 19:36:50 +02:00
Jos van den Oever c5b09ca04c Fix the generated implementation.rs variable name
It was "item" but should be "index".
2018-08-05 14:41:22 +02:00
Jos van den Oever 7f2f4b71a4 Prefix signal with property name 2018-06-30 20:23:29 +02:00
Jos van den Oever 7d4b55b90a Use "index" instead of "item" for the index in the model 2018-06-08 14:21:35 +02:00
Jos van den Oever b8fcb67112 Add function to look up role number from role name 2018-05-19 17:08:18 +02:00
Jos van den Oever e3bfa85849 Make the roles property in the bindings.json optional 2018-05-19 14:01:11 +02:00
Jos van den Oever c27e451066 Check conversion between c_int and usize 2018-05-18 09:36:05 +02:00
Jos van den Oever 8949026c63 Make primitive types more precise and add test 2018-05-17 10:47:18 +02:00
Jos van den Oever 75d5406943 Add more tests 2018-05-16 22:38:30 +02:00