Skip to content

Commit

Permalink
Added keysequence to label and updated About dialog text.
Browse files Browse the repository at this point in the history
  • Loading branch information
lellisls committed Mar 1, 2016
1 parent d3938e3 commit 6bf92ae
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
14 changes: 10 additions & 4 deletions app/graphicelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void GraphicElement::save( QDataStream &ds ) {
ds << rotation( );

/* <Version1.2> */
ds << label->toPlainText( );
ds << getLabel();
/* <\Version1.2> */

/* <Version1.3> */
Expand Down Expand Up @@ -121,14 +121,14 @@ void GraphicElement::save( QDataStream &ds ) {

void GraphicElement::load( QDataStream &ds, QMap< quint64, QNEPort* > &portMap, double version ) {
QPointF p;
QString label_text;
ds >> p;
qreal angle;
ds >> angle;
setPos( p );
setRotation( angle );
/* <Version1.2> */
if( version >= 1.2 ) {
QString label_text;
ds >> label_text;
setLabel( label_text );
}
Expand All @@ -144,6 +144,7 @@ void GraphicElement::load( QDataStream &ds, QMap< quint64, QNEPort* > &portMap,
/* <Version1.9> */
if( version >= 1.9 ) {
ds >> m_trigger;
setLabel( label_text );
}
/* <\Version1.9> */

Expand Down Expand Up @@ -342,11 +343,16 @@ void GraphicElement::setTrigger( const QKeySequence &trigger ) {
*/

void GraphicElement::setLabel( QString label ) {
this->label->setPlainText( label );
m_labelText = label;
if(!hasTrigger() || getTrigger().isEmpty()){
this->label->setPlainText( label );
}else{
this->label->setPlainText( label + QString(" (%1)").arg(getTrigger().toString()));
}
}

QString GraphicElement::getLabel( ) {
return( label->toPlainText( ) );
return( m_labelText );
}

bool GraphicElement::visited( ) const {
Expand Down
1 change: 1 addition & 0 deletions app/graphicelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class GraphicElement : public QGraphicsObject, public PriorityElement {
bool m_beingVisited;
bool m_visited;
bool m_disabled;
QString m_labelText;
QKeySequence m_trigger;
protected:
QVector< QNEPort* > m_inputs;
Expand Down
19 changes: 15 additions & 4 deletions app/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,20 @@ void MainWindow::on_actionSave_triggered( ) {
}

void MainWindow::on_actionAbout_triggered( ) {
QMessageBox::about( this, "Wired Panda",
QMessageBox::about( this, "wiRED Panda",
tr(
"Wired Panda is a software built to help students to learn about logic circuits.\nVersion: %1\n\nCreators:\nDavi Morales\nHéctor Castelli\nLucas Lellis\nRodrigo Torres\nSupervised by: Fábio Cappabianco." )
"<p>wiRED Panda is a software developed by the students of the Federal University of São Paulo."
" This project was created in order to help students to learn about logic circuits.</p>"
"<p>Software version: %1</p>"
"<p><strong>Creators:</strong></p>"
"<ul>"
"<li> Davi Morales </li>"
"<li> Héctor Castelli </li>"
"<li> Lucas Lellis </li>"
"<li> Rodrigo Torres </li>"
"<li> Prof. Fábio Cappabianco, Ph.D. </li>"
"</ul>"
"<p><a href=\"http://gibis-unifesp.github.io/wiRedPanda/\">Visit our website!</a></p>")
.arg(
QApplication::applicationVersion( ) ) );
}
Expand Down Expand Up @@ -304,10 +315,10 @@ void MainWindow::setCurrentFile( const QFileInfo &value ) {
qDebug( ) << "Setting current file to: " << value.absoluteFilePath( );
currentFile = value;
if( value.fileName( ).isEmpty( ) ) {
setWindowTitle( "WiRED PANDA" );
setWindowTitle( "wiRED PANDA" );
}
else {
setWindowTitle( QString( "WiRED PANDA ( %1 )" ).arg( value.fileName( ) ) );
setWindowTitle( QString( "wiRED PANDA ( %1 )" ).arg( value.fileName( ) ) );
}
GlobalProperties::currentFile = currentFile.absoluteFilePath( );
if( currentFile.exists( ) ) {
Expand Down

0 comments on commit 6bf92ae

Please sign in to comment.