Example #1
0
    int DiffCommand::showDiff(Node *node)
    {
        int diff = 0;
        std::cout << std::left;

        for (auto nodeVal : node->getAll()) {
            auto value = nodeVal.value;
            if (value->persisted && Node::isDiff(value)) {
                Terminal::clear();
                diff++;
                std::string name = std::string("/") + nodeVal.getName() + ":";
                std::cout << std::setw(35) << name;
                
                Terminal::setColor("red", true);
                std::cout << std::setw(5) << Node::persistedToString(value);
                Terminal::setColor("white", false);
                std::cout << " → ";
                Terminal::setColor("green", true);
                std::cout << std::setw(5) << Node::toString(value);

                std::cout << std::endl;
            }
        }

        for (auto name : node->getChildren()) {
            diff += showDiff(node->getChild(name));
        }
        return diff;
    }
Example #2
0
    void DiffCommand::process(std::vector<std::string> args)
    {
        shell->sync();
        auto node = getNode(args);

        if (!showDiff(node)) {
            Terminal::setColor("green", true);
            std::cout << "Everything is clean" << std::endl;
            Terminal::clear();
        }
    }
Example #3
0
void FirewallCodeViewer::showDiff()
{
    QString fileName = this->files.at(ui->fileSelector->currentIndex());
    QString autoCompiledFileName;

    QDir tempDir(m_project->getTemporaryDirPath());

    if (tempDir.exists())
        autoCompiledFileName = QString(tempDir.absolutePath()).append("/").append(fileName.split("/").last());

    showDiff(autoCompiledFileName, fileName);
}
Example #4
0
void SwapFile::showSwapFileMessage()
{
  m_swapMessage = new KTextEditor::Message(i18n("The file was not closed properly."),
                                           KTextEditor::Message::Warning);
  m_swapMessage->setWordWrap(true);

  QAction* diffAction = new QAction(KIcon("split"), i18n("View Changes"), 0);
  QAction* recoverAction = new QAction(KIcon("edit-redo"), i18n("Recover Data"), 0);
  QAction* discardAction = new QAction(KStandardGuiItem::discard().icon(), i18n("Discard"), 0);

  m_swapMessage->addAction(diffAction, false);
  m_swapMessage->addAction(recoverAction);
  m_swapMessage->addAction(discardAction);

  connect(diffAction, SIGNAL(triggered()), SLOT(showDiff()));
  connect(recoverAction, SIGNAL(triggered()), SLOT(recover()), Qt::QueuedConnection);
  connect(discardAction, SIGNAL(triggered()), SLOT(discard()), Qt::QueuedConnection);

  m_document->postMessage(m_swapMessage);
}
Example #5
0
void SourceView::checkDiff()
{
if (!editor->toPlainText().isEmpty()) emit showDiff();
}
Example #6
0
void FirewallCodeViewer::showDiffSelectFile()
{
    showDiff(this->files.at(ui->fileSelector->currentIndex()), "");
}