--- /dev/null
+// Copyright (c) 2012 Dennco Project
+//
+// 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 3 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, see <http://www.gnu.org/licenses/>.
+
+//
+// Created by tkawata on Oct-21, 2012.
+//
+#include "dcconsole.h"
+
+DCConsole::DCConsole() : d_size(100)
+{
+}
+
+void DCConsole::vprintf(TKLog::MessageType type, const char *fmt, va_list ap)
+{
+ (type);
+ QString msg = QString().vsprintf(fmt,ap);
+
+ d_queue.append(msg);
+ while (d_queue.size() > d_size)
+ {
+ d_queue.dequeue();
+ }
+#ifdef DEBUG
+ qDebug() << msg << endl;
+#endif
+}
+
+QString DCConsole::getLog(int n) const
+{
+ if (n < 1)
+ {
+ n = d_queue.size();
+ }
+
+ QString message = "";
+ int p = d_queue.size() - n;
+ if (p < 0) p = 0;
+ for (int i = d_queue.size() - 1; i >= p; i--)
+ {
+ message.append(d_queue.at(i));
+ message.append("\n");
+ }
+ return message;
+}
+
+void DCConsole::clearLog()
+{
+ d_queue.clear();
+}
--- /dev/null
+// Copyright (c) 2012 Dennco Project
+//
+// 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 3 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, see <http://www.gnu.org/licenses/>.
+
+//
+// Created by tkawata on Oct-21, 2012.
+//
+#ifndef DCCONSOLE_H
+#define DCCONSOLE_H
+
+#include "TKConsole.h"
+
+#include <QQueue>
+#include <QString>
+
+class DCConsole : public TKConsole
+{
+ QQueue<QString> d_queue;
+ int d_size;
+
+public:
+ DCConsole();
+ virtual void vprintf(TKLog::MessageType type, const char *fmt, va_list arg);
+ QString getLog(int n = 0) const;
+ void clearLog();
+};
+
+#endif // DCCONSOLE_H
// Created by tkawata on Sep-30, 2012.
//
#include "TKLog.h"
+#include "DNGlobal.h"
+#include "dcconsole.h"
#include "dccreator.h"
{
d_undoStack = new QUndoStack(this);
d_cellCodeEditor = new DCToolWindowCellCodeEditor(this);
+
+ d_console = new DCConsole;
+ TKLog::setDestination(d_console);
}
DCCreator::~DCCreator()
{
delete d_vcontent;
}
+ if (d_console)
+ {
+ delete d_console;
+ }
}
bool DCCreator::event(QEvent *event)
bool DCCreator::loadContent(const QString &contentRoot)
{
+ d_console->clearLog();
+
d_contentRootPath = contentRoot;
if (d_vcontent)
{
{
d_scene = NULL;
emit sceneChanged(this, NULL);
+
+ if (!dnGlobal()->isErrorStatusNormal())
+ {
+ QMessageBox msgBox(QMessageBox::Warning, QString::fromStdString(dnGlobal()->getMessage1()), QString::fromStdString(dnGlobal()->getMessage2()));
+ msgBox.setInformativeText(d_console->getLog(10));
+ msgBox.exec();
+ }
return false;
}
}
class DCContainer;
class DCCommand;
class DCToolWindowCellCodeEditor;
+class DCConsole;
#include <QtGUI>
QString d_contentRootPath;
QUndoStack *d_undoStack;
+ DCConsole *d_console;
DCToolWindowCellCodeEditor *d_cellCodeEditor;
visualizer/toolwindow/dccellcodetypecombobox.h \
dialog/dcrenamecelldialog.h \
uieditor/dcuieditor.h \
- uieditor/dcuitexteditor.h
+ uieditor/dcuitexteditor.h \
+ dcconsole.h
SOURCES = main.cpp \
mainwindow.cpp \
visualizer/toolwindow/dccellcodetypecombobox.cpp \
dialog/dcrenamecelldialog.cpp \
uieditor/dcuieditor.cpp \
- uieditor/dcuitexteditor.cpp
+ uieditor/dcuitexteditor.cpp \
+ dcconsole.cpp
RESOURCES = denncoCreator.qrc