Main Page
Namespaces
Classes
Files
File List
File Members
src
main.cpp
Go to the documentation of this file.
1
// *****************************************************************************
2
//
3
// Copyright (c) 2015, Southwest Research Institute® (SwRI®)
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are met:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of Southwest Research Institute® (SwRI®) nor the
14
// names of its contributors may be used to endorse or promote products
15
// derived from this software without specific prior written permission.
16
//
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
20
// ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® 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
25
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27
// DAMAGE.
28
//
29
// *****************************************************************************
30
31
#include <QtGui>
32
#include <QApplication>
33
#include <QCoreApplication>
34
#include <QDirIterator>
35
#include <QStringList>
36
37
#include <
swri_console/console_master.h
>
38
39
void
loadFonts
()
40
{
41
QStringList font_files;
42
43
QDirIterator it(
":/fonts"
, QDirIterator::Subdirectories);
44
while
(it.hasNext()) {
45
it.next();
46
47
if
(!it.fileInfo().isFile()) {
48
continue
;
49
}
50
51
if
(it.filePath().endsWith(
".otf"
)) {
52
font_files.append(it.filePath());
53
}
54
55
if
(it.filePath().endsWith(
".ttf"
)) {
56
font_files.append(it.filePath());
57
}
58
}
59
60
for
(
int
i = 0; i < font_files.size(); i++) {
61
62
int
id
= QFontDatabase::addApplicationFont(font_files[i]);
63
if
(
id
== -1) {
64
qWarning() <<
"Failed to load font: "
<< font_files[i];
65
}
else
{
66
// qDebug() << "Loaded fonts from " << font_files[i] << ":";
67
68
// QStringList families = QFontDatabase::applicationFontFamilies(id);
69
// for (int j = 0; j < families.size(); j++) {
70
// qDebug() << " " << families[j];
71
// }
72
}
73
}
74
}
75
76
int
main
(
int
argc,
char
**argv)
77
{
78
QApplication app(argc, argv);
79
loadFonts
();
80
81
QCoreApplication::setOrganizationName(
"Southwest Research Institute"
);
82
QCoreApplication::setOrganizationDomain(
"swri.org"
);
83
QCoreApplication::setApplicationName(
"SwRI Console"
);
84
85
swri_console::ConsoleMaster
master(argc, argv);
86
master.
createNewWindow
();
87
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
88
int
result = app.exec();
89
return
result;
90
}
main
int main(int argc, char **argv)
Definition:
main.cpp:76
console_master.h
swri_console::ConsoleMaster::createNewWindow
void createNewWindow()
Definition:
console_master.cpp:67
loadFonts
void loadFonts()
Definition:
main.cpp:39
swri_console::ConsoleMaster
Definition:
console_master.h:50
swri_console
Author(s):
autogenerated on Fri Apr 3 2020 03:20:03