33 QFont * font14 = new QFont("MS Shell Dlg", 14); |
33 QFont * font14 = new QFont("MS Shell Dlg", 14); |
34 QGridLayout * pageLayout = new QGridLayout(this); |
34 QGridLayout * pageLayout = new QGridLayout(this); |
35 pageLayout->setColumnStretch(0, 1); |
35 pageLayout->setColumnStretch(0, 1); |
36 pageLayout->setColumnStretch(1, 2); |
36 pageLayout->setColumnStretch(1, 2); |
37 pageLayout->setColumnStretch(2, 1); |
37 pageLayout->setColumnStretch(2, 1); |
|
38 pageLayout->setRowStretch(2, 100); |
38 |
39 |
39 BtnBack = new QPushButton(this); |
40 BtnBack = new QPushButton(this); |
40 BtnBack->setFont(*font14); |
41 BtnBack->setFont(*font14); |
41 BtnBack->setText(QPushButton::tr("Back")); |
42 BtnBack->setText(QPushButton::tr("Back")); |
42 pageLayout->addWidget(BtnBack, 2, 0); |
43 pageLayout->addWidget(BtnBack, 3, 0); |
43 |
44 |
44 BtnPlayDemo = new QPushButton(this); |
45 BtnPlayDemo = new QPushButton(this); |
45 BtnPlayDemo->setFont(*font14); |
46 BtnPlayDemo->setFont(*font14); |
46 BtnPlayDemo->setText(QPushButton::tr("Play demo")); |
47 BtnPlayDemo->setText(QPushButton::tr("Play demo")); |
47 pageLayout->addWidget(BtnPlayDemo, 2, 2); |
48 pageLayout->addWidget(BtnPlayDemo, 3, 2); |
48 |
49 |
49 BtnRenameRecord = new QPushButton(this); |
50 BtnRenameRecord = new QPushButton(this); |
50 // BtnRenameRecord->setFont(*font14); |
|
51 BtnRenameRecord->setText(QPushButton::tr("Rename")); |
51 BtnRenameRecord->setText(QPushButton::tr("Rename")); |
52 pageLayout->addWidget(BtnRenameRecord, 0, 2); |
52 pageLayout->addWidget(BtnRenameRecord, 0, 2); |
53 |
53 |
|
54 BtnRemoveRecord = new QPushButton(this); |
|
55 BtnRemoveRecord->setText(QPushButton::tr("Delete")); |
|
56 pageLayout->addWidget(BtnRemoveRecord, 1, 2); |
|
57 |
54 DemosList = new QListWidget(this); |
58 DemosList = new QListWidget(this); |
55 DemosList->setGeometry(QRect(170, 10, 311, 311)); |
59 DemosList->setGeometry(QRect(170, 10, 311, 311)); |
56 pageLayout->addWidget(DemosList, 0, 1, 2, 1); |
60 pageLayout->addWidget(DemosList, 0, 1, 3, 1); |
57 |
61 |
58 connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord())); |
62 connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord())); |
|
63 connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord())); |
59 } |
64 } |
60 |
65 |
61 void PagePlayDemo::FillFromDir(RecordType rectype) |
66 void PagePlayDemo::FillFromDir(RecordType rectype) |
62 { |
67 { |
63 QDir dir; |
68 QDir dir; |
122 QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname); |
127 QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname); |
123 else |
128 else |
124 FillFromDir(recType); |
129 FillFromDir(recType); |
125 } |
130 } |
126 } |
131 } |
|
132 |
|
133 void PagePlayDemo::removeRecord() |
|
134 { |
|
135 QListWidgetItem * curritem = DemosList->currentItem(); |
|
136 if (!curritem) |
|
137 { |
|
138 QMessageBox::critical(this, |
|
139 tr("Error"), |
|
140 tr("Please, select record from the list"), |
|
141 tr("OK")); |
|
142 return ; |
|
143 } |
|
144 QFile rfile(curritem->data(Qt::UserRole).toString()); |
|
145 |
|
146 QFileInfo finfo(rfile); |
|
147 |
|
148 bool ok; |
|
149 |
|
150 ok = rfile.remove(); |
|
151 if(!ok) |
|
152 QMessageBox::critical(this, tr("Error"), tr("Cannot delete file")); |
|
153 else |
|
154 FillFromDir(recType); |
|
155 } |