Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2001-2011 Jacek Sieka, arnetheduck on gmail point com
- *
- * 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.
- */
- #ifndef DCPLUSPLUS_WIN32_DEBUG_FRAME_H
- #define DCPLUSPLUS_WIN32_DEBUG_FRAME_H
- #include "StaticFrame.h"
- #include <dcpp/DebugManager.h>
- #include <dcpp/CriticalSection.h>
- #include <dcpp/Semaphore.h>
- #include <dcpp/Thread.h>
- class DebugFrame : public StaticFrame<DebugFrame>,
- private DebugManagerListener
- {
- typedef StaticFrame<DebugFrame> BaseType;
- public:
- enum Status {
- STATUS_STATUS,
- STATUS_LAST
- };
- static const string id;
- const string& getId() const;
- private:
- bool stop;
- CriticalSection cs;
- Semaphore s;
- deque<string> cmdList;
- int run() {
- setThreadPriority(Thread::LOW);
- string x = Util::emptyString;
- stop = false;
- while(true) {
- s.wait();
- if(stop)
- break;
- {
- Lock l(cs);
- if(cmdList.empty()) continue;
- x = cmdList.front();
- cmdList.pop_front();
- }
- addLine(Text::toT(x));
- }
- stop = false;
- return 0;
- }
- void addCmd(const string& cmd) {
- {
- Lock l(cs);
- cmdList.push_back(cmd);
- }
- s.signal();
- }
- friend class StaticFrame<DebugFrame>;
- friend class MDIChildFrame<DebugFrame>;
- TextBoxPtr debug;
- DebugFrame(TabViewPtr parent);
- virtual ~DebugFrame();
- void layout();
- bool preClosing();
- void addLine(const tstring& msg);
- // bool handleContextMenu(const dwt::ScreenCoordinate& pt);
- // bool handleDoubleClick(const dwt::MouseEvent& mouseEvent);
- // DebugManagerListener
- virtual void on(DebugCommand, const string& message) throw();
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement