languagemanager.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #include "docmanager.h"
00012 #include "languagemanager.h"
00013 #include "logview.h"
00014 #include "ktechlab.h"
00015 #include "ktempfile.h"
00016 #include "src/core/ktlconfig.h"
00017 #include "outputmethoddlg.h"
00018 #include "processchain.h"
00019 #include "projectmanager.h"
00020 
00021 #include "microbe.h"
00022 #include "gpasm.h"
00023 #include "gpdasm.h"
00024 
00025 #include <kdockwidget.h>
00026 #include <kiconloader.h>
00027 #include <klocale.h>
00028 #include <qwhatsthis.h>
00029 
00030 #include <cassert>
00031 
00032 
00033 LanguageManager * LanguageManager::m_pSelf = 0;
00034 
00035 
00036 LanguageManager * LanguageManager::self( KateMDI::ToolView * parent, KTechlab * ktl )
00037 {
00038         if (!m_pSelf)
00039         {
00040                 assert(parent);
00041                 assert(ktl);
00042                 m_pSelf = new LanguageManager( parent, ktl );
00043         }
00044         return m_pSelf;
00045 }
00046 
00047 
00048 LanguageManager::LanguageManager( KateMDI::ToolView * parent, KTechlab * ktl )
00049         : QObject((QObject*)ktl)
00050 {
00051         p_ktechlab = ktl;
00052         m_logView = new LogView( parent, "LanguageManager LogView");
00053         
00054         QWhatsThis::add( m_logView, i18n("These messages show the output of language-related functionality such as compiling and assembling.<br><br>For error messages, clicking on the line will automatically open up the file at the position of the error.") );
00055         connect( m_logView, SIGNAL(paraClicked(const QString&, MessageInfo )), this, SLOT(slotParaClicked(const QString&, MessageInfo )) );
00056         reset();
00057 }
00058 
00059 
00060 LanguageManager::~LanguageManager()
00061 {
00062 }
00063 
00064 
00065 void LanguageManager::reset()
00066 {
00067         m_logView->clear();
00068 }
00069 
00070 
00071 ProcessChain * LanguageManager::compile( ProcessOptions options )
00072 {
00073         if ( KTLConfig::raiseMessagesLog() )
00074                 p_ktechlab->showToolView( p_ktechlab->toolView( toolViewIdentifier() ) );
00075         
00076         return new ProcessChain( options, p_ktechlab );
00077 }
00078 
00079 
00080 ProcessListChain * LanguageManager::compile( ProcessOptionsList pol )
00081 {
00082         if ( KTLConfig::raiseMessagesLog() )
00083                 p_ktechlab->showToolView( p_ktechlab->toolView( toolViewIdentifier() ) );
00084         
00085         return new ProcessListChain( pol, p_ktechlab );
00086 }
00087 
00088 
00089 void LanguageManager::slotError( const QString &error, MessageInfo messageInfo )
00090 {
00091         m_logView->addOutput( error, LogView::ot_error, messageInfo );
00092 }
00093 void LanguageManager::slotWarning( const QString &error, MessageInfo messageInfo )
00094 {
00095         m_logView->addOutput( error, LogView::ot_warning, messageInfo );
00096 }
00097 void LanguageManager::slotMessage( const QString &error, MessageInfo messageInfo )
00098 {
00099         m_logView->addOutput( error, LogView::ot_message, messageInfo );
00100 }
00101 
00102 void LanguageManager::slotParaClicked( const QString& message, MessageInfo messageInfo )
00103 {
00104         Q_UNUSED(message);
00105         DocManager::self()->gotoTextLine( messageInfo.fileURL(), messageInfo.fileLine() );
00106 }
00107 
00108 #include "languagemanager.moc"

Generated on Tue May 8 17:05:31 2007 for KTechLab by  doxygen 1.5.1