Skip to content

Commit a403a9b

Browse files
adriwebjacobly0
authored andcommitted
link: cleanup: sentFile isn't used anymore.
Also, print usb err on failure only. Display success message when ok.
1 parent eec95d3 commit a403a9b

File tree

6 files changed

+4
-50
lines changed

6 files changed

+4
-50
lines changed

core/link.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ int EMSCRIPTEN_KEEPALIVE emu_send_variables(const char *const *files, int num, i
3939
sprintf(argv[i+1], "send%s:%s", locations[location], files[i]);
4040
}
4141
int err = usb_init_device(1+num, (const char *const *)argv, progress_handler, progress_context);
42-
gui_console_printf("[CEmu] Transfer. usb_init_device ret = %d.\n", err);
42+
if (err != 0) {
43+
gui_console_printf("[CEmu] USB transfer error code %d.\n", err);
44+
}
4345

4446
for(int i=1; i<=num; i++) {
4547
free(argv[i]);

gui/qt/emuthread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ bool EmuThread::progressHandler(void *context, int value, int total) {
241241
EmuThread* emuThread = reinterpret_cast<EmuThread *>(context);
242242
if (value == 1 && total == 1) {
243243
emuThread->setThrottle(emuThread->m_backupThrottleForTransfers);
244+
gui_console_printf("[CEmu] USB transfer(s) completed succesfully.\n");
244245
}
245246
emit emuThread->linkProgress(value, total);
246247
return false;

gui/qt/emuthread.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class EmuThread : public QThread {
8080
void loaded(emu_state_t state, emu_data_t type);
8181
void blocked(int req);
8282
void linkProgress(int value, int total);
83-
void sentFile(const QString &file, int ok);
8483

8584
public slots:
8685
void send(const QStringList &names, int location);

gui/qt/mainwindow.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ MainWindow::MainWindow(CEmuOpts &cliOpts, QWidget *p) : QMainWindow(p), ui(new U
392392
// sending handler
393393
connect(sendingHandler, &SendingHandler::send, &emu, &EmuThread::send, Qt::QueuedConnection);
394394
connect(&emu, &EmuThread::linkProgress, sendingHandler, &SendingHandler::linkProgress, Qt::QueuedConnection);
395-
connect(&emu, &EmuThread::sentFile, sendingHandler, &SendingHandler::sentFile, Qt::QueuedConnection);
396395
connect(sendingHandler, &SendingHandler::loadEquateFile, this, &MainWindow::equatesAddFile);
397396

398397
// memory editors

gui/qt/sendinghandler.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -173,52 +173,6 @@ void SendingHandler::linkProgress(int value, int total) {
173173
guiSend = false;
174174
}
175175

176-
void SendingHandler::sentFile(const QString &file, int ok) {
177-
178-
static int result = LINK_GOOD;
179-
result |= ok;
180-
181-
// Send null to complete sending
182-
if (file.isEmpty()) {
183-
if (result & LINK_ERR) {
184-
QMessageBox::critical(Q_NULLPTR, QObject::tr("Transfer error"), QObject::tr("Transfer Error, see console for information."));
185-
}
186-
else if (result & LINK_WARN) {
187-
QMessageBox::warning(Q_NULLPTR, QObject::tr("Transfer warning"), QObject::tr("Transfer Warning, see console for information."));
188-
}
189-
result = LINK_GOOD;
190-
m_progressBar->setValue(m_progressBar->maximum());
191-
guiDelay(100);
192-
if (m_progressBar) {
193-
m_progressBar->setVisible(false);
194-
m_progressBar->setValue(0);
195-
}
196-
guiSend = false;
197-
return;
198-
}
199-
200-
QFileInfo fi(file);
201-
QString directory = fi.absolutePath();
202-
203-
// check for sending of equate file
204-
if (m_sendEquates) {
205-
if (!m_dirs.contains(directory)) {
206-
m_dirs.append(directory);
207-
checkDirForEquateFiles(directory);
208-
}
209-
}
210-
211-
// don't add temp files (created by bundles)
212-
if (directory != m_tempDir.path()) {
213-
addFile(file, true);
214-
}
215-
216-
if (m_progressBar) {
217-
m_progressBar->setValue(m_progressBar->value() + 1);
218-
}
219-
}
220-
221-
222176
void SendingHandler::addFile(const QString &file, bool select) {
223177
int j, rows = m_table->rowCount();
224178

gui/qt/sendinghandler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class SendingHandler : public QObject {
3232

3333
public slots:
3434
void linkProgress(int amount, int total);
35-
void sentFile(const QString &file, int ok);
3635
void resendPressed();
3736
void removeRow();
3837

0 commit comments

Comments
 (0)