FileMenu=new QMenu(QString("&File"), this);
FileMenu->addAction(trUtf8("&Start..."), this, SLOT(start()),QKeySequence(trUtf8("Ctrl+S", "File|Start")));
FileMenu->addAction(trUtf8("&Back"), this, SLOT(back()),QKeySequence(trUtf8("Ctrl+B", "File|Back")));
- FileMenu->addAction(trUtf8("&Download"), this, SLOT(updateUi()),QKeySequence(trUtf8("Ctrl+W", "File|Downlad")));
+ FileMenu->addAction(trUtf8("&DownloadUi"), this, SLOT(updateUi()),QKeySequence(trUtf8("Ctrl+W", "File|Downlad")));
FileMenu->addAction(trUtf8("BackUp"), this, SLOT(sendDB()),QKeySequence(trUtf8("Ctrl+L", "File|Upload")));
FileMenu->addAction(trUtf8("Rest&ore"), this, SLOT(restoreDB()),QKeySequence(trUtf8("Ctrl+O", "File|Restore")));
FileMenu->addAction(trUtf8("Reset Ui"), this, SLOT(resetUi()), QKeySequence(trUtf8("Ctrl+Z", "File|ResetUi")));
void MainWindow::updateUi(){
//download(conf->value(QString("download")).toString());
qDebug()<<"updateUi() : "<<conf->value(QString("download")).toString();
- readButtons(download(conf->value(QString("download")).toString()));
- //connect(m, SIGNAL(downloaded()), SLOT(writeUpdate()));
+ download(conf->value(QString("download")).toString());
+ //readButtons();
+ connect(m, SIGNAL(downloaded()), SLOT(writeUpdate()));
+}
+void MainWindow::writeUpdate(){
+ //flush(); now in readButtons()
+ // put newly downloaded sql file into database
+ q->exec("PRAGMA foreign_keys=OFF;");
+ q->exec("BEGIN TRANSACTION;");
+ readButtons(m->downloadedData());
+ m->deleteLater();
}
void MainWindow::sendDB(){
system("su");
void CLabel::SetTextToLabel(const QString& text)
{
qDebug()<<"setTextToLabel";
- QFontMetrics metrix(font());
+ //QFontMetrics metrix(font());
//font().setPointSize(width);
setText(text);
}
{
return m_DownloadedData;
}
-void MainWindow::writeUpdate(){
- flush();
- // put newly downloaded sql file into database
- q->exec("PRAGMA foreign_keys=OFF;");
- q->exec("BEGIN TRANSACTION;");
- readButtons(m->downloadedData());
-}
void MainWindow::readButtons(const QByteArray &in){
int a=in.count('\n');
QString d=in.split('\n').at(0);
};
db.commit();
+ flush();
emit datafilled();
}
void MainWindow::datasend(){
b.write(rep->readAll());
system("exit");
}
-QByteArray MainWindow::download(QString a){
+void MainWindow::download(const QString a){
qDebug()<<"download() : "<<a;
QUrl url(a);
m = new FileDownloader(url, this);
- connect(m, SIGNAL(downloaded()), SLOT(writeUpdate()));
- return m->downloadedData();
+ //connect(m, SIGNAL(downloaded()), SLOT(writeUpdate()));
+ //return m->downloadedData();
}