# HG changeset patch # User Santeri Piippo # Date 1372953394 -10800 # Node ID 76505a9c7b56bbe40379b78e1390273c4c5f81d4 # Parent 76db02dc7f603fb6d09777a3974c3d23825d4042 converted the raw edit prompt diff -r 76db02dc7f60 -r 76505a9c7b56 src/gui_editactions.cpp --- a/src/gui_editactions.cpp Thu Jul 04 18:41:24 2013 +0300 +++ b/src/gui_editactions.cpp Thu Jul 04 18:56:34 2013 +0300 @@ -32,6 +32,7 @@ #include "dialogs.h" #include "colors.h" #include "ui_replcoords.h" +#include "ui_editraw.h" vector g_Clipboard; @@ -169,27 +170,38 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -MAKE_ACTION (setContents, "Edit LDraw Code", "set-contents", "Edit the LDraw code of this object.", KEY (F9)) { - if (g_win->sel ().size() != 1) +MAKE_ACTION( setContents, "Edit LDraw Code", "set-contents", "Edit the LDraw code of this object.", KEY( F9 )) +{ + if( g_win->sel().size() != 1 ) return; - LDObject* obj = g_win->sel ()[0]; + LDObject* obj = g_win->sel()[0]; + QDialog* dlg = new QDialog; + Ui::EditRawUI ui; + + ui.setupUi( dlg ); + ui.code->setText( obj->raw() ); - SetContentsDialog dlg; - dlg.setObject (obj); - if (!dlg.exec ()) + if( obj->getType() == LDObject::Gibberish ) + ui.errorDescription->setText( static_cast( obj )->reason ); + else + { + ui.errorDescription->hide(); + ui.errorIcon->hide(); + } + + if( !dlg->exec() ) return; LDObject* oldobj = obj; // Reinterpret it from the text of the input field - obj = parseLine (dlg.text ()); - - oldobj->replace (obj); + obj = parseLine( ui.code->text() ); + oldobj->replace( obj ); // Refresh - g_win->R ()->compileObject (obj); - g_win->refresh (); + g_win->R()->compileObject( obj ); + g_win->refresh(); } // ============================================================================= diff -r 76db02dc7f60 -r 76505a9c7b56 src/ui/editraw.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ui/editraw.ui Thu Jul 04 18:56:34 2013 +0300 @@ -0,0 +1,112 @@ + + + EditRawUI + + + + 0 + 0 + 400 + 85 + + + + Edit LDraw Code + + + + + + LDraw code: + + + + + + + + + + + + + 16 + 16 + + + + + + + :/icons/error.png + + + true + + + + + + + true + + + color: #900 + + + Error description + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + + + buttonBox + accepted() + EditRawUI + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + EditRawUI + reject() + + + 316 + 260 + + + 286 + 274 + + + + +