-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add QT GUI #159
Add QT GUI #159
Conversation
Things to do
|
@serin-delaunay could you for now only check, whether this branch compiles and shows a window on your machine? Path to options directory is temporarily hard-coded, so you have to change it in code and recompile to generate a tileset using button. Note that in |
# Use the Widgets module from Qt 5. | ||
target_link_libraries(WangscapeGui wangscape-main) | ||
|
||
target_link_libraries(WangscapeGui Qt5::Widgets) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should try to find a Qt5
library, instead of assuming that it's installed (I mean it should use if
clause here, cause find_package(Qt5Widgets)
is already at line 8).
Separate issue. Qt5 it required anyway.
WangscapeGui/mainwindow.cpp
Outdated
|
||
#include <boost/program_options/options_description.hpp> | ||
#include <boost/program_options/parsers.hpp> | ||
#include <boost/program_options/variables_map.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not needed, cause it doesn't use program_options
.
WangscapeGui/mainwindow.cpp
Outdated
{ | ||
logging::addAppender(std::make_unique<logging::ConsoleAppender>("console", logging::Level::Debug)); | ||
|
||
std::string filename = "/home/hryniuk/projekty/Wangscape/doc/examples/example2/example_options.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It have to be read form a text field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get the filename from a standard file selector dialogue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course, I've only meant that it will be read from GUI.
WangscapeGui/mainwindow.cpp
Outdated
|
||
void MainWindow::clickPushButton() | ||
{ | ||
logging::addAppender(std::make_unique<logging::ConsoleAppender>("console", logging::Level::Debug)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to use a logger? We could think about notifications using Qt windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think while it's in the experimental stage we should use a logger. Log output should be viewable through something like a log widget or nonmodal window before public release.
WangscapeGui/mainwindow.cpp
Outdated
|
||
tilegen::TilesetGenerator tg(options, std::move(tp)); | ||
|
||
std::cout << "generating tiles..." << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this debug print.
WangscapeGui/mainwindow.cpp
Outdated
|
||
#include <iostream> | ||
|
||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second #include <iostream>
can be removed.
I made a project file for d2794d8, and it compiles and writes tilesets. However, it does use individual invocations of I've pushed the changes to a side-branch: serin-delaunay/gui-vs. |
(Also, this is awesome!) |
Build on Linux finished successfully, so I'm removing "(WIP)" prefix. Two things left: green osx build and small refactoring (probably). |
I've just noticed that |
I've find out, which flag I'm supposed to pass to |
We have a similar problem on Appveyor (#150). I think it's to do with how CI interprets program return values, see eg. travis-ci/travis-ci#6768 . |
@serin-delaunay yes, it should be easy to fix on Linux and OS X - just by saving return value and adding one |
I've moved buttons to menu, it looks better. I plan to add another action in menu, opening a window with options editor, one per tab. First tab: Alpha Calculator Mode. |
There's a problem with OSX build connected to stdlib. I thought that it should be fixed with See: |
|
@@ -13,5 +15,7 @@ enum class CalculatorMode | |||
Dither | |||
}; | |||
|
|||
extern const std::map<std::string, CalculatorMode> calculatorModeByName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need #include <string>
. Clang's error messages for this are terribly unhelpful :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh... I was misled by a fact it builds on gcc
. Headers seemed to be OK.
WangscapeGui/MainWindow.cpp
Outdated
const sf::Vector2u output_image_size = source_image.getSize(); | ||
QImage output_image(output_image_size.x, output_image_size.y, QImage::Format_RGB32); | ||
|
||
for (int y = 0; y < output_image_size.y; ++y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned int y
to match output_image_size.y
; same for x
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should build it with -Wall
enabled and probably, when all warnings will be fixed, with -Werror
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to have a warning from googletest
during WangscapeTest
compilation, but in the latest master
build that error seems to be gone :)
Add CalculatorMode.cpp to Wangscape VS project.
I've adapted the VS project to the new changes, and it builds fine. A few comments on the interface (probably they should be separate issues):
I think 6. and 7. should be fixed, and then I'm happy to merge this. If you want to include a QtCreator project or my VS project files (https://github.com/serin-delaunay/Wangscape/tree/gui-vs-2) for WangscapeGui, that's OK too. |
Thanks a lot for testing. I've included your commit and fixed 6. issue. I'll create separate issues for all points you mentioned and my suggestions I've wrote down during implementation. |
Looks like my VS project isn't working on AppVeyor. It's fixed in 3a0ae18. |
This should allow uic and moc to run.
Merged. Great work! 🎉 |
Includes #17, eventually providing a tileset preview and options editor in a window.