summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Export QFSFileEngine symbolsKai Koehne2014-10-171-1/+1
| | | | | | | | Although it's private API the symbols are used e.g. in the Qt Installer Framework. Change-Id: I557d3b86dbf87cb1b712bae09c3e8fecf6f15e67 Reviewed-by: hjk <hjk121@nokiamail.com>
* QSettings: Prevent assert when passing empty keys.Friedemann Kleint2014-10-171-0/+8
| | | | | | | | | | | | | [ChangeLog][Important behavior changes][QSettings] QSettings::value() now returns an invalid QVariant when passing an empty key. The code path ran into an assert, which was only noticeable in debug builds. Task-number: QTBUG-41812 Change-Id: I5cc32be3aa267a132e9d6639ecd6cb0bbafc15b0 Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid sleeping 100ms in QProcessPrivate::drainOutputPipes()Oswald Buddenhagen2014-10-151-1/+1
| | | | | | | | | | | | There is no point in waiting 100 milliseconds after each iteration, as all data that we may possibly read will be already in the pipe. We only need to give the notifier thread a chance to inform us, which is best achieved with a yield. Task-number: QTBUG-41282 Change-Id: Id654b688246508494a5549c11900f9ad2957f192 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QSettings: undo unintentional change of config dir on non-XDG platforms.David Faure2014-10-121-1/+10
| | | | | | | | | | | | | | | c99dfd8f631289 only meant to be able to switch to the test mode of QStandardPaths, not to move the default dir on OS X, iOS, BB10 and Android. So this commit restores it to the previous behavior, to avoid migration issues. The use of XDG_CONFIG_HOME, defaulting to ~/.config, on OS X, is even documented in the current QSettings documentation, even though these paths are non-standard on OS X (granted, the use of ini-style config files isn't either). Task-number: QTBUG-41461 Change-Id: I5eb610ff7ccbdaf6f955ef7f8f7c2658cbecbb86 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Removing a few unneeded "? true : false"Alessandro Portale2014-10-091-3/+3
| | | | | | | Change-Id: Ib13f0ddd65fe78f5559f343f2fc30756b1d3ef76 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Don't use QStringLiteral in startsWith/endsWidthMarc Mutz2014-10-092-7/+7
| | | | | | | | | | | | | | | For QLatin1String, startsWith/endsWith is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just use QLatin1String instead. Change-Id: I7eaf464c67b55116f970fe7f58a85f19ce4d254e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4Gabriel de Dietrich2014-10-012-22/+17
|\
| * Merge remote-tracking branch 'origin/5.3' into 5.4Gabriel de Dietrich2014-09-292-22/+17
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_unix.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I6f1aa320d5ca66cd92d601a95885aeaab0abb191
| | * QSettings: Don't chop off trailing tabs that were actually part of a value.Christian Kandeler2014-09-231-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | This was done wrong when using the ini format. Task-number: QTBUG-22461 Change-Id: Ib9390460bce6138659cceac7e3cd25339ba5e9bb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Refactor some loops over EINTRGiuseppe D'Angelo2014-09-221-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | QT_CLOSE is #defined to be qt_safe_close which already performs the EINTR loop. So there's no need of doing other loops (either by hand or by the EINTR_LOOP macro). Change-Id: Icca256124def5ab5d79c2ba101c6f889c85d19da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * QFile: fix undefined behavior when closing a buffered fileGiuseppe D'Angelo2014-09-221-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C11 §7.21.3.4 [Files] says that The value of a pointer to a FILE object is indeterminate after the associated file is closed POSIX.1-2013 reinforces by saying that After the call to fclose(), any use of stream results in undefined behavior. This means we can't call fclose() again on a FILE *, even if fclose() returned EOF and set errno to EINTR. Change-Id: I282f4ff926e3c134729defa290c80d42431e97ce Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | | Logging: Disable tracking of debug source info for release buildsKai Koehne2014-10-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tracking the file, line, function means the information has to be stored in the binaries, enlarging the size. It also might be a surprise to some commercial customers that their internal file & function names are 'leaked'. Therefore we enable it for debug builds only. [ChangeLog][QtCore][Logging] File, line, function information are not recorded anymore for logging statements in release builds. Set QT_MESSAGELOGCONTEXT explicitly to enable recording in all configurations. Change-Id: I454bdb42bcf5b5a8de6507f29f2a61109dca9b91 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | | Doc: fix misleading documentation of QProcess::set[Process]EnvironmentJoerg Bornemann2014-10-011-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The example suggested that QProcess searches the PATH variable to find the executable for the child process. That's not true. The environment that's passed with setProcessEnvironment is just passed to the child process. Removed the misleading example and fixed the function's description. Task-number: QTBUG-7321 Change-Id: I8ac4b6b02002eb0a99686f09bcf45f9bc677c8e2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
* | | Fix hangs on QFileSystemWatcher.Leonard Lee2014-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFileSystemWatcher hangs at a mutex or semaphore when adding network paths on OS X system. There is an else block that does not increment the 'it' iterator with ++it; inside the QFseventsFileSystemWatcherEngine::checkDir() call. Change-Id: I6c250c7f3d25399c3a0a58ce864e9466320b166b Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* | | Doc: Use title case in section1 titlesNico Vertriest2014-09-303-9/+9
|/ / | | | | | | | | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Don't check for EINTR after calling QT_READ / QT_WRITEThiago Macieira2014-09-281-4/+2
| | | | | | | | | | | | | | | | | | | | On Unix, those functions are already #define'd to qt_safe_read and qt_safe_write, which do the necessary EINTR handling. On Windows, EINTR cannot happen. Change-Id: I50c46472c04bd90a0bac51c725cc86311ae905c8 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Fix handling of IPv6 addresses in QUrl::fromUserInputThiago Macieira2014-09-281-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPv6 addresses can start with ":", for which QDir::isAbsolute() would always return true (QResourceFileEngine::isRelativePath() returns constant false) and would trip the calculation for local files. Similarly, IPv6 addresses can start with strings that look like Windows drives: "a:", "b:", "c:", "d:", "e:" and "f:" (though not today, as those address blocks are unassigned). Since a valid IPv6 address will definitely require at least one more colon and Windows file names cannot contain ':', there's no ambiguity: a valid IPv6 address is never a valid file on Windows. This resolves the ambiguity in favor of IPv6 for Unix filenames (which can contain a colon) and in case of an URL containing scheme, relative path and no authority ("dead:beef::" for example could have been parsed as scheme() == "dead" and path() == "beef::"). Task-number: QTBUG-41089 Change-Id: Id9119af1acf8a75a786519af3b48b4ca3dbf3719 Reviewed-by: David Faure <david.faure@kdab.com>
* | Refactored qt_normalizePathSegmentsOliver Wolff2014-09-251-90/+104
| | | | | | | | | | | | | | | | | | | | | | There were several use cases that did not work with the old implementation and it was not really readable. Task-number: QTBUG-3472 Task-number: QTBUG-40067 Task-number: QTBUG-23892 Change-Id: I1e038792dc54cdc6f8d9bb59d80b11dd3c56fac6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Update license headers and add new license filesMatti Paaso2014-09-24123-2313/+1329
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-2311-38/+65
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| * Add missing private headers warningSamuel Gaist2014-09-042-0/+22
| | | | | | | | | | Change-Id: I7a4dd22ea3bcebf4c3ec3ad731628fd8f3c247e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Doc: corrected autolink errors corelib ioNico Vertriest2014-08-277-38/+39
| | | | | | | | | | | | Task-number: QTBUG-40362 Change-Id: If11700d57db75ad7605bd8d53681002639c2e785 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
| * Fix a memory leak in QFseventsFileSystemWatcherEngineAndy Shaw2014-08-181-0/+1
| | | | | | | | | | | | | | | | Add a missing NSAutoReleasePool Task-number: QTBUG-38637 Change-Id: Ib69d92b6e9c4327cbb74f7814a45773bfc2ee526 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
| * Make sure we don't cache old file sizes prior to new writesThiago Macieira2014-08-131-0/+3
| | | | | | | | | | | | | | | | | | If we write to a file, its size changes. We should drop previous size caches. Change-Id: Ib687c91e5fc88cab588c89023f23da9622160da9 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | Fix 64 bit issues in QIODevicePrivateLinearBufferLars Knoll2014-09-152-9/+13
| | | | | | | | | | | | | | | | | | The API was using int, not qint64 leading to implicit truncation of numbers in a few places Task-number: QTBUG-40974 Change-Id: I13aedc84557a19b6f74fe6825764e7b5827f27b0 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | QLockFile: on Windows, retry deleting the lock file if it is being read.David Faure2014-09-112-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A "sharing violation" happens when trying to delete the lock file and another thread/process is reading it at that very moment. Detect the error and try again, up to 10000 times - to avoid an infinite loop if QFile::remove fails for another reason such as a sudden change of permissions preventing us from deleting our own lock file. On Unix the deletion can't fail because of readers, but it doesn't hurt to check the return value there too, to catch other reasons for failures such as a sudden permission change. Task-number: QTBUG-38853 Change-Id: Icf12a74faed4a4916e3427abc09d9c33aa141476 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix nativeRead() for maxlen greater than UINT_MAXLars Knoll2014-08-291-4/+4
| | | | | | | | | | | | | | | | | | | | Don't truncate the maxlen to a DWORD. Instead read all data incrementally up t maxlen. Task-number: QTBUG-27796 Change-Id: I21c34d11046f1106244dcd77420cc472e7240e68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Doc: language corrections QStorageInfo classNico Vertriest2014-08-271-55/+55
| | | | | | | | | | | | | | Task-number: QTBUG-40984 Change-Id: Idf8c6ecedb25f6c55b3fe8db69e6de9d9f2eaf74 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* | WinRT: Do not forget the path specificationMaurice Kalinowski2014-08-191-1/+1
| | | | | | | | | | | | | | | | The path value can be used to access any container or subcontainer in the settings, even if it is not created by Qt. Change-Id: I431d8a8b129dafb4ec85227421dc37ec76c18ecf Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* | Compile on Android without statfs.f_flagsAllan Sandfeld Jensen2014-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | Not all Android versions appear to have f_flags in statfs, but we can check for the presence using a feature define. Change-Id: Ib2acf6063d6211b871f462ee491459ac8675aa37 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add the QStorageInfo classIvan Komissarov2014-08-138-7/+1576
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows to retrieve information about mounted volumes such as label, total/available size, filesystem type and so on. Possible use cases are: - allows to do checks about filesystem before performing actual operation (such as available/maximum volume size) - allows to retrive information about volume that can be shown in file dialogs - allows to retrieve volume for specific path and check if two or more paths belong to the same volume or not [ChangeLog][QtCore] Added QStorageInfo class to retrive information about mounted volumes and drives Change-Id: Ibf9c2e6b53ef39c5605894a4422acdbbca4030c4 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Implement native settings format for WinRTMaurice Kalinowski2014-08-134-4/+705
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WinRT stores settings inside the app bundle, not in the registry. Some tests are not fully functional due to errors in the file implementation (See QTBUG-40588). QSettings::SystemScope translates to a roaming container on WinRT, meaning that settings stored inside there should be uploaded and shared among devices. However, this is untested so far. The tests have been updated for those platforms which do not store the order of keys. This has been done on some locations only so far, but needed to be done on more places for WinRT. Task-number: QTBUG-33498 Change-Id: Ifd0194387b09c220d31812b4b6fd0ce9a7d84d24 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* | Micro-optimize QUrl::topLevelDomainJędrzej Nowacki2014-08-091-2/+4
| | | | | | | | | | | | | | | | Using QStringRef saves few instructions Change-Id: I0d67a1f6a1c1385c88a8b21cb98b9c7dbdfb66e5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Micro-optimize QDir::relativeFilePathJędrzej Nowacki2014-08-091-1/+5
| | | | | | | | | | | | | | | | Use QString::splitRef on platforms with case sensitive paths, to avoid unnecessary allocations. Change-Id: Iff331a5eb67c4cbaf1333e663e77290261c5b013 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Add missing #include <qdatastream.h> or <qiodevice.h>Thiago Macieira2014-08-071-0/+1
| | | | | | | | | | | | | | Lots of code depended on an indirect includes from qstringlist.h. Change-Id: I33d0dce33d64302d6c0e49180cc1249b90ab27c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Rework of QSysInfo OS and kernel version functionsThiago Macieira2014-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch splits the OS product from the kernel name and versions. Previously, it was a little confusing. Thus, osType is split in two: kernelType() always returns the kernel type, which includes "linux" for Android, "darwin" for iOS and OS X, "qnx" for BlackBerry, and "windows" for all the Windows OSes. The Linux distribution name and the visible product names are found in productType(), with the respective versions in productVersion(). For an update system, applications probably want to send all four tokens: - for Android, BlackBerry, iOS, OS X and Windows, the relevant information is productType and productVersion - for Linux distributions, in addition to productType and productVersion, the kernelType ("linux") is useful as a fallback and it's important for Debian/kFreeBSD and Debian/GNU - for other Unix systems, the relevant information is kernelType and kernelVersion Change-Id: I66c36d5a4ddfad47babfc6744d752273705e7076 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | QDebug: Improve QDebug stream operator for QFlagsKai Koehne2014-07-301-6/+6
| | | | | | | | | | | | | | | | Use the built-in hex, showbase manipulator to format the number in hex. Also, apply nospace() only once. Change-Id: Id4b3d5f082ad13f52c8711408d7ec609bec3a621 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Remove normalization of "default" categoryKai Koehne2014-07-304-77/+3
| | | | | | | | | | | | | | | | | | | | | | | | Commit d61e774307819 got rid of the special handling of the 'default' category in the qloggingregistry, so we don't need the private header file anymore, nor does it gain us anything to 'normalize' all default categories to one string. Change-Id: I027b4b82ff915428287432f39f76b4e719cf7874 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QUrl: fromLocalFile(QString()) should lead to an empty URL.David Faure2014-07-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is much more useful than the URL "file:", it allows to use "empty path" and "empty URL" for the same meaning (e.g. not set). QFileDialog actually uses "file:" though, as the URL for the "My Computer" item in the sidebar. This patch preserves that. [ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL if the input string is empty. Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QSettings: use QSaveFile and QLockFile to write the settingsOlivier Goffart2014-07-241-235/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old unix locking code is no longer working on unix since it locks on a file descriptor, but QSaveFile creates a new file, and as a result we get the lock on the wrong file. Also there is no need to keep the lock held only for reading as QSaveFile is atomic. It just needs to be held when doing a read before writing. As a result, since we don't hold the same lock, there could be a race with an application running an older version of Qt if they are writing on the same configuration file. [ChangeLog][QtCore][QSettings] Fixed data loss while writing the config to the disk fails. [ChangeLog][Important behavior changes] The locking mechanism inside QSettings has changed and is no longer compatible with the one of previous versions of Qt. There might be corruption if two applications running different versions of Qt are writing to the same config file at the same time. You must also now have write permissions in the directory containing the settings file in order to write settings Task-number: QTBUG-21739 Change-Id: I0844a5e96c8bc1e1222a3dac6cc48170ca77fe1b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Make QTextStream respect QLocale with OmitGroupSeparatorsThiago Macieira2014-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The default in QTextStream is to use the C locale, so default QTextStream are not affected. When you set a QLocale on it, the default was to use group separators (which is the QLocale default too). This commit makes QTextStream respect a QLocale in which the OmitGroupSeparators option had been set. Task-number: QTBUG-39956 Change-Id: I00fbe12fca7f0287c7217deb487ded6582a03b52 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QSettings: use QStandardPaths to get XDG_CONFIG_HOME.David Faure2014-07-231-0/+6
| | | | | | | | | | | | | | | | | | This allows to use the "test mode" of QStandardPaths in unittests, to stay away from the user's real settings. Change-Id: I1cb1f63a4bff35dfe236924c4dcd7cf761ee50c1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Support setting a default severity level for QLoggingCategoryKai Koehne2014-07-234-35/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to alter the default configuration for categories by passing a message type: All message types with lower severity are disabled in this category. This is useful for libraries, which shouldn't mess with the category registry itself: Setting rules, a category filter ... might cause conflicts and ordering problems, so this API should be reserved to the specific application. For the Qt categories, we have code in the default category filter that disables the 'debug' category. However, this is hardcoded, and there's no way so far for other libraries to get the same behavior. With this patch one can get the same behavior: Q_LOGGING_CATEGORY(DRIVER_USB_EVENTS, "driver.usb.events", QtWarningMsg); [ChangeLog][QtCore][Logging] Added QtMsgType argument to QLoggingCategory constructor and Q_LOGGING_CATEGORY macro that controls the default category configuration. Change-Id: Ib2902f755f9f7285d79888ec30e8f3cef95ae628 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QDebugStateSaver: Fix trailing space issuesKai Koehne2014-07-231-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ~QDebug() removes any trailing space if autoInsertSpaces() is true. However, if one uses QDebugStateSaver the global autoInsertSpaces might be false, but a space was added by a custom operator<<. Explicitly check for this in QDebugStateSaverPrivate::restoreState. Remove any trailing space if the local state asks for adding trailing spaces, but the original one doesn't. Add a trailing space if the local state doesn't ask for one, but the global state does. Change-Id: I243b5c76d5ed2c1ec4820da35ab6e254da1551d9 Reviewed-by: David Faure <david.faure@kdab.com>
* | QLockFile/Windows: Determine host name from environment variable COMPUTERNAME.Friedemann Kleint2014-07-231-9/+16
| | | | | | | | | | | | | | | | Useful when using shared directories. Task-number: QTBUG-39967 Change-Id: I2c082e33133b00306378b6ff58478e94119e6a0e Reviewed-by: David Faure <david.faure@kdab.com>
* | Be more specific in "Loading logging rules" debug outputKai Koehne2014-07-231-1/+1
| | | | | | | | | | Change-Id: I8a6f1797cbcfabc6df76ce17115a678f729ac711 Reviewed-by: hjk <hjk121@nokiamail.com>
* | Introduce Q_DECL_UNUSED_MEMBER for clangKai Koehne2014-07-232-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since version 3.2, clang warns about unused member variables (-Wunused-private-field). Marking such members with Q_DECL_UNUSED_MEMBER will silence this warning. This is a cleaner way than using Q_UNUSED() somewhere in the class methods (like we did previously in qloggingcategory.cpp). It mirrors Q_DECL_UNUSED for unused variables, which however can't be used unconditionally for member variables because e.g. gcc will complain. Change-Id: I2afff683a7c3bae3bdcd684e5085a643887bb2a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* | Add QFileDevice::MemoryMapFlags::MapPrivateOption flag.Simon Sasburg2014-07-234-7/+36
| | | | | | | | | | | | | | | | | | | | Passing this flag to QFileDevice::map() will allow writes to the mapped memory without modifying the file that was mapped. These writes will be lost when the memory is unmapped. Change-Id: I7d46b044fc370585de8c06fdb4059f1f1be12d7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Fix warnings about integer conversion in qloggingregistry.cpp.Friedemann Kleint2014-07-221-3/+3
| | | | | | | | | | | | | | | | | | io\qloggingregistry.cpp(134) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qloggingregistry.cpp(138) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qloggingregistry.cpp(142) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data Change-Id: Ic9787aa8acb5cb4440c62bbb143f7c2b7fdad385 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | QDebug: Add a doc section about formatting optionsKai Koehne2014-07-221-0/+12
| | | | | | | | | | Change-Id: I43cb965f9f45e8a50c767c7e9035811c90e6aab3 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>