Skip to content

Commit 23c1e3f

Browse files
committed
Fixed crash on close tab at Win7.
Added Readme-dev-cmake-en.txt.
1 parent 9d1b802 commit 23c1e3f

File tree

3 files changed

+218
-19
lines changed

3 files changed

+218
-19
lines changed

Diff for: Readme-dev-cmake-en.txt

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
This file contains the CMake files description
2+
(useful for developers)
3+
4+
./CMakeLists.txt - root file (the main script):
5+
contains a list of general options;
6+
determines the program type Psi/Psi+;
7+
determines chatlog type Basic/Webkit/Webengine;
8+
contains general compile definitions;
9+
enables ccache, mxe;
10+
contains useful copy function;
11+
adds iris, 3rdparty, src, plugins subdirectories;
12+
in case of only plugins build - enables plugins;
13+
if plugins/generic/psimedia directory exists and BUILD_PSIMEDIA flag is
14+
enabled - builds psimedia library.
15+
16+
./icondef.xml.in - template-file to generate icondef.xml file
17+
./iconsets.qrc.in - template-file to generate iconsets.qrc file
18+
19+
./3rdparty/CMakeLists.txt - builds qhttp static library
20+
./3rdparty/qite/libqite/libqite.cmake - contains qite project file list
21+
22+
./cmake/modules - directory contains modules for searching libraries, for determining a
23+
program version, for work with sources and generation of additional targets and files.
24+
./cmake/modules/COPYING-CMAKE-SCRIPTS - license file (to solve problems with mainaining)
25+
./cmake/modules/FindLibGpgError.cmake - finds libgpg-error library
26+
./cmake/modules/FindQJDns.cmake - finds qjdns library
27+
./cmake/modules/FindEnchant.cmake - finds enchant library
28+
./cmake/modules/FindLibOtr.cmake - finds otr library
29+
./cmake/modules/FindQJSON.cmake - finds qjson library (disabled as outdated)
30+
./cmake/modules/FindHunspell.cmake - finds hunspell library
31+
./cmake/modules/FindLibTidy.cmake - finds tidy or html-tidy library
32+
./cmake/modules/FindSparkle.cmake - finds sparkle (not yet tested)
33+
./cmake/modules/FindMINIZIP.cmake - finds minizip library
34+
./cmake/modules/FindXCB.cmake - finds xcb library
35+
./cmake/modules/FindLibGcrypt.cmake - finds libgctypt or libgcrypt2 library
36+
./cmake/modules/FindQca.cmake - finds qca-qt5 library
37+
./cmake/modules/FindZLIB.cmake - finds zlib library
38+
./cmake/modules/FindPsiPluginsApi.cmake - module to search files useful at build plugins
39+
./cmake/modules/get-version.cmake - determines clien version using git utility or by parsing
40+
a ../version file
41+
./cmake/modules/win32-prepare-deps.cmake - generates a list of files to install
42+
with make prepare-bin-libs command, which install dependency libraries
43+
into output build directory. Or using windeployqt utility if available
44+
with make windeploy command
45+
./cmake/modules/generate_desktopfile.cmake - generates .desktop file
46+
./cmake/modules/fix-codestyle.cmake - module for codestyle fix using clang-format
47+
48+
./iris/CMakeLists.txt - builds iris library:
49+
contains options for the iris library (duplicated in a main script)
50+
enables qjdns (if option enabled)
51+
adds src/irisnet and src/xmpp subdirectories
52+
53+
/***
54+
./iris - this directory contains an additional files to build iris library outside of the Psi
55+
project. This functionality is partially realized. Needs reworking.
56+
***/
57+
58+
./iris/cmake/modules - modules for libraries searching (copies of Psi modules)
59+
60+
./iris/src/irisnet/CMakeLists.txt - builds irisnet static library
61+
62+
./iris/src/xmpp/CMakeLists.txt - builds iris static library
63+
64+
./src/CMakeLists.txt - builds and installs the Psi/Psi+ project files:
65+
adds ../translations directory (if exists) and compiles translations files
66+
finds an additional libraries and static libraries and adds them to project
67+
sets the main program name based on the main script data
68+
generates config.h file based on the config.h.in template file
69+
generates psi_win.rc based on the ../win32/psi_win.rc.in template file and
70+
compiles psi_win.o file
71+
adds src.cmake file
72+
adds ../3rdparty/qite/libqite/libqite.cmake file
73+
adds irisprotocol/irisprotocol.cmake file
74+
adds protocol/protocol.cmake file
75+
adds ../plugins/plugins.cmake file
76+
adds AutoUpdater, options, tabs, privacy, Certificates, avcall, psimedia,
77+
contactmanager, tools, libpsi/dialogs, libpsi/tools, widgets, sxe,
78+
whiteboarding subdirectories
79+
substitutes the output program name with an extended name (if enabled)
80+
generates description files for default iconsets
81+
if name is extended generates the .desktop file using generate_desktopfile.cmake module
82+
creates an installation rules
83+
if DEV_MODE option is enabled generates an installation rules for dependency
84+
libraries to install into binary output directory using win32-prepare-deps.cmake
85+
module
86+
87+
./src/config.h.in - template-file for config.h file creation
88+
89+
./src/src.cmake:
90+
contains the default compile definitions;
91+
contains a lists with the main source files:
92+
FORMS list - contains ui files;
93+
HEADERS list - contains C/C++ header files
94+
SOURCES list - contains C/C++ source files
95+
96+
./src/AutoUpdater/CMakeLists.txt - builds AutoUpdater static library
97+
98+
./src/avcall/CMakeLists.txt - builds avcall static library
99+
100+
./src/Certificates/CMakeLists.txt - builds Certificates static library
101+
102+
./src/contactmanager/CMakeLists.txt - builds contactmanager static library
103+
104+
./src/irisprotocol/irisprotocol.cmake - a list of source files which will be added into
105+
the main sources list
106+
107+
./src/libpsi/dialogs/CMakeLists.txt - builds libpsi_dialogs static library
108+
109+
./src/libpsi/tools/CMakeLists.txt - builds libpsi_tools static library:
110+
adds zip subdirectory
111+
112+
./src/libpsi/tools/zip/CMakeLists.txt - builds zip static library
113+
114+
./src/options/CMakeLists.txt - builds options static library
115+
116+
./src/privacy/CMakeLists.txt - builds privacy static library
117+
118+
./src/protocol/protocol.cmake - a list of source files which will be added into
119+
the main sources list
120+
121+
./src/psimedia/CMakeLists.txt - build psimedia static library
122+
123+
./src/sxe/CMakeLists.txt - builds sxe static library
124+
125+
./src/tabs/CMakeLists.txt - build tabs static library
126+
127+
./src/tools/CMakeLists.txt - builds tools static library
128+
129+
./src/whiteboarding/CMakeLists.txt - builds whiteboarding static library
130+
131+
./src/widgets/CMakeLists.txt - builds widgets static library
132+
133+
./plugins/plugins.cmake - a list of header files which will be added into
134+
the main headers list
135+
136+
./plugins/variables.cmake.in - template-file, contains the main variables useful
137+
to build plugins, general for all plugins
138+
139+
./plugins/pluginsconf.pri.cmake.in - template-file to generate pluginsconf.pri file
140+
141+
./plugins/CMakeLists.txt - main script to rule the plugins
142+
contains the main build rules for all plugins
143+
adds generic, unix, dev subdirectories
144+
145+
./plugins/generic/CMakeLists.txt:
146+
adds subrirectory for each plugin, if BUILD_PLUGINS variable is set it adds only
147+
plugins from BUILD_PLUGINS list (or exclude plugins)
148+
149+
./plugins/dev/CMakeLists.txt:
150+
adds subrirectory for each plugin, if BUILD_PLUGINS variable is set it adds only
151+
plugins from BUILD_PLUGINS list (or exclude plugins)
152+
153+
./plugins/unix/CMakeLists.txt:
154+
adds subrirectory for each plugin, if BUILD_PLUGINS variable is set it adds only
155+
plugins from BUILD_PLUGINS list (or exclude plugins)
156+
157+
./plugins/*TYPE*/*PLUGIN*/CMakeLists.txt - builds and installs a plugin
158+
whit "*TYPE*" type and "*PLUGIN*" name. The structure of these files are mostly
159+
the same
160+
161+
./win32/win32_definitions.cmake - provides the next features:
162+
determines PSI_SDK and GSTREAMER_SDK pathes
163+
determines the MinGW or MSVC compilation flags
164+
contains the main definitions for OS Windows
165+
166+
./win32/psi_win.rc.in - template-file to generate psi_win.rc file
167+
168+
/***
169+
USEFUL TIPS
170+
***/
171+
172+
/***
173+
For a comfortable plugins packages creation and to aviod downloading all the Psi
174+
sources or copying of these sources if INSTALL_PLUGINS_SDK flag is enabled
175+
while installing Psi using CMake-scripts could be installed an additional files
176+
together with the main program files such as:
177+
Plugins API (includes, *.pri files, variables.cmake)
178+
(path $prefix/share/name_of_program/plugins)
179+
And also could be installed Plugins API search module
180+
FindPsiPluginsApi.cmake
181+
(path $prefix/share/cmake/Modules)
182+
In this case the variables.cmake generates at Psi build and contains:
183+
- path to the plugins install directory
184+
- path to the psi/psi+ data directory
185+
- name of a program (psi or psi-plus)
186+
- plugins defenitions
187+
Also the CMake-script generates *.pri files, needed to build plugins using qmake utility
188+
***/
189+
190+
/***
191+
If there is a plguin debug necessity in OS Linux you can do next:
192+
- download psi-plus-snapshots repository
193+
- open CMakeLists.txt from root directory using qtcreator
194+
- choose profile and build type
195+
- enable both ENABLE_PLUGINS and DEV_MODE flags
196+
- clean CMake cache if needed and run CMake (using qtcreator build menu)
197+
- build project
198+
That's all. You can debug plugin with the psi/psi+ program.
199+
***/

Diff for: src/msgmle.cpp

+13-14
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,9 @@ void ChatEdit::insertAsQuote(const QString &text)
642642
void ChatEdit::addSoundRecButton()
643643
{
644644
if (!recButton_) {
645-
layout_.reset(new QHBoxLayout(this));
646-
recButton_.reset(new QToolButton(this));
647-
overlay_.reset(new QLabel(this));
645+
layout_ = new QHBoxLayout(this);
646+
recButton_ = new QToolButton(this);
647+
overlay_ = new QLabel(this);
648648

649649
// Set text right margin for rec button
650650
connect(document(), &QTextDocument::contentsChanged, this, &ChatEdit::setRigthMargin);
@@ -655,15 +655,15 @@ void ChatEdit::addSoundRecButton()
655655
overlay_->setAlignment(Qt::AlignCenter);
656656
setOverlayText(maxOverlayTime);
657657
overlay_->setVisible(false);
658-
layout_->addWidget(overlay_.get());
658+
layout_->addWidget(overlay_);
659659
recButton_->setToolTip(tr("Record and share audio note while pressed"));
660660
setRecButtonIcon();
661661
auto iconSize = fontInfo().pixelSize() * 1.5;
662662
recButton_->setMinimumSize(QSize(iconSize, iconSize));
663-
layout_->addWidget(recButton_.get());
663+
layout_->addWidget(recButton_);
664664
layout_->setAlignment(Qt::AlignRight | Qt::AlignBottom);
665665

666-
connect(recButton_.get(), &QToolButton::pressed, this, [this]() { // Rec button pressed
666+
connect(recButton_, &QToolButton::pressed, this, [this]() { // Rec button pressed
667667
if (recorder_) {
668668
recorder_->disconnect();
669669
recorder_.reset();
@@ -686,8 +686,8 @@ void ChatEdit::addSoundRecButton()
686686
recButton_->setIcon(IconsetFactory::iconPixmap("psi/mic_rec", fontInfo().pixelSize() * 1.5));
687687
overlay_->setVisible(true);
688688
timeout_ = TIMEOUT;
689-
timer_.reset(new QTimer); // countdown timer to stop recording while the button is pressed
690-
connect(timer_.get(), &QTimer::timeout, this, [this]() {
689+
timer_ = new QTimer(this); // countdown timer to stop recording while the button is pressed
690+
connect(timer_, &QTimer::timeout, this, [this]() {
691691
if (timeout_ > 0) {
692692
timeout_ -= SECOND;
693693
setOverlayText(timeout_ / SECOND);
@@ -700,11 +700,11 @@ void ChatEdit::addSoundRecButton()
700700
});
701701
recorder_->record();
702702
});
703-
connect(recButton_.get(), &QToolButton::released, this, [this]() { // Rec button relesed
703+
connect(recButton_, &QToolButton::released, this, [this]() { // Rec button relesed
704704
setRecButtonIcon();
705705
if (timer_) {
706706
timer_->stop();
707-
timer_.reset();
707+
delete timer_;
708708
}
709709
setOverlayText(maxOverlayTime);
710710
overlay_->setVisible(false);
@@ -717,10 +717,9 @@ void ChatEdit::addSoundRecButton()
717717

718718
void ChatEdit::removeSoundRecButton()
719719
{
720-
disconnect(recButton_.get());
721-
recButton_.reset();
722-
overlay_.reset();
723-
layout_.reset();
720+
delete recButton_;
721+
delete overlay_;
722+
delete layout_;
724723
disconnect(recorder_.get());
725724
recorder_.reset();
726725
disconnect(document(), &QTextDocument::contentsChanged, this, &ChatEdit::setRigthMargin);

Diff for: src/msgmle.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "xmpp_htmlelement.h"
2424

25+
#include <QPointer>
2526
#include <QTextEdit>
2627
#include <memory>
2728

@@ -69,7 +70,7 @@ class ChatEdit : public QTextEdit {
6970
}
7071
CapitalLettersController *capitalizer();
7172
void addSoundRecButton();
72-
bool hasSoundRecButton() const { return bool(recButton_); }
73+
bool hasSoundRecButton() const { return !recButton_.isNull(); }
7374
int recButtonHeigth() const;
7475
void removeSoundRecButton();
7576

@@ -131,10 +132,10 @@ protected slots:
131132
CapitalLettersController * capitalizer_ = nullptr;
132133
bool correction = false;
133134
QString lastId;
134-
std::unique_ptr<QLayout> layout_;
135-
std::unique_ptr<QToolButton> recButton_;
136-
std::unique_ptr<QLabel> overlay_;
137-
std::unique_ptr<QTimer> timer_;
135+
QPointer<QLayout> layout_;
136+
QPointer<QToolButton> recButton_;
137+
QPointer<QLabel> overlay_;
138+
QPointer<QTimer> timer_;
138139
std::unique_ptr<AudioRecorder> recorder_;
139140
int timeout_;
140141
};

0 commit comments

Comments
 (0)