| 82 | }; |
| 83 | |
| 84 | TextOutputI::TextOutputI(const std::string& name, QWidget *parent) |
| 85 | : QMainWindow(parent) { |
| 86 | Logos logos; |
| 87 | |
| 88 | QPixmap myPic; |
| 89 | myPic.loadFromData(logos.gistLogo, logos.gistLogoSize); |
| 90 | setWindowIcon(myPic); |
| 91 | |
| 92 | QFont font; |
| 93 | QString fontFamily("Courier"); |
| 94 | font.setFamily(fontFamily); |
| 95 | font.setFixedPitch(true); |
| 96 | font.setPointSize(12); |
| 97 | |
| 98 | |
| 99 | editor = new QTextEdit; |
| 100 | editor->setFont(font); |
| 101 | editor->setReadOnly(true); |
| 102 | editor->setLineWrapMode(QTextEdit::FixedColumnWidth); |
| 103 | editor->setLineWrapColumnOrWidth(80); |
| 104 | os = new GistOutputStream(editor); |
| 105 | |
| 106 | QAction* clearText = new QAction("Clear", this); |
| 107 | clearText->setShortcut(QKeySequence("Ctrl+K")); |
| 108 | this->addAction(clearText); |
| 109 | connect(clearText, SIGNAL(triggered()), editor, |
| 110 | SLOT(clear())); |
| 111 | |
| 112 | QAction* closeWindow = new QAction("Close window", this); |
| 113 | closeWindow->setShortcut(QKeySequence("Ctrl+W")); |
| 114 | this->addAction(closeWindow); |
| 115 | connect(closeWindow, SIGNAL(triggered()), this, |
| 116 | SLOT(close())); |
| 117 | |
| 118 | QToolBar* t = addToolBar("Tools"); |
| 119 | t->setFloatable(false); |
| 120 | t->setMovable(false); |
| 121 | t->addAction(clearText); |
| 122 | |
| 123 | stayOnTop = new QAction("Stay on top", this); |
| 124 | stayOnTop->setCheckable(true); |
| 125 | t->addAction(stayOnTop); |
| 126 | connect(stayOnTop, SIGNAL(changed()), this, |
| 127 | SLOT(changeStayOnTop())); |
| 128 | |
| 129 | changeStayOnTop(); |
| 130 | setCentralWidget(editor); |
| 131 | setWindowTitle(QString((std::string("Gist Console: ") + name).c_str())); |
| 132 | |
| 133 | setAttribute(Qt::WA_QuitOnClose, false); |
| 134 | setAttribute(Qt::WA_DeleteOnClose, false); |
| 135 | resize(600,300); |
| 136 | } |
| 137 | |
| 138 | TextOutputI::~TextOutputI(void) { |
| 139 | delete os; |