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

Mass convert #33

Open
wants to merge 26 commits into
base: devel
Choose a base branch
from
Open

Mass convert #33

wants to merge 26 commits into from

Conversation

Goddard
Copy link

@Goddard Goddard commented Jul 2, 2021

I've added the ability to mass-convert MOS types.

Still a few interface related problems need to be fixed, but functionality for mass conversion is done.
Mass convert for MOS v1 works well, but some bugs still exist.  MOS v2 still needs to be tested.
Copy link

@Mingun Mingun left a comment

Choose a reason for hiding this comment

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

I've not checked code in the IDE yet. As I see you mostly move large amounts of code to another place. Unfortunately, GitHub interface don't allow to notice that clearly. I recommend in this case make special commits that just moves existing code with minimal and absolutely necessary changes to facilitate reviewers work. So, can you rebase your changes to follow that suggestion?

You change a GUI in this PR. Can you attach a screenshot or two (before/after) with the notable differences highlighted?

}
return this;
}
}
Copy link

Choose a reason for hiding this comment

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

There a several files without newline in the end. I think, it is better to have it.

@@ -0,0 +1,44 @@
package org.infinity.gui;
Copy link

Choose a reason for hiding this comment

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

Please add a license header as in the other files

@@ -0,0 +1,44 @@
package org.infinity.gui;

import javax.swing.*;
Copy link

Choose a reason for hiding this comment

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

It is better to avoid wildcard imports. They can unexpectedly stop working in new Java versions, because new classes can be added to the packages.

/**
* Creates a JProgressBar with the range 0,100.
*/
public ProgressCellRenderer(){
Copy link

Choose a reason for hiding this comment

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

Please use consistent code style -- space between braces

int index = sValue.indexOf('%');
if (index != -1) {
int p = 0;
try{
Copy link

Choose a reason for hiding this comment

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

Style again

@@ -746,36 +776,36 @@ private void init()
bOutputV2 = new JButton("...");
bOutputV2.addActionListener(this);
c = ViewerUtil.setGBC(c, 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0);
GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0);
Copy link

Choose a reason for hiding this comment

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

Here and below: seems to be unnecessary whitespace-only change

Comment on lines 892 to 894
// c = ViewerUtil.setGBC(c, 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
// GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
// pButtons.add(cbCloseOnExit, c);
Copy link

Choose a reason for hiding this comment

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

Please remove unused code instead of commenting it

Comment on lines 944 to 946
for(String outPutTableFiles : getTableInputPaths()) {
Path file = FileManager.resolve(outPutTableFiles);
if(!Files.isRegularFile(file)) {
Copy link

Choose a reason for hiding this comment

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

Spaces

Suggested change
for(String outPutTableFiles : getTableInputPaths()) {
Path file = FileManager.resolve(outPutTableFiles);
if(!Files.isRegularFile(file)) {
for (String outPutTableFiles : getTableInputPaths()) {
Path file = FileManager.resolve(outPutTableFiles);
if (!Files.isRegularFile(file)) {

Comment on lines 992 to 994
for(File fileSelected : filePaths) {
System.out.println(fileSelected.getName());
}
Copy link

Choose a reason for hiding this comment

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

Use Logger or remove

Suggested change
for(File fileSelected : filePaths) {
System.out.println(fileSelected.getName());
}
for (File fileSelected : filePaths) {
System.out.println(fileSelected.getName());
}

Comment on lines 1030 to 1034
ArrayList<String> list = new ArrayList<>();
if(tfOutputTableV1.getModel().getRowCount() > 0) {
for (int i = 0; i < tfOutputTableV1.getModel().getRowCount(); i++) {
list.add(tfOutputTableV1.getModel().getValueAt(i, 0).toString());
}
Copy link

Choose a reason for hiding this comment

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

At least you can do that:

Suggested change
ArrayList<String> list = new ArrayList<>();
if(tfOutputTableV1.getModel().getRowCount() > 0) {
for (int i = 0; i < tfOutputTableV1.getModel().getRowCount(); i++) {
list.add(tfOutputTableV1.getModel().getValueAt(i, 0).toString());
}
final int count = tfOutputTableV1.getModel().getRowCount();
if (count > 0) {
final ArrayList<String> list = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
list.add(tfOutputTableV1.getModel().getValueAt(i, 0).toString());
}

But it is better to use your own TableModel class which will contain data you need

@Goddard
Copy link
Author

Goddard commented Jul 2, 2021

I've not checked code in the IDE yet. As I see you mostly move large amounts of code to another place. Unfortunately, GitHub interface don't allow to notice that clearly. I recommend in this case make special commits that just moves existing code with minimal and absolutely necessary changes to facilitate reviewers work. So, can you rebase your changes to follow that suggestion?

You change a GUI in this PR. Can you attach a screenshot or two (before/after) with the notable differences highlighted?

Here is the GUI before removing the close checkbox. I made this video awhile ago.
https://www.youtube.com/watch?v=jd3RItOyFxU

@Goddard
Copy link
Author

Goddard commented Jul 4, 2021

Think I addressed many issues.

@Argent77
Copy link
Owner

Argent77 commented Jul 4, 2021

Nice work!

However, I've noticed a couple of issues that should be fixed.

  1. It looks like you based the changes on Version 2.1-20200620 which is over a year (and 200 commits) behind the current state and causes a couple of merge conflicts. Please fetch the latest changes from upstream to resolve them.
  2. The input file dialog of both MOS converter tabs currently selects the Documents folder of the system by default. Please change it so that the game's root folder is selected instead. Moreover, the file selection dialog should remember the last selected folder.
  3. There is a layout issue if you select a number of input files and resize the dialog window afterwards. I was able to trigger it when the input list contained enough entries to show a vertical scroll bar.
  4. There is currently no way to remove selected input files from the MOS converter dialog, even after closing and reopening the dialog. Input should also be cleared after the conversion is done. Please add this functionality. (Take a look at the BMP converter how it can be done.)

And more of an aesthetic issue, the content of the "PVRZ-based" tab would probably look better if it were aligned at the top.

@Goddard
Copy link
Author

Goddard commented Jul 9, 2021

I think we are in a good spot now. Let me know what you think.

@Argent77
Copy link
Owner

It works nicely now!

I'd like to make three more suggestions though:

  1. Show more feedback if the conversion cannot be performed for some reason. For example, skip input files with a message if they cannot be read.
  2. If the user unchecked "Close dialog after conversion": Show a notification when the conversion process is complete because this is difficult to see when you convert a great number of files at once.
  3. If the user unchecked "Close dialog after conversion": Clear the content of the input and output list controls when the operation is complete. It's more intuitive than manually closing and reopening the converter to clear the list.

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