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

Build with Qt5 #6

Closed
wants to merge 3 commits into from
Closed

Build with Qt5 #6

wants to merge 3 commits into from

Conversation

liangqi
Copy link
Contributor

@liangqi liangqi commented Apr 29, 2013

At least after my 3(or 2) commits(based on a5092bd), it compiles well with Qt 5.(Only tested on Mac OS X 10.8.2, with Qt 5.0.2 open source release.)

These changes are not targeted the master branch. I'd like to see the qt5 branch in main repo.

@pzorin
Copy link
Owner

pzorin commented Apr 29, 2013

Thanks for adjusting it for qt5. It is also great that you removed that alsa code, it was really out of place. I will pull this once I verify that it builds on my system, which will happen when I get around to setting up qt5 (might take a while).

@pzorin
Copy link
Owner

pzorin commented May 2, 2013

I have modified the sound code in a way that works for me (on linux). No idea if it breaks something on other platforms.

@liangqi
Copy link
Contributor Author

liangqi commented May 2, 2013

Do you mean my commit for sound not work for you?

@pzorin
Copy link
Owner

pzorin commented May 2, 2013

It didn't work apparently because QMediaPlayer cannot play files embedded in the executable. In the Qt4 version the sound files were embedded on Linux but not on the other platforms, so this problem could not have affected you.

In my current version sound files are never embedded. However, I have also simplified the surrounding code, so I cannot tell if it still works on platforms other than Linux (although it should).

@liangqi
Copy link
Contributor Author

liangqi commented May 3, 2013

OK, could you paste your commit somewhere? Then I can test it on Mac. BTW, QtMultiMedia is not available on Qt4.

@pzorin
Copy link
Owner

pzorin commented May 3, 2013

It is in branch qt5 in my repo:
https://github.com/pzorin/qgo/tree/qt5

@liangqi
Copy link
Contributor Author

liangqi commented May 3, 2013

OK, I see, my commits are there, but you didn't use github to accept them, ^_^. I will close this request then.

@liangqi liangqi closed this May 3, 2013
@pzorin
Copy link
Owner

pzorin commented May 3, 2013

The web interface would have pulled them into the master branch, which was not your intention.

@liangqi
Copy link
Contributor Author

liangqi commented May 3, 2013

Yes, when I pushed this request, there was no qt5 branch yet. I guess we could edit them.

@oren740
Copy link

oren740 commented May 3, 2013

When would the qt5 branch become the master?

On Fri, May 3, 2013 at 2:32 AM, Liang Qi notifications@github.com wrote:

Yes, when I pushed this request, there was no qt5 branch yet. I guess we
could edit them.


Reply to this email directly or view it on GitHubhttps://github.com//pull/6#issuecomment-17385897
.

@pzorin
Copy link
Owner

pzorin commented May 3, 2013

I have no intention to maintain the Qt4 branch, so after a little testing of the Qt5 version in online games I intend to make it master.
It would be nice if someone confirmed that it also still works on Windows, though.

@oren740
Copy link

oren740 commented May 3, 2013

Ok, checking on windows.

Had to change Q_WS_WIN to Q_OS_WIN
Had to change an enum from HOST_NOT_FOUND TO QGO_HOST_NOT_FOUND

and now it starts but connecting to IGS gets this.

setGeometry: Attempt to set a size (180x100) violating the constraints(180x100 - 114x81) on window 'QMessageBoxClassWindow'.
Connecting to igs.joyjoy.net 7777...
rank spread : NR - 9p
Login found
:10 ??�
1 1
Password prompt or 1 1 found
ASSERT failure in QList::operator[]: "index out of range", file ......\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qlist.h, line 458
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
C:\git\build-qgo-Desktop_Qt_5_0_2_MinGW_32bit-Debug\build\qgo exited with code 3

@pzorin
Copy link
Owner

pzorin commented May 3, 2013

On Friday 03 May 2013 10:47:51 oren740 wrote:

Ok, checking on windows.

Had to change Q_WS_WIN to Q_OS_WIN
Good point.

Had to change an enum from HOST_NOT_FOUND TO QGO_HOST_NOT_FOUND
Is there a name clash?

Regarding the runtime error, Qt5 seems more strict in handling lists than Qt4.
Can you compile with debug symbols and see in which call the error occurs?

@oren740
Copy link

oren740 commented May 3, 2013

The callstack leaves qgo code here.

void FilteredView::setModel ( ListModel * model )
{
listFilter->setListModel(model);
QTableView::setModel(model);
}

On setModel, we crash.

On HOST_NOT_FOUND, the preprocessor on windows is setting it out to (10000 + 1001) and I get complaints about that. Not sure exactly why yet, but working around it for now.

@pzorin
Copy link
Owner

pzorin commented May 3, 2013

The models for the player and game lists do indeed use QList a lot, and do not
check if the index one is trying to access is in the correct range.

I thought that this was not a problem assuming that the views always supply
valid indices. Maybe this is not the case when they are first created on
Windows?

Without being able to reproduce it (I can connect to IGS without problems) I
do not know what to do.

@oren740
Copy link

oren740 commented May 3, 2013

Worked more on this than I should have right now, but the listview is just bombing out when items is 0. I'm not sure if this is a qt problem or qgo problem.

I'm really surprised it's not an issue failing the assert on linux.

@pzorin
Copy link
Owner

pzorin commented May 3, 2013

It is an issue (and I had to fix it in the goban rendering code), but I haven't
encountered it in the player/game list models.

@oren740
Copy link

oren740 commented May 3, 2013

QModelIndex ListModel::index ( int row, int column, const QModelIndex & ) const
{
return createIndex(row,column,items[row]);
}

Players and GameList setModel calls through here when items is still empty. Any idea how to handle this correctly?

@oren740
Copy link

oren740 commented May 3, 2013

Ok, moved the setmodels for both to the player recv and game receive functions and that worked. But now selecting a game causes similar bad behavior on board layout.

@oren740
Copy link

oren740 commented May 3, 2013

Ok, I got it to work a stupid way. Build release... so I have to ask, are you doing release or debug builds?

@pzorin
Copy link
Owner

pzorin commented May 3, 2013

@oren740: HOST_NOT_FOUND is used in one more place, please check that.

ListModel::index normally should not be called when "items" is empty, because
then ListModel::rowCount is zero. One could add error handling and return
QModelIndex::QModelIndex() (the invalid index) in this case.

I tried both debug (on amd64) and release (on i686), and both work for me.

BTW, I replaced Q_WS* by Q_OS* in my branch.

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.

3 participants