Esempio n. 1
0
TDDSubMenu::TDDSubMenu(const Size &size,
					   const Color4B &headerColor,
					   const Color4B &bodyColor,
					   const Color3B &textColor,
					   const std::string font,
					   const int fontSize)
: mShow(true)
, mHeaderLayer(NULL)
, mToggleButton(NULL)
, mIsPressed(false)
, mMenu(NULL)
, mBackButton(NULL)
{
	TDDSubMenu::initWithColor(bodyColor, size.width, size.height);
	
	mMaxSize.width = size.width;
	mMaxSize.height = size.height;
	
	// Add the header
	setupHeader(headerColor);
	setupMenu();
	
	// Set touch
	setTouchEnabled(true);
	setTouchMode(Touch::DispatchMode::ONE_BY_ONE);	// ???
}
Esempio n. 2
0
BAMseek::BAMseek(QWidget *parent) : QMainWindow(parent), pr(0)
{
  setAttribute(Qt::WA_DeleteOnClose);

  setupFileMenu();
  setupHelpMenu();
  setWindowTitle(tr("BAMseek"));

  setupHeader();
  setupTable();
  setupPager();

  QGroupBox * groupbox = new QGroupBox(tr("Page Number"));
  QHBoxLayout * horiz = new QHBoxLayout;
  horiz->addWidget(spinbox);
  horiz->addWidget(slider);
  groupbox->setLayout(horiz);
  
  QVBoxLayout * vert = new QVBoxLayout;
  vert->addWidget(tableview, 1);
  vert->addWidget(groupbox, 0);

  QWidget * layout = new QWidget;
  layout->setLayout(vert);
  setCentralWidget(layout);
  
}
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      clone_task_dialog_(NULL)

{
    setupUi(this);

    // seahub_messages_monitor_ = new SeahubMessagesMonitor(this);
    // mSeahubMessagesBtn->setVisible(false);

    layout()->setContentsMargins(1, 0, 1, 0);

    // Setup widgets from top down
    setupHeader();

    createAccountView();

    createTabs();

    // tool bar have to be created after tabs, since some of the toolbar
    // actions are provided by the tabs
    createToolBar();

    setupDropArea();

    setupFooter();

    QVBoxLayout *vlayout = (QVBoxLayout *)layout();
    vlayout->insertWidget(kIndexOfAccountView, account_view_);
    vlayout->insertWidget(kIndexOfToolBar, tool_bar_);
    vlayout->insertWidget(kIndexOfTabWidget, tabs_);

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());

    refresh_status_bar_timer_ = new QTimer(this);
    connect(refresh_status_bar_timer_, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));

    AccountManager *account_mgr = seafApplet->accountManager();
    connect(account_mgr, SIGNAL(accountsChanged()),
            this, SLOT(onAccountChanged()));

#if defined(Q_OS_MAC)
    mHeader->setVisible(false);
#endif

    connect(ServerStatusService::instance(), SIGNAL(serverStatusChanged()),
            this, SLOT(refreshServerStatus()));
    connect(CustomizationService::instance(), SIGNAL(serverLogoFetched(const QUrl&)),
            this, SLOT(onServerLogoFetched(const QUrl&)));

    QTimer::singleShot(0, this, SLOT(onAccountChanged()));
}
Esempio n. 4
0
AccountWindow::AccountWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags)
	:TableWindow(parent, name, wflags)
{
	QStringList nameList;
	QTableWidget *pTable;
	QAction* pAction;

  pTable = TableWindow::getTable();
	m_pDb = ISql::pInstance();

	pAction = new QAction(tr("&New..."), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(file_new()));
	MDIWindow::addAction(pAction);

	pAction = new QAction(tr("&Edit..."), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit()));
	MDIWindow::addAction(pAction, true);

	pAction = new QAction(tr("&Delete"), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
	MDIWindow::addAction(pAction);

	pAction = new QAction(this);
	pAction->setSeparator(true);
	MDIWindow::addAction(pAction);

	pAction = new QAction(tr("&Export all..."), this);
	connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable()));
	MDIWindow::addAction(pAction);

	// configure the table
	TableWindow::setWindowIcon(QIcon(":/document.xpm"));
	pTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
	pTable->setSelectionMode(QAbstractItemView::SingleSelection);

	// header
  nameList += tr("Username");
  nameList += tr("Contest");
  nameList += tr("Description");

	setupHeader(nameList);

  pTable->setColumnWidth(Username, 100);
  pTable->setColumnWidth(Contest, 100);
  pTable->setColumnWidth(Description, 200);

  connect(m_pDb, SIGNAL(accountsChanged()), this, SLOT(file_update()));

	file_update();
}
Esempio n. 5
0
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      in_refresh_(false),
      list_repo_req_(NULL),
      clone_task_dialog_(NULL)

{
    setupUi(this);

    // seahub_messages_monitor_ = new SeahubMessagesMonitor(this);
    mSeahubMessagesBtn->setVisible(false);

    setupHeader();
    createRepoModelView();
    createLoadingView();
    createLoadingFailedView();
    mStack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    mStack->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    mStack->insertWidget(INDEX_REPOS_VIEW, repos_tree_);

    createToolBar();
    updateAccountInfoDisplay();
    prepareAccountButtonMenu();

    setupDropArea();
    setupFooter();

    mDropArea->setVisible(false); //disk42

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());

    refresh_status_bar_timer_ = new QTimer(this);
    connect(refresh_status_bar_timer_, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshRepos()));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(setCurrentAccount(const Account&)));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(updateAccountMenu()));

    connect(seafApplet->accountManager(), SIGNAL(accountRemoved(const Account&)),
            this, SLOT(updateAccountMenu()));
#ifdef Q_WS_MAC
    mHeader->setVisible(false);
#endif
}
Esempio n. 6
0
BlockContainer::BlockContainer(const QString& title, QWidget* mainWidget, QWidget* headerWidget, QWidget* parent)
: QFrame(parent) {
    setFrameStyle(QFrame::StyledPanel | QFrame::Plain);

    //setup title bar
    QWidget* header = setupHeader(title, headerWidget);

    //Setup contents
    QVBoxLayout* mainLayout = new QVBoxLayout(this);
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    mainLayout->addWidget(header);
    mainLayout->addWidget(mainWidget);
    
    this->setLayout(mainLayout);
}
Esempio n. 7
0
int NProj::run(void) {
	if (NFile::exists("CMakeLists.txt") && !m_force) {
		throw NException("There's already a CMakeLists.txt file in this"
			" project. Remove it before running nproj", 
			NException::TOOLS);
	}

	m_output.setFileName("CMakeLists.txt");
	m_output.open(NIODevice::Truncate);	

	setupHeader();
	addModules();
	addExecutable();
	addLibrary();

	m_output.closeDevice();
	
	return 0;
}
Esempio n. 8
0
  void AdvancedScriptManager::loadScriptList(QListWidgetItem* current, QListWidgetItem* previous) {
    setupHeader();
    QSqlQuery query;
    query.exec("SELECT TSCRIPT_KEY,NAME,DATE_CRE,DATE_MOD FROM TSCRIPT WHERE CATEGORIE = '" + lstCategories->currentItem()->text() + "'");
    int i =1;
    while (query.next())  {
        tblScript->setRowCount(i);
        QTableWidgetItem* aTableWidget = new QTableWidgetItem(query.value(1).toString());
        tblScript->setItem((i-1), 0, aTableWidget);
        tblScript->setRowHeight ((i-1), 20 );


        QDateTime aDateTime;
        
        aDateTime.setTime_t(query.value(2).toString().toUInt());
        QTableWidgetItem* aTableWidget1 = new QTableWidgetItem(aDateTime.toString("dd/MM/yyyy hh:mm:ss"));
        tblScript->setItem((i-1), 1, aTableWidget1);
        
        aDateTime.setTime_t(query.value(3).toString().toUInt());
        QTableWidgetItem* aTableWidget2 = new QTableWidgetItem(aDateTime.toString("dd/MM/yyyy hh:mm:ss"));
        tblScript->setItem((i-1), 2, aTableWidget2);
        
        PlayButton* aPlayButton =  new PlayButton(0);
        aPlayButton->id = query.value(0).toString().toUInt();
        tblScript->setCellWidget((i-1), 4, aPlayButton);
        
        EditButton* anEditButton =  new EditButton(0);
        anEditButton->id = query.value(0).toString().toUInt();
        tblScript->setCellWidget((i-1), 5, anEditButton);
        
        RemoveButton* aRemoveButton =  new RemoveButton(0);
        aRemoveButton->id = query.value(0).toString().toUInt();
        tblScript->setCellWidget((i-1), 6, aRemoveButton);
        
        i++;
    }
    if (tblScript->rowCount() > 0) {
      tblScript->setCurrentCell(0,0);
      scriptSelected(0,0);
    }
  }
PartsBinPaletteWidget::PartsBinPaletteWidget(ReferenceModel *referenceModel, HtmlInfoView *infoView, WaitPushUndoStack *undoStack, BinManager* manager) :
	QFrame(manager)
{
    m_binLabel = NULL;
	m_monoIcon = m_icon = NULL;
	m_searchLineEdit = NULL;
	m_saveQuietly = false;
	m_fastLoaded = false;
	m_model = NULL;

	m_loadingProgressDialog = NULL;

	setAcceptDrops(true);
	setAllowsChanges(true);

	m_manager = manager;

	m_referenceModel = referenceModel;
	m_canDeleteModel = false;
	m_orderHasChanged = false;

	Q_UNUSED(undoStack);

	m_undoStack = new WaitPushUndoStack(this);
	connect(m_undoStack, SIGNAL(cleanChanged(bool)), this, SLOT(undoStackCleanChanged(bool)) );

	m_iconView = new PartsBinIconView(m_referenceModel, this);
	m_iconView->setInfoView(infoView);

	m_listView = new PartsBinListView(m_referenceModel, this);
	m_listView->setInfoView(infoView);

	m_stackedWidget = new QStackedWidget(this);
	m_stackedWidget->addWidget(m_iconView);
	m_stackedWidget->addWidget(m_listView);

	QVBoxLayout * vbl = new QVBoxLayout(this);
    vbl->setMargin(3);
    vbl->setSpacing(0);

    m_header = NULL;
    setupHeader();
    if (m_header) {
	    vbl->addWidget(m_header);

	    QFrame * separator = new QFrame();
	    separator->setMaximumHeight(1);
	    separator->setObjectName("partsBinHeaderSeparator");
        separator->setFrameShape(QFrame::HLine);
        separator->setFrameShadow(QFrame::Plain);
	    vbl->addWidget(separator);
    }

	vbl->addWidget(m_stackedWidget);
	this->setLayout(vbl);

	setObjectName("partsBinContainer");
	toIconView();

    m_defaultSaveFolder = FolderUtils::getUserBinsPath();
	m_untitledFileName = tr("Untitled Bin");

	connect(m_listView, SIGNAL(currentRowChanged(int)), m_iconView, SLOT(setSelected(int)));
	connect(m_iconView, SIGNAL(selectionChanged(int)), m_listView, SLOT(setSelected(int)));

	connect(m_listView, SIGNAL(currentRowChanged(int)), m_manager, SLOT(updateBinCombinedMenuCurrent()));
	connect(m_iconView, SIGNAL(selectionChanged(int)), m_manager, SLOT(updateBinCombinedMenuCurrent()));

	connect(m_listView, SIGNAL(informItemMoved(int,int)), m_iconView, SLOT(itemMoved(int,int)));
	connect(m_iconView, SIGNAL(informItemMoved(int,int)), m_listView, SLOT(itemMoved(int,int)));
	connect(m_listView, SIGNAL(informItemMoved(int,int)), this, SLOT(itemMoved()));
	connect(m_iconView, SIGNAL(informItemMoved(int,int)), this, SLOT(itemMoved()));

	if (m_binLabel) m_binLabel->setText(m_title);

	m_addPartToMeAction = new QAction(m_title,this);
	connect(m_addPartToMeAction, SIGNAL(triggered()),this, SLOT(addSketchPartToMe()));

	installEventFilter(this);
}
Esempio n. 10
0
			BgzfDeflateZStreamBaseFlushInfo flushBound(
				BgzfDeflateInputBufferBase & in, 
				BgzfDeflateOutputBufferBase & out, 
				bool const fullflush 
			)
			{
				// full flush, compress block in two halves
				if ( fullflush )
				{
					uint64_t const toflush = in.pc-in.pa;
					uint64_t const flush0 = (toflush+1)/2;
					uint64_t const flush1 = toflush-flush0;

					/* compress first half of data */
					uint64_t const payload0 = compressBlock(in.pa,flush0,out.outbuf.begin());
					fillHeaderFooter(in.pa,out.outbuf.begin(),payload0,flush0);
					
					/* compress second half of data */
					setupHeader(out.outbuf.begin()+getBgzfHeaderSize()+payload0+getBgzfFooterSize());
					uint64_t const payload1 = compressBlock(in.pa+flush0,flush1,out.outbuf.begin()+getBgzfHeaderSize()+payload0+getBgzfFooterSize());
					fillHeaderFooter(in.pa+flush0,out.outbuf.begin()+getBgzfHeaderSize()+payload0+getBgzfFooterSize(),payload1,flush1);
					
					assert ( 2*getBgzfHeaderSize()+2*getBgzfFooterSize()+payload0+payload1 <= out.outbuf.size() );
										
					in.pc = in.pa;

					return
						BgzfDeflateZStreamBaseFlushInfo(
							flush0,
							getBgzfHeaderSize()+getBgzfFooterSize()+payload0,
							flush1,
							getBgzfHeaderSize()+getBgzfFooterSize()+payload1
						);
				}
				else
				{
					unsigned int const toflush = std::min(static_cast<unsigned int>(in.pc-in.pa),deflbound);
					unsigned int const unflushed = (in.pc-in.pa)-toflush;
					
					/*
					 * write out compressed data
					 */
					uint64_t const payloadsize = compressBlock(in.pa,toflush,out.outbuf.begin());
					fillHeaderFooter(in.pa,out.outbuf.begin(),payloadsize,toflush);
					
					#if 0
					/*
					 * copy rest of uncompressed data to front of buffer
					 */
					if ( unflushed )
						memmove(in.pa,in.pc-unflushed,unflushed);		

					// set new output pointer
					in.pc = in.pa + unflushed;
					#endif

					/* number number of bytes in output buffer */
					// return getBgzfHeaderSize()+getBgzfFooterSize()+payloadsize;
					return BgzfDeflateZStreamBaseFlushInfo(
						toflush,
						getBgzfHeaderSize()+getBgzfFooterSize()+payloadsize,
						in.pa, // moveto
						in.pc-unflushed, // movefrom
						unflushed // movesize
					);
				}
			}
Esempio n. 11
0
CloudView::CloudView(QWidget* parent)
    : QWidget(parent), clone_task_dialog_(NULL)

{
    setupUi(this);

    int marginTop = 0;
    if (shouldUseFramelessWindow()) {
        marginTop = 0;
    }
#ifdef Q_OS_MAC
    marginTop = 0;
#endif

    layout()->setContentsMargins(1, marginTop, 1, 0);

    // Setup widgets from top down
    setupHeader();

    createAccountView();

    createTabs();

    // tool bar have to be created after tabs, since some of the toolbar
    // actions are provided by the tabs
    // createToolBar();

    setupDropArea();

    setupFooter();

    QVBoxLayout* vlayout = (QVBoxLayout*)layout();
    vlayout->insertWidget(kIndexOfAccountView, account_view_);
    vlayout->insertWidget(kIndexOfTabWidget, tabs_);

    if (shouldUseFramelessWindow()) {
        resizer_ = new QSizeGrip(this);
        resizer_->resize(resizer_->sizeHint());
    }

    refresh_status_bar_timer_ = new QTimer(this);
    connect(refresh_status_bar_timer_, SIGNAL(timeout()), this,
            SLOT(refreshStatusBar()));

    AccountManager* account_mgr = seafApplet->accountManager();
    connect(account_mgr, SIGNAL(accountsChanged()), this,
            SLOT(onAccountChanged()));
    connect(account_mgr, SIGNAL(accountInfoUpdated(const Account&)), this,
            SLOT(onAccountInfoUpdated(const Account&)));

    if (!shouldUseFramelessWindow()) {
        mHeader->setVisible(false);
    }

    connect(ServerStatusService::instance(), SIGNAL(serverStatusChanged()),
            this, SLOT(refreshServerStatus()));
    connect(CustomizationService::instance(),
            SIGNAL(serverLogoFetched(const QUrl&)), this,
            SLOT(onServerLogoFetched(const QUrl&)));

    QTimer::singleShot(0, this, SLOT(onAccountChanged()));
}
Esempio n. 12
0
/**
 * Sends the HTTP Response along with the web
 * content to the socket file descriptor.
 *
 * @param fileToSend: location of file to display to client
 * @param sock: Socket file descriptor
 * @param home: 
 * @param content:
 * @param response: Holds information regarding HTTP request
 */
void SendDataBin(char *fileToSend, int sock, char *home, 
		char *content, HTTP_Response *response) {
    
	char *fullPathToFile; //[256];
	char Header[1024];
	char buffer[256];
	char *endChar;
	int size;

	bzero(Header, sizeof(Header));

	/*
	 * Build the full path to the file
	 */

	bool hasSlash;
	if ((last_char(content) == "/") || (first_char(fileToSend) == '/'))
		hasSlash = TRUE;
	else
		hasSlash = FALSE;
	
	size = strlen(home) + strlen(content) + strlen(fileToSend);
	if (hasSlash)
	{
		size += 2;
		fullPathToFile = malloc(size);
		sprintf(fullPathToFile, "%s/%s%s", home, content, fileToSend);
	}	
	else
	{
		size += 3;
		fullPathToFile = malloc(size);
		sprintf(fullPathToFile, "%s/%s/%s", home, content, fileToSend);
	}
	//int file_open = open(fullPathToFile, O_RDONLY);
	int fileType = TypeOfFile(fullPathToFile);

	printf("Filetype: %d\n", fileType);

	if ((fileType == FILE_NOT_FOUND) || (fileType == ERROR_FILE))
	{
		//Requested page not available.
		bzero(fullPathToFile, strlen(fullPathToFile));
		size = strlen(home) + strlen(content);

		if (last_char(content) == "/")
		{
			size += 16;
			fullPathToFile = realloc(fullPathToFile, size);
			sprintf(fullPathToFile, "%s/%snot_found.html", home, content);
		}
		else
		{
			size += 17;
			fullPathToFile = realloc(fullPathToFile, size);
			sprintf(fullPathToFile, "%s/%s/not_found.html", home, content);
		}
	}
	else if (fileType == DIRECTORY)
	{
		//Append index.html
		size += 10;
		fullPathToFile = realloc(fullPathToFile, size);
		strcat(fullPathToFile, "index.html");
	}
	
	printf("File to open: %s\n", fullPathToFile);
	int file_open;
	FILE *file_fd = NULL;

	if (fileType == EXECUTABLE_FILE)
	{
		if ((file_fd = popen(fullPathToFile, "r")) == NULL) 
		{
			perror("popen");
			exit(-1);
		}

		file_open = fileno(file_fd);  //Convert from FILE to file descriptor integer
	}
	else
	{
		file_open = open(fullPathToFile, O_RDONLY);
	}

	if (file_open < 0)
	{
		perror("Open file error");
		exit(-1);
	}

	long unsigned filesize  = lseek(file_open, (off_t)0, SEEK_END);
	lseek(file_open, (off_t)0, SEEK_SET); //Set back to starting position
	
	setupHeader(Header, response, filesize);

	printf("\nHeader:\n%s\n\n", Header);	

	/*
	 * Send the header, open the requested file.
	 * Send requested file, close file.
	 */

	printf("file: %s\n", fullPathToFile);
	write(sock, Header, strlen(Header));

	// If request was for HEAD, do not send the body information
	if (strncmp(response -> HTTP_Type, "HEAD", 4) == 0)
	{
		free (fullPathToFile);
		fullPathToFile = NULL;
		return;
	}


	bzero(buffer, sizeof(buffer));
	while (read(file_open, buffer, sizeof(buffer)) > 0)
	{
		write(sock, buffer, sizeof(buffer));
		bzero(buffer, sizeof(buffer));
	}
	
	if (fileType == EXECUTABLE_FILE)
		pclose(file_fd);
	else
		close(file_open);

	// Deallocate allocated pointers
	free (fullPathToFile);
	fullPathToFile = NULL;
}
Esempio n. 13
0
  AdvancedScriptManager::AdvancedScriptManager(QWidget* parent) : QWidget(parent) {
    
    QHBoxLayout* hLayout = new QHBoxLayout(this);
    setLayout(hLayout);
    
    QVBoxLayout* vLayout2 = new QVBoxLayout(this);
    hLayout->addLayout(vLayout2);
    
    lstCategories = new QListWidget;
    lstCategories->setMaximumSize(200,9999);
    lstCategories->setMinimumSize(0,0);
    vLayout2->addWidget(lstCategories);
    
    addScript = new KPushButton;
    addScript->setText("Add Script");
    vLayout2->addWidget(addScript);
    
    manageCategories = new KPushButton;
    manageCategories->setText("Manage Categories");
    vLayout2->addWidget(manageCategories);
    
    
    QVBoxLayout* vLayout = new QVBoxLayout(this);
    hLayout->addLayout(vLayout);
    
    tblScript = new QTableWidget;
    if (tblScript->columnCount() < 7)
      tblScript->setColumnCount(7);
    tblScript->verticalHeader()->hide();
    tblScript->setSelectionBehavior(QAbstractItemView::SelectRows);
    vLayout->addWidget(tblScript);
    
    tabDetails = new QTabWidget;
    tabDetails->setMaximumSize(9999,175);
    vLayout->addWidget(tabDetails);
    
    tabDescriptionContent = new QWidget;
    tabDetails->addTab(tabDescriptionContent, "Description");
    
    QVBoxLayout* vLayout3 = new QVBoxLayout(tabDescriptionContent);
    tabDescriptionContent->setLayout(vLayout3);
    
    lblDescription = new QLabel();
    lblDescription->setAlignment(Qt::AlignTop);
    lblDescription->setWordWrap(true);
    
    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
    scrollArea->setFrameShape(QFrame::StyledPanel);
    scrollArea->setWidgetResizable(true);
    scrollArea->setWidget(lblDescription);
    vLayout3->addWidget(scrollArea);
    
    
    tabInfoContent = new QWidget;
    tabDetails->addTab(tabInfoContent, "Information");
    
    QGridLayout* aGridLayout = new QGridLayout();
    tabInfoContent->setLayout(aGridLayout);
    
    lblName = new QLabel("<b>Script name: </b>");
    lblName->setWordWrap(true);
    aGridLayout->addWidget(lblName,0,0);
    lblNameValue = new QLabel();
    lblNameValue->setWordWrap(true);
    aGridLayout->addWidget(lblNameValue,0,1);
    
    lblExecNb = new QLabel("<b>Executed: </b>");
    lblExecNb->setWordWrap(true);
    aGridLayout->addWidget(lblExecNb,1,0);
    lblExecNbValue = new QLabel("0 time");
    lblExecNbValue->setWordWrap(true);
    aGridLayout->addWidget(lblExecNbValue,1,1);

    lblCreation = new QLabel("<b>Created: </b>");
    lblCreation->setWordWrap(true);
    aGridLayout->addWidget(lblCreation,0,2);
    lblCreationValue = new QLabel();
    lblCreationValue->setWordWrap(true);
    aGridLayout->addWidget(lblCreationValue,0,3);
    
    lblNbEdition = new QLabel("<b>Edited: </b>");
    lblNbEdition->setWordWrap(true);
    aGridLayout->addWidget(lblNbEdition,1,2);
    lblNbEditionValue = new QLabel("0 time");
    lblNbEditionValue->setWordWrap(true);
    aGridLayout->addWidget(lblNbEditionValue,1,3);
    
    lblLastEditDate = new QLabel("<b>Last edition: </b>");
    lblLastEditDate->setWordWrap(true);
    aGridLayout->addWidget(lblLastEditDate,2,0);
    lblLastEditDateValue = new QLabel();
    lblLastEditDateValue->setWordWrap(true);
    aGridLayout->addWidget(lblLastEditDateValue,2,1);
    
    lblMoyExecTime = new QLabel("<b>Moy. exec time:");
    lblMoyExecTime->setWordWrap(true);
    aGridLayout->addWidget(lblMoyExecTime,2,2);
    lblMoyExecTimeValue = new QLabel();
    lblMoyExecTimeValue->setWordWrap(true);
    aGridLayout->addWidget(lblMoyExecTimeValue,2,3);
    
    aGridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed), 0,4);
    
    aGridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding), 3,0);
    
    tblVersion = new QTableWidget;
    tblVersion->setSelectionBehavior(QAbstractItemView::SelectRows);
    tblVersion->setColumnCount(2);
    tblVersion->verticalHeader()->hide();
    tabDetails->addTab(tblVersion, "Versions");
    
    tblExecute = new QTableWidget; 
    tblExecute->setColumnCount(4);
    tblExecute->verticalHeader()->hide();
    tblExecute->setSelectionBehavior(QAbstractItemView::SelectRows);
    setupHeaderLog();
    tabDetails->addTab(tblExecute, "Log");
    
    connect( lstCategories, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadScriptList(QListWidgetItem*, QListWidgetItem*)));
    connect( tblScript, SIGNAL( cellClicked ( int, int)), this, SLOT(scriptSelected(int, int)));
    
    loadCategories();
    setupHeader();
    setupHeaderVersion();
    lstCategories->setCurrentRow(0);
    //loadScriptList("Backup");
  }
Esempio n. 14
0
AirSpaceWindow::AirSpaceWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags, IDataBase::SourceType src)
  :TableWindow(parent, name, wflags)
{
  QStringList nameList;
  QAction* pAction;
  QTableWidget *pTable;

  pTable = TableWindow::getTable();
  m_pWebMapView = NULL;
  m_pAirSpaceView = NULL;
  m_externSelect = false;

  switch(src)
  {
    case IDataBase::SqlDB:
      m_pDb = ISql::pInstance();

      connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update()));

      pAction = new QAction(tr("&Edit"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit()));
      MDIWindow::addAction(pAction, true);

      pAction = new QAction(tr("&Delete"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
      MDIWindow::addAction(pAction);

      pAction = new QAction(tr("&Add to GPS..."), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToGPS()));
      MDIWindow::addAction(pAction, true);
    break;
    case IDataBase::GPSdevice:
    {
      m_pDb = IGPSDevice::pInstance();

      connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update()));

      pAction = new QAction(tr("&Delete"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete()));
      MDIWindow::addAction(pAction);

      pAction = new QAction(tr("&Update"), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_update()));
      MDIWindow::addAction(pAction);
    }
    break;
    case IDataBase::File:
    {
      m_pDb = NULL;

      pAction = new QAction(tr("&Add to GPS..."), this);
      connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToGPS()));
      MDIWindow::addAction(pAction, true);
    }
    break;
  }

  if(src != IDataBase::SqlDB)
  {
    pAction = new QAction(tr("Add to DB..."), this);
    connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToSqlDB()));
    MDIWindow::addAction(pAction, true);

    pAction = new QAction(tr("&Update"), this);
    connect(pAction, SIGNAL(triggered()), this, SLOT(file_update()));
    MDIWindow::addAction(pAction);
  }

  // import/export
  pAction = new QAction(this);
  pAction->setSeparator(true);
  MDIWindow::addAction(pAction);

  if(src == IDataBase::File)
  {
    pAction = new QAction(tr("&Import..."), this);
    connect(pAction, SIGNAL(triggered()), this, SLOT(file_open()));
    MDIWindow::addAction(pAction);
  }

  pAction = new QAction(tr("&Export all..."), this);
  connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable()));
  MDIWindow::addAction(pAction);

  // view
  pAction = new QAction(this);
  pAction->setSeparator(true);
  MDIWindow::addAction(pAction);

  pAction = new QAction(tr("&View..."), this);
  connect(pAction, SIGNAL(triggered()), this, SLOT(file_viewAirSpace()));
  MDIWindow::addAction(pAction);

  pAction = new QAction(tr("View &Web Map..."), this);
  connect(pAction, SIGNAL(triggered()), this, SLOT(file_viewWebMap()));
  MDIWindow::addAction(pAction, true);

  TableWindow::setWindowIcon(QIcon(":/document.xpm"));

  // configure the table
  pTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
  pTable->setSelectionMode(QAbstractItemView::ExtendedSelection);

  // header
  nameList += tr("Name");
  nameList += tr("Low [m]");
  nameList += tr("High [m]");
  nameList += tr("Class");
  nameList += tr("Comment");
  setupHeader(nameList);

  pTable->setColumnWidth(Name, 200);
  pTable->setColumnWidth(High, 100);
  pTable->setColumnWidth(Low, 100);
  pTable->setColumnWidth(Class, 80);
  pTable->setColumnWidth(Comment, 750);

  connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update()));

  if(src == IDataBase::File)
  {
    file_open();
  }
  else
  {
    file_update();
  }
}