Exemplo n.º 1
0
int main ()
{
	WINDOW **win;			//Окна
	char content[2][512][128];	//Содержимое окон
	char patch[2][512];		//Директории в которых мы находимся
	unsigned count[2];
	unsigned active;		//Индекс активного окна
	unsigned print;
	unsigned select;
	int key = 0;

	init_manager(&win, content, count, patch, &active, &print, &select);
	refresh_manager(win, content, active, print, select);
		
	while((key = getch()) != 27)
	{
		switch(key)
		{
			case KEY_DOWN:
				if(print + select >= count[active] - 1)
					continue;
				if(select >= LINES - 3)
					print++;
				else
					select++;
			break;
			case KEY_UP:
				if(print <= 0 && select <= 0)
					continue;
				if(select <= 0)
					print--;
				else
					select--;
			break;
			case KEY_LEFT:
				if(active == LEFT)
					continue;
				active = LEFT;
				print = 0;
				select = 0;
				chdir(patch[active]);
			break;
			case KEY_RIGHT:
				if(active == RIGHT)
					continue;
				active = RIGHT;
				print = 0;
				select = 0;
				chdir(patch[active]);
			break;
			case '\n':
				open_dir(content[active][select + print], patch, content[active], &(count[active]), active);
				print = 0;
				select = 0;
			break;
		}
		refresh_manager(win, content, active, print, select);
	}
	destroy_manager();
}
Exemplo n.º 2
0
void MapWidget::setGeo(const QGeoCoordinate &geo)
{
    p->image = QImage(":/qml/Papyrus/files/map-loading.png").scaled(width(),height(),
                                                                  Qt::IgnoreAspectRatio,
                                                                  Qt::SmoothTransformation);

    update();
    if( !geo.latitude() && !geo.longitude() )
        return;
    if( p->reply )
        return;

    init_manager();

    p->geo = geo;
    QString path = "http://maps.google.com/maps/api/staticmap?center=" +
            QString::number(geo.latitude()) + "," + QString::number(geo.longitude()) + "&zoom=15&size=" +
            QString::number(width()) + "x" + QString::number(height()) + "&sensor=false";

    QNetworkRequest request = QNetworkRequest(QUrl(path));
    p->reply = p->manager->get(request);

    connect(p->reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(sslErrors(QList<QSslError>)));
    connect(p->reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(downloadProgress(qint64,qint64)) );

    setToolTip( QString::number(p->geo.latitude()) + ", " + QString::number(p->geo.longitude()) );
}
Exemplo n.º 3
0
void ddl_init()
  {
  char *c;
  char *path,*temp;

  c = get_text_field(config_file,"CESTA_DATA");
  concat(path,c,"SKELDAL.DDL");
  c = get_text_field(config_file,"CESTA_TEMP");
  if (c != NULL)concat(temp,c,"~MAPEDIT.TMP");else temp = c;
  printf("Hledam soubor %s\n",path);
  init_manager(path,temp);
  }
Exemplo n.º 4
0
int
main (int argc, char *argv[])
{
    GtkWidget *window;

    init_manager ();

    gtk_init (&argc, &argv);

#ifdef LOAD_GUI_FROM_FILE
    window = create_window_from_file (MAIN_WINDOW, "window");
#else
    window = create_window_from_string (mainWindowString, "window");
#endif
    gtk_widget_hide (window); //Hack to call the 'on show' handler
    gtk_widget_show (window);
    gtk_main ();

    return 0;
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: zzt93/os-lab1
void
os_init_cont(void) {
    /* Reset the GDT. Although user processes in Nanos run in Ring 0,
       they have their own virtual address space. Therefore, the
       old GDT located in physical address 0x7C00 cannot be used again. */
    init_segment();

    /* Initialize the serial port. After that, you can use printk() */
    init_serial();

    /* Set up interrupt and exception handlers,
       just as we did in the game. */
    init_idt();

    /* Initialize the intel 8259 PIC. */
    //The Intel 8259 is a Programmable Interrupt Controller (PIC)
    init_intr();

    /**
       initialize kmalloc -- have to initialize it before init
       process, for using it in allocating memory for PCB
    */
    init_kmalloc();
    // make it NOINTR, can receive msg, can schedule
    init_idle();

    NOINTR;

    /**
       init_driver() have to before init_file_system() for FM have
       to send message to `ide` to read file system
     */
    init_driver();
    init_manager();
    NOINTR;
    init_error_msg();
    // init_proc() and init_manager() can replace??
    // solved by split set count_of_lock out of init_proc();

    //more_frequent();
    // init empty thread
    init_proc_test();

    // here is to initialize shell process, which must later
    // than init_manager -- for it will send message to
    // managers
    //ram_user_process();


    // @checked: move from locked state to unlocked state
    init_file_system();

    unlock(); // set interrupt enabled
    INTR;

    /**
       init_file_system() have to before init_proc()
       for init_proc() will using the `default_cwd` which is
       initialized by FM
    */
    /* Initialize the state of process idle, ie the running
       process for set up right lock num to avoid other
       initialization enable the interrupt and cause problem
    */

    // @checked: move from locked state to unlocked state
    welcome();

    user_process();
    // set idle not to using cpu time
    // for it is originally set to sleep when send message
    current->state = SLEEPED;


    /* This context now becomes the idle process. */
    while (1) {
        printk("!");
        wait_intr();
    }
}