Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / 3d / shared_widgets / common.h
blob23cb2b86db2b70a7c5a56c87cc3feed2bdda865b
1 /*
3 Copyright (C) 2015 by authors
4 Author: Jan Boon <jan.boon@kaetemi.be>
5 All rights reserved.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
10 * Redistributions of source code must retain the above copyright notice, this
11 list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef NLQT_COMMON_H
31 #define NLQT_COMMON_H
32 #include <nel/misc/types_nl.h>
34 // STL includes
36 // Qt includes
37 #include <QApplication>
38 #include <QStyleFactory>
39 #include <QDir>
40 #include <QPalette>
42 // NeL includes
44 // Project includes
46 namespace NLQT {
47 namespace {
49 void preApplication()
51 QCoreApplication::libraryPaths();
52 QString app_location = QCoreApplication::applicationFilePath();
53 app_location.truncate(app_location.lastIndexOf(QLatin1Char('/')));
54 app_location = QDir(app_location).canonicalPath();
55 QCoreApplication::removeLibraryPath(app_location);
56 QCoreApplication::addLibraryPath("./platforms");
57 QCoreApplication::addLibraryPath("./qtwebengine");
58 QCoreApplication::addLibraryPath("./imageformats");
59 QCoreApplication::addLibraryPath("./iconengines");
60 QCoreApplication::addLibraryPath("./designer");
63 void postApplication()
65 QApplication::setStyle(QStyleFactory::create("Fusion"));
66 QPalette palette = qApp->palette();
67 palette.setColor(QPalette::Window, QColor(64, 64, 64));
68 palette.setColor(QPalette::WindowText, Qt::white);
69 palette.setColor(QPalette::Base, QColor(48, 48, 48));
70 palette.setColor(QPalette::AlternateBase, QColor(64, 64, 64));
71 palette.setColor(QPalette::ToolTipBase, Qt::white);
72 palette.setColor(QPalette::ToolTipText, Qt::white);
73 palette.setColor(QPalette::Text, Qt::white);
74 palette.setColor(QPalette::Button, QColor(64, 64, 64));
75 palette.setColor(QPalette::ButtonText, Qt::white);
76 palette.setColor(QPalette::BrightText, Qt::red);
77 palette.setColor(QPalette::Highlight, QColor(64, 128, 96));
78 palette.setColor(QPalette::HighlightedText, Qt::white);
79 qApp->setPalette(palette);
83 } /* namespace NLQT */
85 #endif /* #ifndef NLQT_SERVICE_WINDOW_H */
87 /* end of file */