예제 #1
0
void HGTController::run()
{
	bool usingDiffs = false;

	fillDownloadList(usingDiffs);

	try
	{
		doDownload();

		//if we failed to expand the diffs, restart the download
		if (usingDiffs && !expandDiffs())
		{
			fillDownloadList(usingDiffs);

			if (usingDiffs)
				throw gcException(ERR_WEBDL_FAILED, "Diff download failed and shouldnt be trying again. :(");

			doDownload();
		}
	}
	catch (gcException &except)
	{
		onErrorEvent(except);
		return;
	}
}
예제 #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
connect(ui->downloadbutton,SIGNAL(clicked()),this,SLOT(doDownload()));
}
TEST_F(RemoteAudioFakeTcpTest, PlayTest) {
    doDownload();

    bool stereo = false;
    int id = 0;
    int samplingF = 44100;
    int mode = AudioHardware::EModeVoice | (stereo ? 0x80000000 : 0);
    int volume = 0;
    int repeat = 1;

    uint32_t prepareSend[] = {
            U32_ENDIAN_SWAP(AudioProtocol::ECmdStartPlayback),
            U32_ENDIAN_SWAP(20),
            U32_ENDIAN_SWAP(id), //id
            U32_ENDIAN_SWAP(samplingF),
            U32_ENDIAN_SWAP(mode),
            U32_ENDIAN_SWAP(volume),
            U32_ENDIAN_SWAP(repeat)
    };
    uint32_t prepareReply[] = {
            U32_ENDIAN_SWAP((AudioProtocol::ECmdStartPlayback & 0xffff) | 0x43210000),
            0,
            0
    };

    mTestSocket.setSendExpectation((char*)prepareSend, sizeof(prepareSend));
    // this is reply, but set expectation for reply first as it is sent after send
    mTestSocket.setReadExpectation((char*)prepareReply, sizeof(prepareReply));

    ASSERT_TRUE(mRemoteAudio->startPlayback(stereo, samplingF, mode, volume, id, repeat));
    ASSERT_TRUE(mRemoteAudio->waitForPlaybackCompletion());
}
예제 #4
0
void Download::initThread()
{
  int status = true;
  while(!doExit && status) {
    status = doDownload();
  }
  hThread=0;
}
예제 #5
0
void downloader::reDownload()
{
    if(!firstAttempt)
    {
        this->msleep(1000);
        firstAttempt = false;
    }
    doDownload();
}
void DownloadManager::execute() {
	QDate today = QDate::currentDate();
	QDate from( 2009, 3, 30 );	//ダウンロード可能な一番古い日付

	if ( !reread || !past )
		from = today.addDays( -7 );

	for ( QDate i = today; i >= from; i = i.addDays( -1 ) ) {
		if ( i.dayOfWeek() >= 1 && i.dayOfWeek() <= 5 ) {
			QUrl url( "http://cgi2.nhk.or.jp/e-news/news/index.cgi?ymd=" + i.toString( "yyyyMMdd" ) );
			doDownload( url );
		}
	}

	if ( !reread && past ) {
		doDownload( QUrl(SEARCH_20100323 ) );
		doDownload( QUrl(SEARCH_20090330 ) );
	}
}
예제 #7
0
void DownloadManager::execute(QStringList args)
{
    if (args.isEmpty()) {
        return;
    }

    foreach (QString arg, args) {
        QUrl url = QUrl::fromEncoded(arg.toLocal8Bit());
        doDownload(url);
    }
예제 #8
0
void dbmanager::downloadFinished(){
    qDebug()<<filename;
    if(m_network_reply->error() == QNetworkReply::NoError){

        // set filename and location to store the file  ( Generic location of application data )
        m_file =  new QFile(imgpath+"/"+filename+".svg");
        qDebug()<<imgpath+"/"+filename;
        if(!m_file->open(QIODevice::ReadWrite | QIODevice::Truncate)){
            qDebug() << m_file->errorString();
        }
        m_file->write(m_network_reply->readAll());

        QByteArray bytes = m_network_reply->readAll();
        QString str = QString::fromUtf8(bytes.data(), bytes.size());
        int statusCode = m_network_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
        qDebug() << QVariant(statusCode).toString();
    }
    m_file->flush();
    m_file->close();
    // increment the counter on the basis of total number of files to download
    int total = down_links.count();
    if(current<total-1){
        current++;
        qDebug()<<"current = "<<current<<"total = "<<total;
        doDownload(down_links);}
    else if(current==total-1)
    {
        qDebug()<<"download complete";
        down_links.clear();
        math_svg = false;
        clear_list();
    }

    bool success = false ;
    QString fname = filename;
    success = add_depend(fname,revision_number); //  add the dependencies entry in database i.e. images
    if(success == true)
    {
        qDebug() <<"added in dependency table";
    }
    else
    {
        qDebug() << " error in adding to dependency table";
    }


}
예제 #9
0
void MainWindow::getChannelIcons()
{
    QSqlQuery query(db);
       query.exec("SELECT chanId FROM channels");

       while (query.next()) {
           QString name = query.value(0).toString();

           QString Icon = "/sdcard/MythDroidData/Icons/" + name + ".jpg";
           if (!QFile().exists(Icon)){
           QUrl url("http://192.168.1.10:6544/Myth/GetChannelIcon?ChanId=" + name);
           doDownload(url);
           }
           QSettings settings("OpenSource", "MythDroid");
           settings.setValue("icons", 1);
       }
       return;
}
예제 #10
0
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
uglyTime(NULL);
cgiSpoof(&argc, argv);
setUdcCacheDir();
oldCart = hashNew(0);
if (cgiVarExists(hgpDoDownload))  /* use cgiVars -- do not commit to any cart method yet */
    {
    struct sqlConnection *conn = sqlConnect(visiDb);
    cart = cartAndCookieNoContent(hUserCookie(), excludeVars, oldCart);
    doDownload(conn);
    cartCheckout(&cart);
    }
else
    {
    cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldCart);
    }
cgiExitTime("hgVisiGene", enteredMainTime);
return 0;
}
예제 #11
0
UpdateDlg::UpdateDlg(QWidget *parent) :
    QDialog(parent)
{


 isUpToDate = true;
 QLabel *blank2Label = new QLabel("");
 QLabel *blank3Label = new QLabel("");
 QLabel *blank4Label = new QLabel("");
 availUpdateLabel = new QLabel(tr("Please wait as we check for available updates"));
 confirmUpdateLabel = new QLabel(tr(" "));
 updateInfoPlainTextEdit = new QPlainTextEdit();
 updateInfoPlainTextEdit->setReadOnly(true);
 yesPushButton = new QPushButton(tr("Yes"));
 yesPushButton->setVisible(false);
 connect(yesPushButton, SIGNAL(clicked()), this, SLOT(doDownload()));
 cancelPushButton = new QPushButton(tr("Cancel"));
 connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(close()));


 statusLabel = new QLabel;

 setFixedSize(UPDATE_WIDTH, UPDATE_HEIGHT );
 QGridLayout *mainLayout = new QGridLayout;
 mainLayout->addWidget(availUpdateLabel, 0, 0, 1, 4);
 mainLayout->addWidget(blank2Label, 1, 0, 1, 4);
 mainLayout->addWidget(updateInfoPlainTextEdit, 2, 0, 1, 4);
 mainLayout->addWidget(blank3Label, 3, 0, 1, 4);
 mainLayout->addWidget(confirmUpdateLabel , 4, 0, 1, 4);
 mainLayout->addWidget(blank4Label, 5, 0, 1, 4);
 mainLayout->addWidget(yesPushButton, 6, 2);
 mainLayout->addWidget(cancelPushButton, 6, 3);
 setWindowFlags(Qt::FramelessWindowHint);
 setLayout(mainLayout);
 setWindowFlags(Qt::Dialog);
 setWindowTitle(tr("LimeBible Updates"));

}
예제 #12
0
void WGTWorker::run()
{
	m_szUrl = m_pProvMng->getUrl(m_uiId);
	if (m_szUrl == "NULL")
	{
		Warning(gcString("Mcf Download Thread [{0}] failed to get valid url for download.\n", m_uiId));
		return;
	}

	gcString name = m_pProvMng->getName(m_uiId);

	m_pMcfCon = new MCFCore::Misc::MCFServerCon();
	m_pMcfCon->setDPInformation(name.c_str());
	m_pMcfCon->onProgressEvent += delegate(this, &WGTWorker::onProgress);

	while (!isStopped())
	{
		uint32 status = m_pCT->getStatus(m_uiId);

		uint32 pauseCount = 0;

		bool isPaused= (status == MCFCore::Thread::BaseMCFThread::SF_STATUS_PAUSE);

		if (isPaused)
			m_pMcfCon->onPause();

		while (status == MCFCore::Thread::BaseMCFThread::SF_STATUS_PAUSE)
		{
			if (pauseCount > 30000 && m_pMcfCon->isConnected())
				m_pMcfCon->disconnect();

			gcSleep(500);
			pauseCount += 500;

			status = m_pCT->getStatus(m_uiId);
		}

		if (isPaused)
		{
			gcString name = m_pProvMng->getName(m_uiId);
			m_pMcfCon->setDPInformation(name.c_str());
		}

		if (status == MCFCore::Thread::BaseMCFThread::SF_STATUS_STOP)
			break;

		m_ErrorMutex.lock();
		if (m_bError)
		{
			requestNewUrl(m_Error);
			m_bError = false;
		}
		m_ErrorMutex.unlock();

		if (status == MCFCore::Thread::BaseMCFThread::SF_STATUS_CONTINUE)
			doDownload();
	}

	m_pProvMng->removeAgent(m_uiId);

	m_DeleteMutex.lock();
	safe_delete(m_pMcfCon);
	m_DeleteMutex.unlock();

	//need to do this incase we are the last thread and the controller is stuck on the wait mutex
	m_pCT->pokeThread();
}
예제 #13
0
bool FtpServer::handleFrame(Client* cli){
	if (cli->frame.dir == 0) 
		return doUpload(cli);
	else if (cli->frame.dir == 1)
		return doDownload(cli);
}
    void UpdaterDialog::initView()
    {
        /**
         * Set "sortFilterProxy" Model to View
         */
        ui->tableView_1->setModel(sortFilterProxyModel);

        /**
         * Set Item Delegates for "SoftwareComponent" and "Action" Columns
         */
        softwareDelegate = new Updater::SoftwareColumnItemDelegate;
        ui->tableView_1->setItemDelegateForColumn(Columns::SoftwareComponent, softwareDelegate);

        actionDelegate = new Updater::ActionColumnItemDelegate;
        ui->tableView_1->setItemDelegateForColumn(Columns::Action, actionDelegate);

        connect(actionDelegate, SIGNAL(downloadButtonClicked(QModelIndex)), this, SLOT(doDownload(QModelIndex)));
        connect(actionDelegate, SIGNAL(installButtonClicked(QModelIndex)), this, SLOT(doInstall(QModelIndex)));

        /**
         * Configure view
         */
        // enable mouse tracking to be able to bind the mouseover/hover event
        ui->tableView_1->setMouseTracking(true);
        // disable resizing of the columns
        ui->tableView_1->horizontalHeader()->setSectionResizeMode(Columns::SoftwareComponent, QHeaderView::Stretch);
        ui->tableView_1->horizontalHeader()->setSectionResizeMode(Columns::LatestVersion, QHeaderView::Fixed);
        ui->tableView_1->horizontalHeader()->setSectionResizeMode(Columns::YourVersion, QHeaderView::Fixed);
        // hide columns (1 and 3; both URLs)
        ui->tableView_1->setColumnHidden(Columns::WebsiteURL, true);
        ui->tableView_1->setColumnHidden(Columns::DownloadURL, true);
        // settings
        ui->tableView_1->setAutoScroll(true);
        ui->tableView_1->setAlternatingRowColors(true);
        // sort
        ui->tableView_1->setSortingEnabled(true);
        ui->tableView_1->sortByColumn(Columns::SoftwareComponent, Qt::AscendingOrder);
        // sizes
        ui->tableView_1->verticalHeader()->setDefaultSectionSize(28);
        ui->tableView_1->horizontalHeader()->setDefaultSectionSize(28);
        //ui->tableView_1->resizeRowsToContents();
        ui->tableView_1->resizeColumnsToContents();
        ui->tableView_1->setColumnWidth(Columns::SoftwareComponent, 150);
        ui->tableView_1->setColumnWidth(Columns::LatestVersion, 80);
        ui->tableView_1->setColumnWidth(Columns::YourVersion, 80);
        ui->tableView_1->setColumnWidth(Columns::Action, 200);
    }
예제 #15
0
int WINAPI WinMain(HINSTANCE hThisInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpszArgument,
	int nFunsterStil)
{

	atexit(lastExit);
	SingleInstanceManager instanceman;

	globalResMan = new ResourceManager("JAVA", PROPID, JARID, JNISMOOTHID);

	string silentFile = FileUtils::getExecutablePath() + "setup.silent";
	_silent = FileUtils::fileExists(silentFile);

	// sets up the command line arguments
	// not sure if lpszArgument can be 0 on Windows...
	if ((lpszArgument != 0) && (strlen(lpszArgument) > 0))
	{
		// Note that this overwrites an existing KEY_ARGUMENTS
		std::vector<std::string> args = StringUtils::split(lpszArgument, " \t\n\r", "\"'", false);
		globalResMan->setUserArguments(args);
	}

	loadLanguage(globalResMan->getProperty("minversion"));

	bool dodebug = globalResMan->getBooleanProperty("skel_Debug");

	if (dodebug)
	{
		DEBUGCONSOLE = new DebugConsole("JSmooth Debug");
		globalResMan->printDebug();
	}

	bool singleinstance = globalResMan->getBooleanProperty("skel_SingleInstance");
	if (singleinstance)
	{
		if (instanceman.alreadyExists())
		{
			if (!_silent) {
				instanceman.sendMessageInstanceShow();
			}
			exit(0);
		}
		else
		{
			instanceman.startMasterInstanceServer();
		}
	}

	DEBUG(string("Main class: ") + globalResMan->getMainName());

	char curdir[_MAX_PATH];
	GetCurrentDirectory(_MAX_PATH, curdir);
	DEBUG(string("Currentdir: ") + curdir);

	string newcurdir = globalResMan->getCurrentDirectory();
	SetCurrentDirectory(newcurdir.c_str());

	std::string message = MSG_ERROR_NO_JAVA_FIRST;// globalResMan->getProperty("skel_Message");
	std::string url = globalResMan->getProperty("skel_DownloadURL");
	std::string params = globalResMan->getProperty("skel_DownloadURLParams");
	bool singleProcess = globalResMan->getBooleanProperty("skel_SingleProcess");

	int tries = 0;
	int exitCode = 0;
	while (true) {

		if (tries > 0) {
			DEBUG("try jre again after download...");
		}

		JavaMachineManager *man = new JavaMachineManager(*globalResMan);
		man->setAcceptExe(true);
		man->setAcceptDLL(true);
		man->setUseConsole(dodebug);
		man->setPreferDLL(singleProcess);

		bool ok = man->run();
		exitCode = man->getExitCode();
		delete man;

		if (ok) {
			if (tries > 0) {
				Sleep(2000); // w/o may be the cause for the message 'installer already running'
			}
			break;
		}

		if (tries > 0) {
			if (_silent) {
				DEBUG(MSG_ERROR_NO_JAVA);
			}
			else {
				MessageBox(0, MSG_ERROR_NO_JAVA.c_str(), APP_TITLE.c_str(), MB_OK | MB_APPLMODAL);
			}
			break;
		}

		tries++;

		DEBUG("Displaying message to user...");
		DEBUG("URL=" + url);
		if (url.empty())
		{
			showGenericError();
			break;
		}

		if (!_silent && MessageBox(0, message.c_str(), APP_TITLE.c_str(), MB_OKCANCEL | MB_ICONQUESTION | MB_APPLMODAL) != IDOK) {
			break;
		}

		string adParams = params;
		string file = doDownload(url, adParams);

		if (file.empty())
		{
			showGenericError();
			break;
		}

		string ext = StringUtils::toLowerCase(FileUtils::getFileExtension(file));
		if (ext == "exe")
		{
			makeExecInfoGui(MSG_INSTALLING_JAVA, MSG_INSTALLING_JAVA_WAIT, file + " " + adParams, _silent);
		}
		else // anything else, we try to open it like a document
		{
			ShellExecute(0, "open", file.c_str(), adParams.c_str(), "", 0);
		}
	}

	DEBUG("NORMAL EXIT");
	DEBUGWAITKEY();

	return exitCode;
}
예제 #16
0
UpdateDlg::UpdateDlg(QString url,QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDlg) {
    ui->setupUi(this);
    m_url = url;
    QObject::connect(ui->btnUpdate, SIGNAL(clicked()),this, SLOT(doDownload()));
}
예제 #17
0
char doRegular(char expand, char c)
{
    char toReturn;
    int i;
    int done = 0;
    label doorinfo;

    toReturn = FALSE;

    for (i = 0; !expand && i < MAXEXTERN && extCmd[i].name[0]; ++i) {
        if (c == toupper(extCmd[i].name[0]) && (onConsole || !extCmd[i].local)) {
            done = 1;
            mPrintf("\b%s", extCmd[i].name);
            doCR();
            if (changedir(cfg.aplpath) == ERROR) {
                mPrintf("  -- Can't find application directory.\n\n");
                changedir(cfg.homepath);
            }
        /* apsystem(extCmd[i].command); */
            sprintf(doorinfo, "DORINFO%d.DEF", onConsole ? 0 : userdat.apl_com);
            extFmtRun(extCmd[i].command, doorinfo);
        }
    }
    if (!done) {
        switch (c) {

            case 'S':
                if (gl_user.sysop && expand) {
                    mPrintf("\b\bSysop Menu");
                    doCR();
                    doSysop();
                } else {
                    toReturn = TRUE;
                }
                break;

            case 'A':
                if (gl_user.aide) {
                    doAide(expand, 'E');
                } else {
                    toReturn = TRUE;
                }
                break;

            case 'C':
                doChat(expand, '\0');
                break;
            case 'D':
                doDownload(expand);
                break;
            case 'E':
                doEnter(expand, 'm');
                break;
            case 'F':
                doRead(expand, 'f');
                break;
            case 'G':
                doGoto(expand, FALSE);
                break;
            case 'H':
                doHelp(expand);
                break;
            case 'I':
                doIntro();
                break;
            case 'J':
                mPrintf("\bJump back to ");
                unGotoRoom();
                break;
            case 'K':
                doKnown(expand, 'r');
                break;
            case 'L':
                if (!loggedIn) {
                    doLogin(expand);
                } else {
                    if (!getYesNo(confirm, 0))
                        break;
                    doLogout(expand, 's');
                    doLogin(expand);
                }
                break;
            case 'N':
            case 'O':
            case 'R':
                doRead(expand, tolower(c));
                break;

            case 'B':
                doGoto(expand, TRUE);
                break;
            case 'T':
                doLogout(expand, 'q');
                break;
            case 'U':
                doUpload(expand);
                break;
            case 'X':
                if (!expand) {
                    doEnter(expand, 'x');
                } else {
                    doXpert();
                }
                break;

            case '=':
            case '+':
                doNext();
                break;
            case '\b':
                mPrintf("  ");
            case '-':
                doPrevious();
                break;

            case ']':
            case '>':
                doNextHall();
                break;
            case '[':
            case '<':
                doPreviousHall();
                break;
            case '~':
                mPrintf("\bAnsi %s\n ", gl_term.ansiOn ?
					gl_str.off : gl_str.on);
                gl_term.ansiOn = !gl_term.ansiOn;
                break;

            case '!':
                mPrintf("\bIBM Graphics %s\n ", gl_term.IBMOn ?
					gl_str.off:gl_str.on);
                gl_term.IBMOn = !gl_term.IBMOn;
                break;

            case '?':
                nextmenu("mainopt", &(cfg.cnt.mainopttut), 1);
				listExterns();
                break;

            case 0:     /* never gets here in shell mode... */
                if (newCarrier) {
                    greeting();

                    if (cfg.forcelogin) {
                        doCR();
                        doCR();
                        i = 0;
                        while (!loggedIn && gotCarrier()) {
                            doLogin(2);
                            if (++i > 3) {
                                Initport();
                                toReturn = TRUE;
                                break;
                            }
                        }
                    }
                    newCarrier = FALSE;
                }
                if (logBuf.lbflags.NODE && loggedIn) {
                    net_slave();

                    haveCarrier = FALSE;
                    modStat = FALSE;
                    newCarrier = FALSE;
                    justLostCarrier = FALSE;
                    onConsole = FALSE;
                    disabled = FALSE;
                    callout = FALSE;

                    delay(2000);

                    Initport();

                    cfg.callno++;
                    terminate(FALSE, FALSE);
                }
                if (justLostCarrier || ExitToMsdos) {
                    justLostCarrier = FALSE;
                    if (loggedIn)
                        terminate(FALSE, FALSE);
                }
                break;      /* irrelevant value */

            default:
                toReturn = TRUE;
                break;
        }
    }
    /* if they get unverified online */
    if (logBuf.VERIFIED)
        terminate(FALSE, FALSE);

    /* update25();	*/
	do_idle(0);
    return toReturn;
}
TEST_F(RemoteAudioFakeTcpTest, DownloadTest) {
    doDownload();
}