main.cpp
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2015, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 
00021 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00022 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00023 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00024 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00025 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00027 // DAMAGE.
00028 //
00029 // *****************************************************************************
00030 
00031 #include <QtGui>
00032 #include <QApplication>
00033 #include <QCoreApplication>
00034 #include <QDirIterator>
00035 #include <QStringList>
00036 
00037 #include <swri_console/console_master.h>
00038 
00039 void loadFonts()
00040 {
00041   QStringList font_files;
00042 
00043   QDirIterator it(":/fonts", QDirIterator::Subdirectories);
00044   while (it.hasNext()) {
00045     it.next();
00046     
00047     if (!it.fileInfo().isFile()) {
00048       continue;
00049     }
00050     
00051     if (it.filePath().endsWith(".otf")) {
00052       font_files.append(it.filePath());
00053     }      
00054 
00055     if (it.filePath().endsWith(".ttf")) {
00056       font_files.append(it.filePath());
00057     }      
00058   }
00059 
00060   for (int i = 0; i < font_files.size(); i++) {
00061     
00062     int id = QFontDatabase::addApplicationFont(font_files[i]);
00063     if (id == -1) {
00064       qWarning() << "Failed to load font: " << font_files[i];
00065     } else {
00066       // qDebug() << "Loaded fonts from " << font_files[i] << ":";
00067       
00068       // QStringList families = QFontDatabase::applicationFontFamilies(id);
00069       // for (int j = 0; j < families.size(); j++) {
00070       //   qDebug() << "   " << families[j];
00071       // }
00072     }
00073   }
00074 }
00075 
00076 int main(int argc, char **argv)
00077 {
00078   QApplication app(argc, argv);
00079   loadFonts();
00080 
00081   QCoreApplication::setOrganizationName("Southwest Research Institute");
00082   QCoreApplication::setOrganizationDomain("swri.org");
00083   QCoreApplication::setApplicationName("SwRI Console");
00084   
00085   swri_console::ConsoleMaster master(argc, argv);
00086   master.createNewWindow();
00087   app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
00088   int result = app.exec();
00089   return result;
00090 }


swri_console
Author(s):
autogenerated on Sat Jun 8 2019 18:46:13