]> git.cworth.org Git - apitrace/commitdiff
The trace now knows whether is has been edited.
authorZack Rusin <zack@kde.org>
Sun, 17 Apr 2011 06:34:45 +0000 (02:34 -0400)
committerZack Rusin <zack@kde.org>
Sun, 17 Apr 2011 06:34:45 +0000 (02:34 -0400)
gui/apitrace.cpp
gui/apitrace.h
gui/apitracecall.cpp
gui/apitracemodel.cpp
gui/apitracemodel.h
gui/argumentseditor.cpp
gui/ui/argumentseditor.ui

index ffe9ae845fdd0dd01b18078123ede16344b01dd2..8bae919ff40e03ee3bb1c3991b57a47cc52f44df 100644 (file)
@@ -204,7 +204,7 @@ void ApiTrace::callReverted(ApiTraceCall *call)
     emit changed(call);
 }
 
-bool ApiTrace::isEdited() const
+bool ApiTrace::edited() const
 {
     return !m_editedCalls.isEmpty();
 }
index 51abe8b9076e7568d667b05ac06901d84288d828..3c27543e9b0b36a3bc053d799c2831fabbd0ea87 100644 (file)
@@ -45,7 +45,7 @@ public:
     void callEdited(ApiTraceCall *call);
     void callReverted(ApiTraceCall *call);
 
-    bool isEdited() const;
+    bool edited() const;
 
 public slots:
     void setFileName(const QString &name);
index a43c699a2d3b029ae5f5a39824549efd40e62f89..608e48244b48e2064cadc2580cfca27b4dbdb709 100644 (file)
@@ -648,6 +648,7 @@ ApiTraceEvent::~ApiTraceEvent()
 
 void ApiTraceCall::revert()
 {
+    setEditedValues(QVariantList());
 }
 
 ApiTrace * ApiTraceFrame::parentTrace() const
index b41920ee264b189968560bce2a35ef3724d07ed0..4d28cd3bb9f941d2ee4ee29d7bc36f2ae11d9701 100644 (file)
@@ -206,6 +206,8 @@ void ApiTraceModel::setApiTrace(ApiTrace *trace)
             this, SLOT(invalidateFrames()));
     connect(m_trace, SIGNAL(framesAdded(int, int)),
             this, SLOT(appendFrames(int, int)));
+    connect(m_trace, SIGNAL(changed(ApiTraceCall*)),
+            this, SLOT(callChanged(ApiTraceCall*)));
 }
 
 const ApiTrace * ApiTraceModel::apiTrace() const
@@ -276,4 +278,10 @@ QModelIndex ApiTraceModel::indexForCall(ApiTraceCall *call) const
     return createIndex(row, 0, call);
 }
 
+void ApiTraceModel::callChanged(ApiTraceCall *call)
+{
+    qDebug()<<"Call changed = "<<call->edited();
+    qDebug()<<"\ttrace edited = "<<call->parentFrame()->parentTrace()->edited();
+}
+
 #include "apitracemodel.moc"
index 7a0394b2bc7facae2c5aa84766d04c0afdb3a5d3..752d7b654436a92c2e920a60de51a7e4438472b0 100644 (file)
@@ -50,6 +50,7 @@ public:
 private slots:
     void invalidateFrames();
     void appendFrames(int oldCount, int numAdded);
+    void callChanged(ApiTraceCall *call);
 
 private:
     ApiTraceEvent *item(const QModelIndex &index) const;
index c6280ed3e816225d85c1dfc042fa62c68c5cdc09..3ac381e6c4b52f2fcc09f3e397e645608a3db9ad 100644 (file)
@@ -322,17 +322,23 @@ void ArgumentsEditor::accept()
 {
     QStringList argNames = m_call->argNames();
     QList<QVariant> originalValues = m_call->arguments();
+    QList<QVariant> newValues;
+    bool changed = false;
     for (int i = 0; i < argNames.count(); ++i) {
-        bool changed = false;
+        bool valChanged = false;
         QString argName = argNames[i];
         QVariant argValue = originalValues[i];
-        QVariant editorValue = valueForName(argName, argValue, &changed);
+        QVariant editorValue = valueForName(argName, argValue, &valChanged);
+        newValues.append(editorValue);
         qDebug()<<"Arg = "<<argName;
         qDebug()<<"\toriginal = "<<argValue;
         qDebug()<<"\teditor   = "<<editorValue;
-        qDebug()<<"\tchanged  = "<<changed;
+        qDebug()<<"\tchanged  = "<<valChanged;
+        if (valChanged)
+            changed = true;
     }
-
+    if (changed)
+        m_call->setEditedValues(newValues);
     QDialog::accept();
 }
 
index 9ee0769dad941920be09c1522e2899976b0bf233..abfb9186e58db4f65815c72825f4a1d44e8da4a8 100644 (file)
@@ -82,7 +82,7 @@
      <item>
       <widget class="QPushButton" name="revertButton">
        <property name="enabled">
-        <bool>false</bool>
+        <bool>true</bool>
        </property>
        <property name="text">
         <string>Revert</string>