Qt Port update.

Dirk Hohndel dirk at hohndel.org
Sat Apr 13 14:25:24 PDT 2013


Tomaz Canabrava <tcanabrava at kde.org> writes:

> Just a quick update,
>
> I got a somewhat functional qt port that Dirk 's currently looking at. It
> adds the functionality to Add a Cylinder. ( yup, just that. )

Yep - and I can make it SIGSEGV :-)

The visual appearance is... a bit unexpected, given the way the original
looked, but my guess is that this is trivial to fix in Designer.

> As soon as I get the ok from dirk that the code is ok, I"ll add the delete
> / edit and the Weight handling.

I did some serious massaging of the code. Nothing in there was horrible,
but quite a bit in there was just very different from the style we
agreed upon when this project was started a year and a half ago.

I think I have most everything cleaned up, please take a good look what
I did. Look at the way the switch statements are now formatted, look at
function declarations, look at spacing around parenthesis... it's mostly
small stuff (ok, the switch statements aren't), but I think it's
important.

One thing I noticed is that you are using tr() for translations but we
really would love to stick with _() (i.e., gettext).

One interesting issue that this creates is that something like this
doesn't work:

bool MainWindow::askSaveChanges()
{
	QString message = ! existing_filename ? tr("You have unsaved changes\nWould you like to save those before closing the datafile?")
		:    tr("You have unsaved changes to file: %1 \nWould you like to save those before closing the datafile?").arg(existing_filename);


This is one of the rare situations where the stream syntax (with the
trailing .arg() ) is kinda useful and elegant.

Thiago, is there a way to maintain that useful feature and still use
gettext?

The other thing that puzzled me was this:

void MainTab::clearStats()
{
	QList<QLabel*> labels;
	labels << ui->maxdepth_2 << ui->mindepth << ui->avgdepth
		<< ui->maxsac << ui->minsac << ui->avgsac
		<< ui->dives << ui->maxtemp << ui->mintemp << ui->avgtemp
		<< ui->totaltime << ui->avgtime << ui->longestdive << ui->shortestdive;

	Q_FOREACH(QLabel *l, labels){
		l->setText(QString());
	}
}

What exactly does that series of '<<' do in this context? I find this
particularly hard to read...

All that said, I pushed this as one commit with all my cleanups to make
sure we don't have commits in the history that don't compile - having
commits that don't compile is a pain if later we want to be able to
bisect.

Thanks for all the work, Tomaz - this is slowly taking shape :-)

/D 


More information about the subsurface mailing list