quassel.git
5 years agoqtui: Add debug dialog for showing the resource file tree
Manuel Nickschas [Wed, 29 Aug 2018 18:38:31 +0000 (20:38 +0200)]
qtui: Add debug dialog for showing the resource file tree

Add a dialog in the debug menu that shows the compiled-in
resource files. This is useful for checking that resource generation
and loading works properly.

5 years agocommon: Simplify SyncableObject macros and usage
Manuel Nickschas [Thu, 23 Aug 2018 21:40:36 +0000 (23:40 +0200)]
common: Simplify SyncableObject macros and usage

Since the C++11 standard defines "__func__", and modern versions
of MSVC support this, we can remove the workaround for MSVC from
the SyncableObject macros. It is no longer necessary to derive
the function name from MSVC's __FUNCTION__ (which contains the
enclosing class name), and thus the _classNameOffset__ function
declared by the SYNCABLE_OBJECT macro is no longer needed.

Repurpose the macro to define the syncMetaObject() member function
instead, and remove the no-longer needed INIT_SYNCABLE_OBJECT
macro.
The syncMetaObject() function is used by the signal proxy for
accessing the metaObject() of the base class in case there are
client- or core-specific specializations of a syncable object;
i.e. if you have Foo directly inheriting from SyncableObject,
and ClientFoo derived from Foo, the function must only be
declared in Foo, otherwise syncing won't work.

Thus, the SYNCABLE_OBJECT macro declares the function as final,
so it can't be accidentally overridden.

While we're at it, replace include guards with #pragma once in
files we touched.

5 years agoqa: Remove lots of superfluous semicolons
Manuel Nickschas [Wed, 22 Aug 2018 19:15:11 +0000 (21:15 +0200)]
qa: Remove lots of superfluous semicolons

Since we have now enabled -Wpedantic, the compiler warns us about
superfluous semicolons, of which we apparently have a lot.
Remove them.

5 years agocmake: Reorder slightly for consistency
Manuel Nickschas [Wed, 29 Aug 2018 16:17:26 +0000 (18:17 +0200)]
cmake: Reorder slightly for consistency

Other modules link the main dependencies before caring about
options, so do the same for the core module.

5 years agocmake: Link resources statically, and init locally
Manuel Nickschas [Wed, 29 Aug 2018 16:15:47 +0000 (18:15 +0200)]
cmake: Link resources statically, and init locally

Link resource libraries statically in order to avoid problems with
symbol exporting. Move resource initialization from main() into the
respective libraries.

5 years agocmake: Add support for static libs to quassel_add_module
Manuel Nickschas [Wed, 29 Aug 2018 16:10:56 +0000 (18:10 +0200)]
cmake: Add support for static libs to quassel_add_module

We'll need this for building resource libraries, which we can't
easily export symbols from (and which also are not used more than
once).

5 years agocmake: Build shared libraries
Manuel Nickschas [Wed, 22 Aug 2018 21:47:22 +0000 (23:47 +0200)]
cmake: Build shared libraries

The days of static builds are finally over. Build dynamic libraries
for all Quassel modules.

Let CMake handle the RPATH in a way that doesn't cause inconvenience;
always set an RPATH in the build tree so the correct libraries
are loaded, and also set an RPATH for installed binaries unless
they go into a system location.

Also define output directories for all build artifacts.

5 years agocmake: Modernize compile settings; require C++14
Manuel Nickschas [Wed, 22 Aug 2018 18:15:50 +0000 (20:15 +0200)]
cmake: Modernize compile settings; require C++14

Clean up QuasselCompileSettings.cmake, treat GNU and Clang the same.
Use add_compile_options() instead of CMAKE_CXX_FLAGS. Curate the list
of compiler flags, and add sensible linker flags, too.

Check explicitly for required compiler features using CMake's
target_compile_features(), rather than hard-coding compiler versions.
The set of required features basically implies that we now require
a C++14 compiler (even though the new stuff isn't used in the code
yet).

5 years agocmake: Build Windows icon resource again
Manuel Nickschas [Tue, 21 Aug 2018 22:29:17 +0000 (00:29 +0200)]
cmake: Build Windows icon resource again

Building the Windows resource got lost while refactoring the build
system, so bring it back.

5 years agocmake: Modernize translation generation
Manuel Nickschas [Tue, 21 Aug 2018 21:31:45 +0000 (23:31 +0200)]
cmake: Modernize translation generation

Refactor and modernize the CMake support for translation generation.
Properly use targets, custom commands and dependencies to ensure that
files are only regenerated when needed, and avoid useless rebuilds.

Avoid individual invocations of lupdate and lrelease, which both
support processing multiple files at once.

Make use of the newly added quassel_add_resource function instead of
building the .qrc file explicitly.

Fix LINGUAS support, which was previously not working as intended.

5 years agocmake: Autogenerate most of the .qrc resource files
Manuel Nickschas [Wed, 15 Aug 2018 23:35:09 +0000 (01:35 +0200)]
cmake: Autogenerate most of the .qrc resource files

With the CMake support from the previous commit, resource files
can now be autogenerated. Do this for almost all resources;
the hicolor one is special because it uses aliases, and the i18n
one requires more work that is going to be added in a follow-up
commit.

Combine several of the previous resources (e.g. different icon sets)
to reduce complexity. This wasn't possible previously due to the
various configuration-specific combinations, but can now be done
dynamically by extending the glob patterns accordingly.

5 years agocmake: Add support for generating .qrc files
Manuel Nickschas [Wed, 15 Aug 2018 23:25:43 +0000 (01:25 +0200)]
cmake: Add support for generating .qrc files

Most .qrc files we use just map the (partial) contents of a
directory, so that can be autogenerated. Provide CMake functions
that support this endeavour to remove the need of regenerating
resource files if directory contents changes.

Since RCC is stupid, some hacks are required to make this work,
so we can't use either autorcc nor qt5_add_resource(); we must
invoke RCC manually. Clever use of targets and custom commands
as well as external CMake script invocation ensures that the .qrc
files are always up to date even if files change, while avoiding
useless rebuilds (as is currently still the case for i18n).

5 years agocmake: Fix source-specific compile definitions
Manuel Nickschas [Mon, 13 Aug 2018 21:50:24 +0000 (23:50 +0200)]
cmake: Fix source-specific compile definitions

set_source_files_properties() overwrites previously specified
properties and does not have a way to append, which is bad when
e.g. conditionally adding multiple compile definitions to a file.
In this particular case, for main.cpp -DHAVE_UMASK would overwrite
-DEMBED_DATA, and thus resources would not be loaded.

Use set_property(SOURCE... APPEND PROPERTY...) instead.

5 years agocmake: Modernize cmake support for LDAP
Manuel Nickschas [Wed, 8 Aug 2018 20:22:39 +0000 (22:22 +0200)]
cmake: Modernize cmake support for LDAP

Use a more modern, property-based find script for the LDAP libraries
and get rid of the deprecated use of LDAP_LIBRARIES and similar
variables in favor of a namespaced Ldap::Ldap target.
Set package properties for better diagnostic output at configure time.

5 years agocmake: Reorganize package finding
Manuel Nickschas [Mon, 6 Aug 2018 21:35:00 +0000 (23:35 +0200)]
cmake: Reorganize package finding

Use COMPONENTS to find required Qt5 modules in one go.
Don't look for QtWebKit if we already have QtWebEngine.
Look for Sonnet explicitly even when using KDE Frameworks, because
we're using its config widget and shouldn't rely on transitivity
here.
Only look for LDAP when building the core (or mono client).
Add QUIET everywhere to avoid spammy CMake warnings for optional
packages.
Add some diagnostic output indicating the versions of Qt and KF5.

5 years agocmake: Remove some compiler flags that are no longer needed
Manuel Nickschas [Mon, 6 Aug 2018 21:27:10 +0000 (23:27 +0200)]
cmake: Remove some compiler flags that are no longer needed

With the move to a property-based build system, we no longer need
special handling of -fPIC for Qt.

Also remove some things related to old KDE and CMake.

5 years agocmake: Set -DHAVE_UMASK only where it's needed
Manuel Nickschas [Mon, 6 Aug 2018 21:19:52 +0000 (23:19 +0200)]
cmake: Set -DHAVE_UMASK only where it's needed

Avoid setting this define globally when it's only used in two
files.

5 years agocmake: Remove boilerplate from HAVE_SSL check
Manuel Nickschas [Thu, 2 Aug 2018 23:32:35 +0000 (01:32 +0200)]
cmake: Remove boilerplate from HAVE_SSL check

Instead of setting flags and includes manually (potentially
polluting global variables), just link the test program to
Qt5::Core directly and rely on property propagation.

5 years agocmake: Modernize use of Qt Linguist Tools
Manuel Nickschas [Thu, 2 Aug 2018 23:11:08 +0000 (01:11 +0200)]
cmake: Modernize use of Qt Linguist Tools

All Qt versions we support provide an alias target for the linguist
tools. Thus, remove the fallback for older Qt versions.

Use the LOCATION property of the tools' target instead of relying
on the corresponding QT_L*_EXECUTABLE variables.

5 years agocmake: Modernize build system
Manuel Nickschas [Thu, 2 Aug 2018 21:16:22 +0000 (23:16 +0200)]
cmake: Modernize build system

Move to the modern, property-based way of using CMake. This
simplifies a lot of things:
 - No need to manually specify interface include dirs and libraries
   of dependencies
 - No need to carry around variables
 - Clear separation of local and global dependencies and definitions
 - No need for hacks to make the triple-executable thing work

Provide convenience functions to set up library and executable
targets. This will make it very easy in the future to split up
some modules, as well as move towards using shared libraries.

Use the modern, property-based way of using Qt, too. This removes
the need for the deprecated qt5_use_modules() macro, and a bunch
of manual things we had to do to get the compile flags right
for the different Quassel executables.
Also make use of CMake's AUTOUIC and AUTORCC to avoid a bunch of
boilerplate for dealing with .ui files and Qt resources.

Move the .ui files from their subdirectory into the qtui directory,
since the separation doesn't really make too much sense. We'd rather
want to split the QtUi module into smaller parts/libraries.

Remove a bunch of unnecessary stuff from the CMake files.

5 years agocmake: Remove custom build types
Manuel Nickschas [Wed, 1 Aug 2018 20:12:09 +0000 (22:12 +0200)]
cmake: Remove custom build types

The non-standard build types DebugFull and Profile (which we took
from KDE4) are not supported by e.g. Qt, so remove them.

Improve build type handling; show the supported values in CMake GUIs
and provide a sensible default if none is given (Release unless
a .git directory is present, in which case Debug is default).

5 years agocmake: Remove support for building static binaries
Manuel Nickschas [Tue, 31 Jul 2018 21:14:16 +0000 (23:14 +0200)]
cmake: Remove support for building static binaries

Building and running static binaries has become increasingly
difficult on modern systems, in particular when involving
complex libraries like Qt due to their reliance on plugins and
other dynamically loaded resources. It is also a security risk,
as upgrades to system libraries won't apply to the static binary.

Having a static quasselcore binary was quite useful when it was
hard to get Qt on an X11-less box, but these days all major distros
support modular Qt, and can provide Quasselcore packages that
don't require graphical dependencies. Consequently, we no longer
intend to offer static binaries.

Thus, remove the corresponding hacks from the build system.

5 years agocmake: Use official CMake config for QCA
Manuel Nickschas [Tue, 31 Jul 2018 20:18:05 +0000 (22:18 +0200)]
cmake: Use official CMake config for QCA

QCA has been shipping with a CMake config for a while, so use this
rather than providing a custom find module. Remove the custom
modules, as well as FindLibraryWithDebug.cmake which was only used
by them.

Move KeyEvent from common into core, since it's only used there.

5 years agocmake: Use official FindBacktrace rather than custom FindExecInfo
Manuel Nickschas [Tue, 31 Jul 2018 19:16:32 +0000 (21:16 +0200)]
cmake: Use official FindBacktrace rather than custom FindExecInfo

Newer versions of CMake ship their own FindBacktrace.cmake module,
which replaces the FindExecInfo.cmake module so far shipped by
Quassel. The official module is also a bit more thorough in terms
of cross-platform support.

To avoid duplication, remove Quassel's custom find module and use
the official one instead.

5 years agocmake: Bump minimum required CMake version to 3.5
Manuel Nickschas [Wed, 25 Jul 2018 22:47:13 +0000 (00:47 +0200)]
cmake: Bump minimum required CMake version to 3.5

This is the version shipped with Ubuntu 16.04 "Xenial", so
use this as a minimum requirement.

5 years agocmake: Only require a C++ compiler
Manuel Nickschas [Wed, 25 Jul 2018 20:49:27 +0000 (22:49 +0200)]
cmake: Only require a C++ compiler

With miniz gone, the only reason to still specify both C and CXX
as project languages is the use of the check_include_file cmake
macro.

Turns out there's a C++ version of that one, too; so use it.

5 years agocmake: Make zlib a required dependency, remove bundled miniz
Manuel Nickschas [Wed, 25 Jul 2018 21:59:57 +0000 (23:59 +0200)]
cmake: Make zlib a required dependency, remove bundled miniz

These days, zlib should be easily available on all platforms we
support, so make it a required dependency. This allows for removing
the bundled drop-in replacement miniz.

5 years agocommon: Rework command line option handling
Manuel Nickschas [Mon, 30 Jul 2018 22:15:52 +0000 (00:15 +0200)]
common: Rework command line option handling

Since we can now rely on Qt5's QCommandLineParser, there is
no longer a need for an abstraction for command line parsing.
Use QCommandLineParser directly, and remove the now obsolete
AbstractCliParser and its various implementations.

Move command line parsing into Quassel::init(), which allows for
using translated strings. Make user-visible strings translateable.

Remove the long-deprecated --datadir option for now (may come
back if we decide to allow for specifying the database location
independently of config files).

5 years agocommon: Initialize translations in Quassel::init()
Manuel Nickschas [Thu, 26 Jul 2018 20:58:40 +0000 (22:58 +0200)]
common: Initialize translations in Quassel::init()

In order to have localized strings during initialization, e.g. for
command line options, the translation catalogue must be loaded
early.

Since at this point the UI configuration is not available yet,
the system locale is used. QtUi will reload translations afterwards
later if a language different from the system locale is configured
for the UI.

5 years agoqt4-b-gone: Initialize data dir paths on demand
Manuel Nickschas [Thu, 26 Jul 2018 20:07:24 +0000 (22:07 +0200)]
qt4-b-gone: Initialize data dir paths on demand

Since special handling for KDE4 data locations was removed, it is
no longer required to set the paths from the outside. Simply
initialize the paths on first use.

5 years agoqt4-b-gone: Reorganize the initialization sequence
Manuel Nickschas [Thu, 26 Jul 2018 19:21:40 +0000 (21:21 +0200)]
qt4-b-gone: Reorganize the initialization sequence

KDE4 required special handling during initialization, because command
line arguments needed to be parsed before instantiating the
application object. Since this is no longer required, the sequence
can now be simplified.

To prepare for enabling early translations (also for the CLI parser),
instantiate the application first, then explicitly initialize the
Quassel instance in main() (which will later both load translations,
and handle CLI options). Only then also initialize the application
itself.

Since initialization errors are handled by exceptions anyway, get rid
of the return values for the various init() methods, too.

5 years agoqt4-b-gone: Remove bundled sha512 implementation
Manuel Nickschas [Tue, 17 Jul 2018 23:00:58 +0000 (01:00 +0200)]
qt4-b-gone: Remove bundled sha512 implementation

Qt5 supports SHA512 natively, so we no longer need to ship an
external implementation.

5 years agoqt4-b-gone: Remove all code supporting Qt < 5.5 and KDE4
Manuel Nickschas [Tue, 17 Jul 2018 22:42:45 +0000 (00:42 +0200)]
qt4-b-gone: Remove all code supporting Qt < 5.5 and KDE4

Remove compatibility code for Qt versions we no longer support.

5 years agoqt4-b-gone: Remove support for Phonon
Manuel Nickschas [Tue, 17 Jul 2018 20:11:01 +0000 (22:11 +0200)]
qt4-b-gone: Remove support for Phonon

Phonon is superseded by QtMultimedia, which offers everything we need
for playing audio notifications.

5 years agoqt4-b-gone: Remove support for libindicate
Manuel Nickschas [Tue, 17 Jul 2018 20:07:03 +0000 (22:07 +0200)]
qt4-b-gone: Remove support for libindicate

libindicate-qt only exists for the dead Qt4, so remove support
for it.

5 years agocmake: Bump minimum required version of Qt to 5.5.0
Manuel Nickschas [Tue, 17 Jul 2018 21:23:27 +0000 (23:23 +0200)]
cmake: Bump minimum required version of Qt to 5.5.0

This version of Qt is provided in Ubuntu "Xenial" 16.04, which is our
new baseline for distro support.

5 years agocmake: Remove build system support for Qt4/KDE4
Manuel Nickschas [Mon, 16 Jul 2018 22:11:57 +0000 (00:11 +0200)]
cmake: Remove build system support for Qt4/KDE4

In our quest to modernize the codebase, remove support for the
long-dead Qt4 libraries (and consequently, also for integration
into KDE4) from the build system.

5 years agotravis: Add bionic as target distro
Manuel Nickschas [Mon, 18 Jun 2018 17:50:49 +0000 (19:50 +0200)]
travis: Add bionic as target distro

This allows us to test building Quassel against a recent release
of Ubuntu, as well.

5 years agotravis: Add jobs for building against KDE Frameworks
Manuel Nickschas [Mon, 18 Jun 2018 17:27:15 +0000 (19:27 +0200)]
travis: Add jobs for building against KDE Frameworks

Define CMake options in a more generic way, and use this to define
builds against KDE Frameworks.

5 years agotravis: Use docker-based builds, new baseline
Manuel Nickschas [Sun, 17 Jun 2018 17:52:12 +0000 (19:52 +0200)]
travis: Use docker-based builds, new baseline

Perform Linux builds in docker images, which allows us to freely
define the build environment rather than relying on the Travis host
system.

Use Ubuntu 16.04 "Xenial" as the new baseline for Quassel, allowing
us to make use of a more modern toolchain.

Reorganize and modernize travis.yml in general.

5 years agoPost-release version bump 0.14-pre
Manuel Nickschas [Sat, 17 Nov 2018 19:49:54 +0000 (20:49 +0100)]
Post-release version bump

5 years agoBump version for release 0.13.0
Manuel Nickschas [Thu, 15 Nov 2018 23:46:16 +0000 (00:46 +0100)]
Bump version for release

5 years agoUpdate ChangeLog
Manuel Nickschas [Thu, 15 Nov 2018 23:44:51 +0000 (00:44 +0100)]
Update ChangeLog

5 years agoMinor cleanup of BufferView
Manuel Nickschas [Fri, 16 Nov 2018 19:04:01 +0000 (20:04 +0100)]
Minor cleanup of BufferView

Fix some nitpicks.

5 years agoAllow selecting the search result when searching for buffers
Martin T. H. Sandsmark [Mon, 29 Oct 2018 11:52:17 +0000 (12:52 +0100)]
Allow selecting the search result when searching for buffers

If multiple buffers are displayed when filtering by name, allow
selecting one of the using the up/down keys. This makes it possible
to jump to a buffer other than the topmost.

5 years agocommon: Fix syncing of BufferViewManager
Manuel Nickschas [Wed, 7 Nov 2018 20:01:39 +0000 (21:01 +0100)]
common: Fix syncing of BufferViewManager

Two syncable methods where accidentally demoted from being slots,
so adding/removing buffer views would not be synced anymore.

Fix this by making those methods slots again.

5 years agoqtui: Make the debug log a proper dialog
Manuel Nickschas [Tue, 6 Nov 2018 22:46:33 +0000 (23:46 +0100)]
qtui: Make the debug log a proper dialog

For some reason unbeknownst and shrouded in ancient mystery, the
debug log was displayed in a naked widget, which caused it to not
be rendered in a window when using not-so-smart window managers
(such as Windows™).

Make the debug log a proper dialog, and also fix the close button
not being part of a platform-agnostic QDialogButtonBox, while we're
at it.

5 years agocore: Avoid Clang warning for inconsistent override
Manuel Nickschas [Thu, 1 Nov 2018 09:09:35 +0000 (10:09 +0100)]
core: Avoid Clang warning for inconsistent override

5 years agoircuser: Fix setting of away message time by pre-0.13 cores
Manuel Nickschas [Tue, 30 Oct 2018 16:26:43 +0000 (17:26 +0100)]
ircuser: Fix setting of away message time by pre-0.13 cores

IrcUser::setLastAwayMessage() is called by pre-0.13 cores (newer
cores call setLastAwayMessageTime() instead). Fix wrong use of
QDateTime::from[M]SecsSinceEpoch(), which is a static method returning
a new QDateTime instance rather than a modifying setter.

Also fix signatures passing primitive types as const refs.

5 years agoqtui: Disable web preview by default
Manuel Nickschas [Tue, 30 Oct 2018 19:07:44 +0000 (20:07 +0100)]
qtui: Disable web preview by default

Upon popular request, disable the web preview by default. This
feature tends to surprise unwitting new users that just happen
to hover over a questionable link, and the preview's functionality
is limited anyway with today's complex websites.

The web preview can still be enabled explicitly in chatview settings.
Existing configurations are unaffected by this change.

5 years agoFix the order of the Davids
David ‘Bombe’ Roden [Mon, 22 Oct 2018 14:04:16 +0000 (16:04 +0200)]
Fix the order of the Davids

5 years agoBump version for release 0.13-rc2 build/0.13-rc2
Manuel Nickschas [Mon, 15 Oct 2018 17:51:51 +0000 (19:51 +0200)]
Bump version for release

5 years agoUpdate ChangeLog
Manuel Nickschas [Mon, 15 Oct 2018 17:51:00 +0000 (19:51 +0200)]
Update ChangeLog

5 years agocommon: Remove left-overs from signal handling rework
Manuel Nickschas [Sun, 14 Oct 2018 19:39:03 +0000 (21:39 +0200)]
common: Remove left-overs from signal handling rework

Remove some remnants of the old code that were missed when pushing
the reworked implementation.

5 years agoclient: For filter, prioritize exact, startsWith
Shane Synan [Sat, 6 Oct 2018 18:53:59 +0000 (13:53 -0500)]
client: For filter, prioritize exact, startsWith

When filtering buffer view results, prioritize exact string matches,
then prioritize startsWith matches, both case-insensitive.  Within
these results, sort normally (e.g. alphabetical).

This gives weight to exact matches and the start of the string.  When
no filter string is specified, sorting goes back to normal.

Search string: "car"
Before:
> acar
> bcar
> careful
> caring
> racecar
> car [hidden]

After:
> car [hidden]
> careful
> caring
> acar
> bcar
> racecar

Where [hidden] represents a buffer that's temporarily or permanently
hidden.

5 years agoclient: Sort network name case-insensitively
Shane Synan [Sat, 6 Oct 2018 17:48:20 +0000 (12:48 -0500)]
client: Sort network name case-insensitively

Set BufferViewFilter to sort case-insensitively.  This results in
network names being sorted regardless of case.  Channel/nickname
sorting is handled elsewhere.

Before:
> Alpha
> Freenode
> beta

After:
> Alpha
> beta
> Freenode

This probably matches expectations better, and hopefully doesn't
break existing workflows too much...  https://xkcd.com/1172/

5 years agocommon: Don't use unsafe functions when handling POSIX signals
Manuel Nickschas [Fri, 5 Oct 2018 21:07:04 +0000 (23:07 +0200)]
common: Don't use unsafe functions when handling POSIX signals

The set of functions we're allowed to safely use in a POSIX signal
handler is very limited, and certainly does not include anything Qt.
While our previous implementation seemingly worked anyway as long as
all it did was quitting the application, we now start seeing issues
when doing a proper shutdown.

Fix this by providing a generic API for watching signal-like external
events that can be specialized for the various platforms we support.
Provide PosixSignalWatcher, which uses socket notification to safely
hand over control from the signal handler to the Qt event loop.

Also provide an implementation for Windows that still uses the
previous approach; since Windows doesn't support socketpair(), we
can't easily reuse the POSIX implementation. On the bright side, so
far we don't know if signal handlers on Windows face the same
limitations as on POSIX anyway...
Also on Windows we now support console events, i.e. Ctrl+C as well
as closing the console window.

5 years agoqtui: Don't parent dialogs created on the stack
Manuel Nickschas [Thu, 4 Oct 2018 10:52:42 +0000 (12:52 +0200)]
qtui: Don't parent dialogs created on the stack

Dialogs that are created on the stack should not have a parent,
lest they get double-deleted if the main window is destroyed while
such a dialog is still open.

5 years agoRevert "qtui: Don't create parented dialogs on the stack"
Manuel Nickschas [Thu, 4 Oct 2018 10:19:54 +0000 (12:19 +0200)]
Revert "qtui: Don't create parented dialogs on the stack"

Auto-deleting dialogs is a bad idea if we're accessing the instance
after exec(). We could work around this in the affected cases,
however it may be easier and cleaner to create the dialogs on the
stack again, but don't parent them to avoid the crashes we intended
to fix with this commit.

This reverts commit 4e452ee828fdb411e6b1db07c18e02681a30ff27.

5 years agocommon: Don't warn on unknown user in IrcChannel
Manuel Nickschas [Sat, 29 Sep 2018 17:47:05 +0000 (19:47 +0200)]
common: Don't warn on unknown user in IrcChannel

When quitting a channel, the IrcChannel instance may still be
receiving pending events for IrcUsers that have already been removed.
Don't log a warning in this case, because it doesn't help and confuses
users.

5 years agocore: Fix quitting from networks on shutdown
Manuel Nickschas [Sat, 29 Sep 2018 17:38:43 +0000 (19:38 +0200)]
core: Fix quitting from networks on shutdown

The previous implementation relied on processEvents() to let the
QUIT command be sent to the IRC server. However, processEvents()
does not guarantee that it processes all events (also in other
threads), and indeed, the previous approach was not reliable.

Fix this by waiting for the networks to emit the disconnected()
signal after requesting the quit. There already is a 10 second
timeout in case the IRC server does not close the socket within
a reasonable time, so rely on that. Also ensure that connect requests
are ignored during shutdown.

With the CoreSession requesting a clean shutdown, we no longer need
a similar handling in CoreNetwork's dtor, so remove this.

See also GH-203 and GH-207, which were previous attempts on getting
this right.

5 years agocore: Allow clean shutdown of the core
Manuel Nickschas [Sat, 29 Sep 2018 15:31:42 +0000 (17:31 +0200)]
core: Allow clean shutdown of the core

Relying on things to happen while the core is being destroyed is
fragile (and does not work in practice), because events are no
longer delivered to objects that are scheduled for deletion.

Add an explicit call for shutting down the core, its sessions and
their networks. Wait for everything to be cleaned up properly before
quitting the session threads, and ultimately shutting down the main
event loop.

While we're at it, refactor SessionThread to follow the worker
pattern, rather than inheriting from QThread. This avoids accidentally
calling slots in the wrong thread. Ensure that all cross-thread
communication happens through queued signals. Simplify the API, too.

5 years agoqtui: Fix quit sequence and lifetime issues
Manuel Nickschas [Sat, 29 Sep 2018 09:52:12 +0000 (11:52 +0200)]
qtui: Fix quit sequence and lifetime issues

Make use of the Singleton mixin for Client and GraphicalUi. Fix
ownership and explicitly construct and destroy the pseudo singletons.
Remove some static init methods in favor of initializing in the
constructor where possible. We still need delayed initialization
of the main UI however, so GraphicalUi::init() has to stay.

Simply calling QCoreApplication::quit() doesn't clean up properly,
because it immediately stops event processing, which means that
any deferred deletions won't be processed anymore.

Since we perform some important and asynchronous tasks during
shutdown, such as saving settings and properly unregistering from
IRC, we really want proper cleanup, though.

Fix this by relying on Quassel::quit() instead, and registering
appropriate quit handlers that shut down the client in orderly
and controlled fashion. Ensure that all open windows and dialogs
are closed prior to MainWin's destruction.

Core shutdown warrants a more complex approach, which will be
implemented in a follow-up commit.

5 years agogit: Update .gitignore
Manuel Nickschas [Fri, 28 Sep 2018 20:54:15 +0000 (22:54 +0200)]
git: Update .gitignore

Actually hide project files from Qt Creator, as well as KDevelop.

5 years agocore: Use the Singleton mixin for the Core instance
Manuel Nickschas [Fri, 28 Sep 2018 20:28:33 +0000 (22:28 +0200)]
core: Use the Singleton mixin for the Core instance

Instead of implementing the instance pointer manually, use the
Singleton mixin.

5 years agocommon: Prepare Quassel::quit() to be used more widely
Manuel Nickschas [Fri, 28 Sep 2018 20:24:33 +0000 (22:24 +0200)]
common: Prepare Quassel::quit() to be used more widely

In the future we want to use Quassel::quit() as the central entry
point for cleanly quitting the application, instead of relying
on QCoreApplication::quit(), which directly stops the event loop
and thus won't process any asynchronous cleanup tasks.

Make the slot public, and protect against multiple invocations.

5 years agocommon: Use the Singleton mixin for the Quassel instance
Manuel Nickschas [Fri, 28 Sep 2018 19:41:31 +0000 (21:41 +0200)]
common: Use the Singleton mixin for the Quassel instance

Make use of the newly added Singleton mixon to remove the custom
handling of Quassel's instance pointer. Clearly define Quassel's
lifetime by making it a local instance in main(), rather than
relying on someone to call Quassel::instance() at the right time.

Now it is also clear that the instance is deleted after main()
returns (which was the case before, however there still was a no-op
Quassel::destroy() method too, which has now been removed). This
is fine, because Quassel does not own resources that should be deleted
before exiting the event loop.

5 years agocommon: Provide Singleton mixin for handling pseudo singletons
Manuel Nickschas [Fri, 28 Sep 2018 19:17:32 +0000 (21:17 +0200)]
common: Provide Singleton mixin for handling pseudo singletons

We have several singleton and pseudo-singleton classes in Quassel.
A pseudo singleton can be constructed and destroyed in a controlled
manner, but can be accessed through a static instance pointer while
it is alive. As an example, QCoreApplication behaves like this.

In order to avoid duplication and unify the behavior of our singletons
in the future, provide a mixin. Classes can inherit from this and gain
an instance() method, as well as protection against multiple
instantiation and access outside of the object's lifetime.

5 years agocommon: Don't warn when "closing" InternalPeer
Manuel Nickschas [Thu, 27 Sep 2018 22:56:35 +0000 (00:56 +0200)]
common: Don't warn when "closing" InternalPeer

InternalPeer may be closed legitimately like any other peer type.
Although for InternalPeer this just sets a flag, it should not
produce a warning claiming that the method is not implemented.

Also actually report the open status for InternalPeer. Ensure that
it is constructed in open state, otherwise a signalproxy cannot
be set.

5 years agoqtui: Don't create parented dialogs on the stack
Manuel Nickschas [Wed, 26 Sep 2018 22:09:26 +0000 (00:09 +0200)]
qtui: Don't create parented dialogs on the stack

Create dialogs in MainWin on the heap, rather than on the stack.
This avoids crashes when MainWin is destroyed while a dialog is
open (in which case a double free would happen).

Set the WA_DeleteOnClose attribute on affected dialogs so they will
be deleted upon close, rather than hanging around in memory until
shutdown.

5 years agocommon: Avoid crash on SignalProxy destruction
Manuel Nickschas [Tue, 25 Sep 2018 22:47:14 +0000 (00:47 +0200)]
common: Avoid crash on SignalProxy destruction

Since SignalProxy itself attaches a slot, it will try to detach
itself on destruction, leading to a crash. Avoid this by checking
for self-detachment.

5 years agoClean up translator attributions
Daniel Albers [Mon, 24 Sep 2018 20:58:52 +0000 (22:58 +0200)]
Clean up translator attributions

5 years agoRemove empty translation files
Daniel Albers [Tue, 12 Sep 2017 22:06:01 +0000 (00:06 +0200)]
Remove empty translation files

- es_AR
- et_EE
- id_ID
- uz@Latn
- zh_TW

5 years agoUpdate quassel.pot
Daniel Albers [Wed, 20 Dec 2017 04:00:06 +0000 (05:00 +0100)]
Update quassel.pot

5 years agoUpdate translations from Transifex
Daniel Albers [Tue, 5 Sep 2017 03:00:24 +0000 (05:00 +0200)]
Update translations from Transifex

  27958 translated messages

Many thanks to:
 - cs: Jaroslav Lichtblau <dragonlord@seznam.cz>
 - da: Joe Hansen <joedalton2@yahoo.dk>
 - de: Steve M <transifex@lostinweb.eu>
 - el: Theofilos Intzoglou <int.teo@gmail.com>
 - eo: Tinjo Kohen <tiffypet@yahoo.com>
 - es: Chris Egeland <chris@chrisegeland.com>, Javier Llorente
   <javier@opensuse.org>
 - fi: Lasse Liehu <larso@gmx.com>
 - fr: Guillaume Gay <guillaume.gay@gmail.com>, Olivier Caron
   <crn.olivier@gmail.com>, Zoddo <transifex.com@zoddo.fr>
 - hi: Raju Devidas Vindane <rajuvindane@gmail.com>
 - ko: Tae-Hoon KWON <zerolaunch@naver.com>, Sungjin Kang <potopro@gmail.com>
 - lt: Liudas Ališauskas <liudas.alisauskas@gmail.com>
 - mr: Raju Devidas Vindane <rajuvindane@gmail.com>
 - nb: Chris Egeland <chris@chrisegeland.com>, sandsmark
   <inactive+sandsmark@transifex.com>
 - nl: Joep Seuren <joepseuren1@gmail.com>
 - pa: A S Alam <apreet.alam@gmail.com>
 - pl: Miłosz Rachwał <transifex@milek7.pl>, derpella <matwa@poczta.pl>
 - pt: Vitor Luis <ptirc@protonmail.com>
 - pt_BR: André Marcelo Alvarenga <alvarenga@kde.org>, Lucas A. V. Dantas
   <lucasdantas@yandex.com>
 - ro: Arthur Țițeică <arthur.titeica@gmail.com>, Sergiu Bivol <sergiu@cip.md>
 - ru: Svetlana Tkachenko <svetlana@members.fsf.org>, Viktor Suprun
   <popsul1993@gmail.com>, Yaroslav Veremenko <yaroslav@veremenko.info>
 - sl: Andrej Mernik <andrejm@ubuntu.si>
 - tr: Demiray “tulliana” Muhterem <mdemiray@msn.com>, Volkan Gezer
   <volkangezer@gmail.com>
 - uk: Yuri Chornoivan <yurchor@ukr.net>
 - zh_CN: leonfeng <chaofeng111@qq.com>

5 years agoUpdate Transifex URL
Daniel Albers [Thu, 29 Mar 2018 11:39:05 +0000 (13:39 +0200)]
Update Transifex URL

5 years agoqtui: Fix load/save states of SonnetSettingsPage
Manuel Nickschas [Mon, 17 Sep 2018 21:50:18 +0000 (23:50 +0200)]
qtui: Fix load/save states of SonnetSettingsPage

Call the base class functions to ensure that the changed state is
reset properly.

Unfortunately, the Sonnect::ConfigWidget does not allow for direct
comparison of settings, so toggling a setting will still not
reset the changed state; but at least loading or resetting now will.

5 years agocore: Remove away-notify hack for non-spec server
Shane Synan [Fri, 14 Sep 2018 19:54:31 +0000 (14:54 -0500)]
core: Remove away-notify hack for non-spec server

Remove the AutoWho-on-JOIN hack for IRC servers that do not fully
comply with the "away-notify" spec by not sending ":AWAY :message"
when a user marked /away joins a channel.

Advantages:
* Less network traffic (no WHO for every nickname that joins)
* Less likely to expose other bugs where an IRC server returns
  something unexpected causing auto-who output to go in the status
  buffer

Disadvantages:
* On non-compliant IRC servers, Quassel will no longer accurately
  know the away status of someone that joins a channel while /away
* On IRC servers that implement "away-notify" but not
  "extended-join", Quassel will no longer learn the logged-in account
  and realname for someone that joins a channel
  (This will break showing realname, fallback avatar fetching)

Remove all functions related to automatic nickname WHO'ng as they are
no longer needed.  Leaving them in wouldn't cause any issues other
than unnecessary work and code clutter.

Add a comment pointing to this commit in case someone decides to
resurrect this workaround.

See https://ircv3.net/specs/extensions/away-notify-3.1.html
And https://bugs.unrealircd.org/view.php?id=5144

5 years agocore: Clean up AutoWho comments, variable names
Shane Synan [Fri, 14 Sep 2018 18:51:40 +0000 (13:51 -0500)]
core: Clean up AutoWho comments, variable names

Clean up AutoWho variable names using the "name" convention from
RFC 1459.

Clean up AutoWho comments likewise, referring to "name" instead of
"channel" where appropriate.

See https://tools.ietf.org/html/rfc1459#section-4.5.1

5 years agocore: Cancel nickname AutoWho on IrcUser quit
Shane Synan [Thu, 13 Sep 2018 06:34:44 +0000 (01:34 -0500)]
core: Cancel nickname AutoWho on IrcUser quit

Remove any queued AutoWho for <nickname> if <nickname> quits.  This
avoids sending a needless AutoWho for <nickname> that'll only either
result in "No such nickname" if we're lucky, or random results for
non-extended WHO if <nickname> happens to match the realname/etc of
other IRC users.

This should fix any remaining cases of join/quit resulting in AutoWho
output in the Status Buffer for a network.

5 years agocore: AutoWhoX, only search nickname by nickname
Shane Synan [Thu, 13 Sep 2018 07:00:17 +0000 (02:00 -0500)]
core: AutoWhoX, only search nickname by nickname

When running automatic WhoX, explicitly specify "n" to search by
nickname only.  Don't rely on server defaults.  This fixes an issue
with Quassel's autoWHO causing noise in the Status Buffer uncovered
by InspIRCd 3.0's implementation of WhoX that follows the spec.

Fix up incorrect attempt to escape "%" as "%%".  Apparently,
QString::arg() doesn't need to escape this.

Before: WHO <nickname> %%chtsunfra,<unique_number>
After:  WHO <nickname> n%chtsunfra,<unique_number>

See https://github.com/quakenet/snircd/blob/master/doc/readme.who
And https://doc.qt.io/qt-5/qstring.html#arg

Thanks to @genius3000 for reporting and tracking down this issue!

Fixes #1487

5 years agosettings: Fix NetworkAddDlg states on type change
Shane Synan [Wed, 12 Sep 2018 23:57:44 +0000 (18:57 -0500)]
settings: Fix NetworkAddDlg states on type change

Add check for button states when changing between "Use preset" and
"Manually specify network settings".

This fixes the "OK" button remaining enabled when adding a network
and selecting manual, and also fixes re-enabling the "OK" after
switching back to presets.

5 years agoutil: Remove T separator from ISO 8601 (RFC 3339)
Shane Synan [Wed, 12 Sep 2018 22:54:25 +0000 (17:54 -0500)]
util: Remove T separator from ISO 8601 (RFC 3339)

Remove the "T" separator when formatting ISO 8601 date/time to
strings.  This improves readability without sacrificing machine
parsing, remaining compliant with RFC 3339.

Technically ISO 8601 specification states "T" can only be omitted,
but that makes readability even worse.

Example:
> Before: 2018-08-22T18:43:10-05:00
> After:  2018-08-22 18:43:10-05:00
          ..........^ (10th character)

NOTE:  Qt's own ISO 8601 parsing of strings to QDateTime will not
handle this correctly.  Custom format strings can be used, or just
replace the " " with "T" again.

See https://en.wikipedia.org/wiki/ISO_8601#cite_note-32

4.3.2 NOTE: By mutual agreement of the partners in information
interchange, the character [T] may be omitted in applications where
there is no risk of confusing a date and time of day representation
with others defined in this International Standard.

And https://www.ietf.org/rfc/rfc3339.txt

NOTE: ISO 8601 defines date and time separated by "T".
      Applications using this syntax may choose, for the sake of
      readability, to specify a full-date and full-time separated by
      (say) a space character.

Fixes #1456

5 years agoqa: Don't return a const ref from Settings::localValue()
Manuel Nickschas [Mon, 10 Sep 2018 21:24:07 +0000 (23:24 +0200)]
qa: Don't return a const ref from Settings::localValue()

Stumbled on this by accident because one particular CI configuration
warned about Settings::localValue() returning a stack reference
(may happen if the default value (which is a const ref itself) is
returned).

Not sure why I don't see this warning in my own setup, but it's
legitimate; thus fix the issue.

5 years agoChange to an early continue for a NULL IrcUser
Matt Schatz [Sun, 9 Sep 2018 18:27:37 +0000 (12:27 -0600)]
Change to an early continue for a NULL IrcUser

Commit e9096505f07fc0c08a7c36f3680c1fde975d4f80 changed the behaviour
in joinIrcUsers() from skipping a NULL IrcUser or an already tracked
IrcUser to updating the usermodes of said IrcUser. The call to
addUserMode() will call isKnownUser() which will log a warning
of 'received IrcUser Nullpointer' and return false. This is safe
from crashing, but shouldn't be allowed to happen.

5 years agoqa: Avoid warning about missing field initializers
Manuel Nickschas [Wed, 5 Sep 2018 20:17:16 +0000 (22:17 +0200)]
qa: Avoid warning about missing field initializers

Some compiler setups throw a warning when default-brace-initializing
UiStyle::Format. Avoid this by explicitly constructing an instance.

5 years agoqa: Try to avoid fall-through warnings
Manuel Nickschas [Wed, 5 Sep 2018 21:12:04 +0000 (23:12 +0200)]
qa: Try to avoid fall-through warnings

GCC8 warns again about some intentional fallthroughs. Try to fix this
by adding comments.

5 years agoqa: Don't compile the expression match tests
Manuel Nickschas [Wed, 5 Sep 2018 20:11:56 +0000 (22:11 +0200)]
qa: Don't compile the expression match tests

Those are not used unless manually hacked in, and compiling them
causes warnings in some compiler setups, so don't compile the
tests at all.

They're still referenced in the CMakeLists.txt and can easily be
added back if desired. Longer term, they'll move into a real
test framework.

5 years agoclang-tidy: Avoid another bogus warning about a potential leak
Manuel Nickschas [Wed, 5 Sep 2018 19:09:19 +0000 (21:09 +0200)]
clang-tidy: Avoid another bogus warning about a potential leak

False positive, fixed by assigning to an attribute. Seems like
clang-tidy really doesn't like ephemeral objects even if they
have a parent.

5 years agoclang-tidy: Avoid memory leak in MainWin
Manuel Nickschas [Wed, 5 Sep 2018 18:58:46 +0000 (20:58 +0200)]
clang-tidy: Avoid memory leak in MainWin

This one is legitimate: If no network is selected, the freshly
created ChannelListDlg instance is never deleted. Move instantiation
after the network ID check, so the dialog is shown (and self-deletes
on close). Set a parent for good measure, too.

5 years agoclang-tidy: Avoid another warning about potential memory leak
Manuel Nickschas [Wed, 5 Sep 2018 18:53:24 +0000 (20:53 +0200)]
clang-tidy: Avoid another warning about potential memory leak

This is a false positive (since the newly created QFormLayout takes
a widget as its parent), however some slight rearrangement of
code shuts up clang-tidy without resorting to NOLINT.

5 years agoclang-tidy: Avoid potential memory leak in QtUi
Manuel Nickschas [Wed, 5 Sep 2018 18:39:12 +0000 (20:39 +0200)]
clang-tidy: Avoid potential memory leak in QtUi

Clean up the instance handling in QtUi (and GraphicalUi) to ensure
that a newly created QtUi instance is always assigned to the local
_instance variable. Otherwise, clang-tidy warns about a potential
memory leak (although this would not happen in practice).

5 years agoclang-tidy: Remove dead stores
Manuel Nickschas [Tue, 4 Sep 2018 23:13:11 +0000 (01:13 +0200)]
clang-tidy: Remove dead stores

5 years agoclang-tidy: Avoid warnings for calling virtual methods from ctor
Manuel Nickschas [Tue, 4 Sep 2018 22:37:25 +0000 (00:37 +0200)]
clang-tidy: Avoid warnings for calling virtual methods from ctor

MessageFilter and its derivatives call their idString() method
during construction in order to access their settings. This is fine,
but causes (legitimate) warnings in static analysis.

Make the scope explicit when calling idString() to avoid the warning,
and make it clear to readers that we're not interested in the derived
version.

5 years agoclang-tidy: Don't make methods virtual for no reason in SslServer
Manuel Nickschas [Tue, 4 Sep 2018 21:47:44 +0000 (23:47 +0200)]
clang-tidy: Don't make methods virtual for no reason in SslServer

SslServer was calling virtual methods during construction, which is
dangerous. Turns out those methods don't even need to be virtual, so
unvirtualize them.

5 years agoclang-tidy: Add nullptr check
Manuel Nickschas [Tue, 4 Sep 2018 21:26:08 +0000 (23:26 +0200)]
clang-tidy: Add nullptr check

5 years agoclang-tidy: Avoid potential memory leak in BufferViewManager
Manuel Nickschas [Tue, 4 Sep 2018 21:19:22 +0000 (23:19 +0200)]
clang-tidy: Avoid potential memory leak in BufferViewManager

Explicitly delete a freshly created BufferViewConfig in case it cannot
be added, rather than relying on QObject parentship - clang-tidy
warns about that. I'm rather sure that this is a false positive, but
better safe than sorry.

Simplify and clean-up related code a bit.

5 years agoclang-tidy: Reorder NetworkMO attributes to avoid excessive padding
Manuel Nickschas [Mon, 3 Sep 2018 23:31:22 +0000 (01:31 +0200)]
clang-tidy: Reorder NetworkMO attributes to avoid excessive padding

Use a more optimal attribute order to avoid excessive padding in the
NetworkMO struct.

5 years agoclang-tidy: Reorder NetworkInfo attributes to avoid excessive padding
Manuel Nickschas [Mon, 3 Sep 2018 23:18:10 +0000 (01:18 +0200)]
clang-tidy: Reorder NetworkInfo attributes to avoid excessive padding

Use a more optimal attribute order to avoid excessive padding in the
NetworkInfo struct.
Remove the default constructor in favor of direct initialization.
Rewrite the comparison operator using a boolean expression instead
of a bunch of conditions.

5 years agocipher.cpp: Default to CBC instead of ECB
alturiak [Mon, 3 Sep 2018 18:35:20 +0000 (20:35 +0200)]
cipher.cpp: Default to CBC instead of ECB

For security reasons (and compatibility to other irc-client's implementations), default to CBC for blowfish encryption.