Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 17 Apr 2015 14:18:33 +0300
From: Aleksey Cherepanov <>
Subject: Re: Improving Johnny


On Thu, Apr 16, 2015 at 09:16:16AM -0400, Mathieu Laprise wrote:
> I continue working on what we said yesterday. Here is just a quick update
> saying why I didn't finished yet.
> There is probably a problem in the layout logic somewhere in the MainWindow
> designer file. In 2012, Aleksey found a workaround by specifying a maximum
> size and a magic numbe for the left menu bar :
> // TODO: Magic number. It seems to be wrong approach.
> m_ui->listWidgetTabs->setMaximumWidth(m_ui->listWidgetTabs->sizeHintForColumn(0)
> + 4);
> This workaround works most of the time but when you change the text
> dynamically in the MainWindow class by choosing french in the setting's
> list. I apply a translator, call the QT built-in method retranslateUi and
> everything layout correctly except the listWidgetTabs. As you can see on
> the screenshot , the listWidgetTabs object
> don't resize correctly when we add a bigger text than it previously
> contained(french word "Mot de passe" is bigger than "Password"). The rest
> of the screen looks great with translation because the layouts do their
> jobs and there are no hardcoded values.
> I tried to force relayout by calling update, updateGeometry, repaint and
> doing similar to what Aleksey did. However, it doesn't work. It only works
> when you read the settings and translate the application in main.cpp,
> before MainWindow is created. (
> So we have two solutions:
> 1- Remove the work around with a magic number and find a real fix. What
> makes it harder is that all UI code for all screens is in the same
> file(mainwindow.ui) so I'll have to proceed with care while making changes
> to layouts.
> 2- On first startup, the application will choose system language(ex:
> french). If the user go in the settings to choose english, he has to
> restart the application for the changes to take effects. For all further
> startups, the language will be english.

I see. A workaround may be used again: just call
m_ui->listWidgetTabs->setMaximumWidth(m_ui->listWidgetTabs->sizeHintForColumn(0) + 4);
after choosing language. Did you try it?

I've tried a bit on my version:

    m_ui->listWidgetTabs->setMaximumWidth(m_ui->listWidgetTabs->sizeHintForColumn(0) + 4);
    m_ui->listWidgetTabs->item(0)->setText(tr("Passwords 1"));
gives "Pas...s 1"

    m_ui->listWidgetTabs->setMaximumWidth(m_ui->listWidgetTabs->sizeHintForColumn(0) + 4);
    m_ui->listWidgetTabs->item(0)->setText(tr("Passwords 1"));
    m_ui->listWidgetTabs->setMaximumWidth(m_ui->listWidgetTabs->sizeHintForColumn(0) + 4);
gives "Passwords 1"

If setMaximumWidth after choosing language works then you need to
extract it into a method "to fix ui" and call the method from the
original place and after choosing to avoid uncomfortable copy-pasting.

I looked a bit on your repo. I am very glad that you publish your
changes soon.

I've glanced onto diff between master and translation branches:

$ git diff master..translation
+    //Translator needed to translate Qt's own strings

I think a space in //Translator would be nice.

+    case QProcess::Timedout: case QProcess::WriteError:
+    case QProcess::ReadError: case QProcess::UnknownError:

Keeping 2 case branches on 1 line is a strange style.

Nevertheless the code looks rather good. So I'd like to encourage you!

I have to warn you that the hardest part of Johnny's development is
understanding of cracking with john.

I guess Shinnok broke support for Qt4:

$ qmake
$ make
g++ -c -m64 -pipe -O2 -D_REENTRANT -Wall -W -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
main.cpp:7:34: fatal error: QtWidgets/QApplication: No such file or directory
 #include <QtWidgets/QApplication>
compilation terminated.
Makefile:260: recipe for target 'main.o' failed
make: *** [main.o] Error 1

So I did not really try your code yet.


Aleksey Cherepanov

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.