QTfrontend/ui/page/pageplayrecord.cpp
changeset 7000 d22633829ac8
parent 6952 7f70f37bbf08
child 7130 fcab1fd02bc6
equal deleted inserted replaced
6999:486db9d26e4b 7000:d22633829ac8
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
       
    19 #include "pageplayrecord.h"
       
    20 
    19 #include <QFont>
    21 #include <QFont>
    20 #include <QGridLayout>
    22 #include <QGridLayout>
    21 #include <QPushButton>
    23 #include <QPushButton>
    22 #include <QListWidget>
    24 #include <QListWidget>
    23 #include <QListWidgetItem>
    25 #include <QListWidgetItem>
    24 #include <QFileInfo>
    26 #include <QFileInfo>
    25 #include <QMessageBox>
    27 #include <QMessageBox>
    26 #include <QInputDialog>
    28 #include <QInputDialog>
    27 
    29 
    28 #include "hwconsts.h"
    30 #include "hwconsts.h"
    29 #include "pageplayrecord.h"
    31 
       
    32 #include "DataManager.h"
    30 
    33 
    31 QLayout * PagePlayDemo::bodyLayoutDefinition()
    34 QLayout * PagePlayDemo::bodyLayoutDefinition()
    32 {
    35 {
    33     QGridLayout * pageLayout = new QGridLayout();
    36     QGridLayout * pageLayout = new QGridLayout();
    34 
    37 
    59 
    62 
    60 void PagePlayDemo::connectSignals()
    63 void PagePlayDemo::connectSignals()
    61 {
    64 {
    62     connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord()));
    65     connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord()));
    63     connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord()));
    66     connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord()));
       
    67     connect(&DataManager::instance(), SIGNAL(updated()), this, SLOT(refresh()));
    64 }
    68 }
    65 
    69 
    66 PagePlayDemo::PagePlayDemo(QWidget* parent) : AbstractPage(parent)
    70 PagePlayDemo::PagePlayDemo(QWidget* parent) : AbstractPage(parent)
    67 {
    71 {
    68     initPage();
    72     initPage();
   100     {
   104     {
   101         DemosList->item(i)->setData(Qt::UserRole, dir.absoluteFilePath(QString("%1.%3.%2").arg(sl[i], extension, *cProtoVer)));
   105         DemosList->item(i)->setData(Qt::UserRole, dir.absoluteFilePath(QString("%1.%3.%2").arg(sl[i], extension, *cProtoVer)));
   102         DemosList->item(i)->setIcon(recType == RT_Demo ? QIcon(":/res/file_demo.png") : QIcon(":/res/file_save.png"));
   106         DemosList->item(i)->setIcon(recType == RT_Demo ? QIcon(":/res/file_demo.png") : QIcon(":/res/file_save.png"));
   103     }
   107     }
   104 }
   108 }
       
   109 
       
   110 
       
   111 void PagePlayDemo::refresh()
       
   112 {
       
   113     if (this->isVisible());
       
   114         FillFromDir(recType);
       
   115 }
       
   116 
   105 
   117 
   106 void PagePlayDemo::renameRecord()
   118 void PagePlayDemo::renameRecord()
   107 {
   119 {
   108     QListWidgetItem * curritem = DemosList->currentItem();
   120     QListWidgetItem * curritem = DemosList->currentItem();
   109     if (!curritem)
   121     if (!curritem)