File indexing completed on 2025-02-09 06:59:15
0001 /*************************************************************************** 0002 * Copyright (C) 2005 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #include "languagemanager.h" 0012 #include "docmanager.h" 0013 #include "ktechlab.h" 0014 #include "logview.h" 0015 // #include "k3tempfile.h" 0016 #include "outputmethoddlg.h" 0017 #include "processchain.h" 0018 #include "projectmanager.h" 0019 0020 #include "gpasm.h" 0021 #include "gpdasm.h" 0022 #include "microbe.h" 0023 0024 // #include <k3dockwidget.h> 0025 #include <KLocalizedString> 0026 0027 #include <cassert> 0028 0029 #include <ktlconfig.h> 0030 0031 LanguageManager *LanguageManager::m_pSelf = nullptr; 0032 0033 LanguageManager *LanguageManager::self(KateMDI::ToolView *parent) 0034 { 0035 if (!m_pSelf) { 0036 assert(parent); 0037 m_pSelf = new LanguageManager(parent); 0038 } 0039 return m_pSelf; 0040 } 0041 0042 LanguageManager::LanguageManager(KateMDI::ToolView *parent) 0043 : QObject(KTechlab::self()) 0044 { 0045 m_logView = new LogView(parent); 0046 m_logView->setObjectName("LanguageManager LogView"); 0047 0048 m_logView->setWhatsThis( 0049 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.")); 0050 connect(m_logView, SIGNAL(paraClicked(const QString &, MessageInfo)), this, SLOT(slotParaClicked(const QString &, MessageInfo))); 0051 reset(); 0052 } 0053 0054 LanguageManager::~LanguageManager() 0055 { 0056 } 0057 0058 void LanguageManager::reset() 0059 { 0060 m_logView->clear(); 0061 } 0062 0063 ProcessChain *LanguageManager::compile(ProcessOptions options) 0064 { 0065 if (KTLConfig::raiseMessagesLog()) 0066 KTechlab::self()->showToolView(KTechlab::self()->toolView(toolViewIdentifier())); 0067 0068 return new ProcessChain(options); 0069 } 0070 0071 ProcessListChain *LanguageManager::compile(ProcessOptionsList pol) 0072 { 0073 if (KTLConfig::raiseMessagesLog()) 0074 KTechlab::self()->showToolView(KTechlab::self()->toolView(toolViewIdentifier())); 0075 0076 return new ProcessListChain(pol); 0077 } 0078 0079 void LanguageManager::slotError(const QString &error, MessageInfo messageInfo) 0080 { 0081 m_logView->addOutput(error, LogView::ot_error, messageInfo); 0082 } 0083 void LanguageManager::slotWarning(const QString &error, MessageInfo messageInfo) 0084 { 0085 m_logView->addOutput(error, LogView::ot_warning, messageInfo); 0086 } 0087 void LanguageManager::slotMessage(const QString &error, MessageInfo messageInfo) 0088 { 0089 m_logView->addOutput(error, LogView::ot_message, messageInfo); 0090 } 0091 0092 void LanguageManager::slotParaClicked(const QString &message, MessageInfo messageInfo) 0093 { 0094 Q_UNUSED(message); 0095 DocManager::self()->gotoTextLine(QUrl::fromUserInput(messageInfo.fileURL()), messageInfo.fileLine()); 0096 } 0097 0098 #include "moc_languagemanager.cpp"