📄 main.cpp
字号:
/* main.cpp * * $Id: main.cpp,v 1.35 2002/03/24 16:43:28 kyllingstad Exp $ * * Apollo sound player: http://www.apolloplayer.org * Copyright(C) 2000-2002 Apollo Team. See CREDITS file. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * The GNU General Public License is also available online at: * * http://www.gnu.org/copyleft/gpl.html */#include "qmapplication.h"#include <qaccel.h>#include <qglobal.h> // _WS_X11_ / _WS_WIN_ defines#include <qkeycode.h>#include <qmessagebox.h>#include <iostream>#ifdef _WS_X11_#include <signal.h>#include <sys/types.h>#include <errno.h>#include <X11/Xlib.h>#define XK_MISCELLANY#define XK_LATIN1#include <X11/keysymdef.h>#endif#include "globalaccel.h"#include "qmmainwindow.h"#include "qmmpg123player.h"#include "qmrecoverymanager.h"/*! Handler for seg. faults etc. Just show a friendly dialog that we are going to die now :-)*/#ifdef _WS_X11_void sighandler(int sig){// signal(SIGILL, 0);// signal(SIGSEGV, 0);// signal(SIGPIPE, 0);#ifdef ENABLE_MPG123 QmMpg123Player::setFailFlag(true);#endif /* QMessageBox::critical( 0, QObject::tr("Apollo Fatal Error"), QObject::tr("<h1>Fatal Error</h1>" "An internal error happened within Apollo. The signal received was: " "<p>" "<center>%1</center>" "<p>" "If you can reproduce this error, please report the bug to us " "and give a detailed description on how to reproduce the bug. " "You can report the bug in two ways:" "<ul>" "<li>http://bugs.apolloplayer.org</li>" "<li>bugs@apolloplayer.org</li>" "</ul>" "Thank you.<br>" "<p>" "Apollo will need to be restarted.").arg(sig), QObject::tr("&Quit")); */ using std::endl; std::cerr << "Apollo Fatal Error" << endl << endl << "An internal error happened within Apollo. The signal received was: " << endl << endl << sig << endl << endl << "If you can reproduce this error, please report the bug to us " << endl << "and give a detailed description on how to reproduce the bug. " << endl << "You can report the bug in two ways:" << endl << " - http://bugs.apolloplayer.org" << endl << " - bugs@apolloplayer.org" << endl << "Thank you." << endl << endl << "Apollo will need to be restarted." << endl; std::cerr.flush();}#endif // _WS_X11_/*! \file src/main.cpp Implementation of the main function and other startup functions.*//*! \mainpage Apollo \section intro Introduction This is the class documentation for <a href="http://www.apolloplayer.org">Apollo</a>, a sound player for Linux. It was generated with <a href="http://www.doxygen.org">Doxygen</a>. \section compilation Compilation Use the configure.sh script to generate a Makefile and then compile; type \code ./configure.sh make \endcode at the command prompt to build the 'apollo' executable. Please see README and INSTALL for more information. \section running Running Typing \code ./apollo \endcode runs Apollo. \section license License Apollo is distributed under the <a href="http://www.gnu.org/copyleft/gpl.html">GPL license</a>. *//*! Where the magic starts... :-)*/int main(int argc, char **argv){#ifdef _WS_X11_// signal(SIGILL, sighandler);// signal(SIGSEGV, sighandler);// signal(SIGPIPE, sighandler);#endif QmApplication::init(argc, argv); QmApplication a(argc, argv); QmRecoveryManager *rm = QmRecoveryManager::instance(); if(rm->start() == QmRecoveryManager::Exit) return 0; QmMainWindow::mainwin = new QmMainWindow(0, QObject::tr("Apollo Main Window")); a.setMainWidget( QmMainWindow::mainwin ); QmMainWindow::mainwin->show(); // we should support command line parameters - but for now: bool restoreState = true; for (int i=0; i<argc; ++i) { if (QString::compare(argv[i], "-vanilla") == 0) { restoreState = false; break; } } if (restoreState) QmMainWindow::mainwin->restoreState(); GlobalAccel *gk = new GlobalAccel(QmMainWindow::mainwin); gk->setKeys(QmMainWindow::mainwin); QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); int rc = a.exec(); delete QmMainWindow::mainwin; // We are about to quit successfully. Remove the recovery file. rm->stop(); return rc;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -