Skip to content
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

Open in Text Editor #70

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

garakmon
Copy link
Contributor

@garakmon garakmon commented Aug 13, 2018

Adds functionality to open a Map's scripts in a text editor (#60 ). The editor opened is the system's default editor for files with the .inc extension (usually default text editor unless otherwise set).
The button is only available when an event with a script is selected.

*Needs to be tested (and probably modified) on Windows & Linux*

mainwindow.cpp Outdated
#elif defined Q_OS_LINUX
QString cmd = "xdg-open ";
#else // WINDOWS
QString cmd = "cmd /c start ";
Copy link
Contributor Author

@garakmon garakmon Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work (on Windows) unless running pretmap from the command line (and not sure even then)

@garakmon
Copy link
Contributor Author

garakmon commented Aug 13, 2018

demonstration (macOS 10.12 + Sublime3):
Alt text

mainwindow.cpp Outdated
@@ -826,6 +850,13 @@ void MainWindow::updateSelectedObjects() {
widget->setLayout(fl);
frame->layout()->addWidget(widget);

// generate "Open in Text Editor" button
if (key == "script_label") {
QPushButton *scriptButton = new QPushButton(QString("Open This Map's Scripts in a Text Editor"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this button should be added in the context of the event. If you have multiple events selected, you'll see this button for each selected event. Instead, the button should probably just go underneath the "New Object" and "Delete" buttons. Also, it's a bit too long. Maybe just "Open Map Scripts"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't realize you could have multiple selected events. Agree with both the comments-- will make appropriate changes. Did the button work for you though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants