/*! * \brief TextDoc::save saves the current document and it settings * \return true/false if the document was opened with success */ int TextDoc::save () { saveSettings (); QFile file (DocName); if (!file.open (QIODevice::WriteOnly)) return -1; setLanguage (DocName); QTextStream stream (&file); stream << toPlainText(); document()->setModified (false); slotSetChanged (); file.close (); QFileInfo Info (DocName); lastSaved = Info.lastModified (); /// clear highlighted lines on save \see MessageDock::slotCursor() QList<QTextEdit::ExtraSelection> extraSelections; this->setExtraSelections(extraSelections); refreshLanguage(); return 0; }
/*! * \brief TextDoc::load loads a text document * \return true/false if the document was opened with success */ bool TextDoc::load () { QFile file (DocName); if (!file.open (QIODevice::ReadOnly)) return false; setLanguage (DocName); QTextStream stream (&file); insertPlainText(stream.read ()); document()->setModified(false); slotSetChanged (); file.close (); lastSaved = QDateTime::currentDateTime (); loadSettings (); SimOpenDpl = simulation ? true : false; refreshLanguage(); return true; }
void Core::init() { // create settings createSettings(); reloadSettings(); // language refreshLanguage(); // kamerzysta kamerzystaSocket = new QTcpSocket(); kamerzystaSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1); kamerzystaSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 0); // network QString strServer = "czat-app.onet.pl"; int iPort = 5015; network = new Network(strServer, iPort); network->start(QThread::InheritPriority); }