-
Notifications
You must be signed in to change notification settings - Fork 255
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
Modernize code (Qt5 connects + init of params) #474
base: master
Are you sure you want to change the base?
Conversation
Fix possible crash when accesing destroyed objects (lxqt#471)
419d2f1
to
1c9a500
Compare
1c9a500
to
7cf1d17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only finished Session.cpp
and Session.h
, but there are already several points. Let's fix a little at a time instead of fixing everything in the end.
ptySlaveFd = _shellProcess->pty()->slaveFd(); | ||
|
||
//create emulation backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this comment is gone. It's better to keep comments after refactoring.
|
||
QObject::connect( widget ,SIGNAL(destroyed(QObject *)) , this , | ||
SLOT(viewDestroyed(QObject *)) ); | ||
//slot for close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
||
connect(_emulation, &Emulation::imageResizeRequest, this, &Session::onEmulationSizeChange); | ||
connect(_emulation, &Emulation::imageSizeChanged, this, &Session::onViewSizeChange); | ||
connect(_emulation, &Emulation::cursorChanged, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! cursorChanged
is indeed a signal of Emulation
, not Vt102Emulation
.
// or KPty::login() which uses a QProcess to start /usr/bin/utempter | ||
, _flowControl(true) | ||
, _fullScripting(false) | ||
, _sessionId(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialization for _flowControl
, _flowControl
, _sessionId
are gone?
, _sessionId(0) | ||
// , _zmodemBusy(false) | ||
// , _zmodemProc(0) | ||
// , _zmodemProgress(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to also move initialization of zmodem-related variables to Session.h
, so that we don't forget initialization in case the zmodem feature is added back.
// , _zmodemBusy(false) | ||
// , _zmodemProc(0) | ||
// , _zmodemProgress(0) | ||
, _hasDarkBackground(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, initialization gone
@@ -491,7 +491,11 @@ public slots: | |||
private slots: | |||
void done(int); | |||
|
|||
// void fireZModemDetected(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although technical functionaltiy should not be affected, it's better to avoid changing slots into ordinary functions.
// void zmodemReadStatus(); | ||
// void zmodemReadAndSendBlock(); | ||
// void zmodemRcvBlock(const char *data, int len); | ||
// void zmodemFinished(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, keep these in slots.
We can move to that. |
In this PR I've applied two main changes:
These should be harmless modifications since they don't change any implementation.
I've postponed some real changes like using smart pointers, modern iterators, etc. until this PR goes in and clang-format is in place. I don't think it's recommendable to modify everything in one single PR.
Last thing: I've kept one old-style connect because it would make the code use qoverload. I know that this was an issue in some distros as ArchLinux and since I'm not sure QTermWidget is ship there or not, I decided to keep it.