コード例 #1
0
ファイル: main_window.cpp プロジェクト: gz818/itest
void MainWindow::clearAll()
{
    clearCurrentValues();
    clearLQ();
    clearSQ();
    ECTextEdit->clear();
    loadCategories();
    updateCategoryQnums();
    clearSM();
    clearSV();
    clearCL();
}
コード例 #2
0
ファイル: InventoryComponent.cpp プロジェクト: Reyfin/UE4
void UInventoryComponent::loadUI()
{
	if (!requiresUI) return;
	if (!mainInventory)
	{
		if (mainInventoryTemplate)
		{
			mainInventory = CreateWidget<UMainInventoryWidget>(GetWorld(), mainInventoryTemplate);
			if (!mainInventory)
			{
				return;
				requiresUI = false;
			}		
			
			mainInventory->AddToViewport();
		}
		else
		{
			requiresUI = false;
			return;
		}
	}
	
	//UStalkerMainGameInstance* gameInstance = Cast<UStalkerMainGameInstance>(GetOwner()->GetWorld()->GetGameInstance());
	//if(gameInstance) gameInstance->addWidgetToMain(mainInventory);
	loadCategories();	
	mainInventory->SetVisibility(ESlateVisibility::Hidden);
	mainInventory->otherItemBoxWidget->inventoryParent = this;
	mainInventory->sellItemBoxWidget->inventoryParent = this;
	mainInventory->ItemBoxWidget->inventoryParent = this;
	mainInventory->buyItemBoxWidget->inventoryParent = this;
	equipment->equipmentWidget = mainInventory->equipmentWidgetTransfer;
	equipment->setupUI();
	refresh();
	for (uint8 i = 0; i < (uint8)SlotInformation::NUM; i++)
	{
		equipment->equipmentWidget->widgets[i]->inventoryParent = this;
	}
	
	mainInventory->tradeButton->OnClicked.RemoveDynamic(this, &UInventoryComponent::tradeItems);
	mainInventory->resetButton->OnClicked.RemoveDynamic(this, &UInventoryComponent::resetItems);
	mainInventory->closeButton->OnClicked.RemoveDynamic(this, &UInventoryComponent::closeTradeWindow);

	mainInventory->tradeButton->OnClicked.AddDynamic(this, &UInventoryComponent::tradeItems);
	mainInventory->resetButton->OnClicked.AddDynamic(this, &UInventoryComponent::resetItems);
	mainInventory->closeButton->OnClicked.AddDynamic(this, &UInventoryComponent::closeTradeWindow);

	mainInventory->equipmentWidgetTransfer->weaponWidget->attachment1->inventoryParent = this;
	mainInventory->equipmentWidgetTransfer->weaponWidget->attachment2->inventoryParent = this;
	mainInventory->equipmentWidgetTransfer->weaponWidget->attachment3->inventoryParent = this;
	mainInventory->equipmentWidgetTransfer->weaponWidget->weapon->inventoryParent = this;
}
コード例 #3
0
void RecipeDB::loadCachedCategories( CategoryTree **list, int limit, int offset, int parent_id, bool recurse )
{
	if ( m_categoryCache ) {
		if ( parent_id == -1 )
			*list = m_categoryCache;
		else //FIXME?: how slow is this find() call?  the cache is loaded in sequential order, so should we iterate over the cache?
			*list = m_categoryCache->find(parent_id);
		//kDebug() << "Loading category tree from the cache" ;
	}
	else {
		loadCategories( *list, limit, offset, parent_id, recurse );
	}
}
コード例 #4
0
void XmlDataPersistance::execLoad()
{
    try
    {
        loadCategories(categoriesFilePath_);
        loadUvs(uvsFilePath_);
        loadDegrees(degreesFilePath_);
        loadStudents(studentsFilePath_);
    }
    catch(UTProfilerException e)
    {
        qDebug() << e.getInfo();
    }
}
コード例 #5
0
ファイル: formfeeddetails.cpp プロジェクト: keinkurt/rssguard
int FormFeedDetails::exec(Feed *input_feed, RootItem *parent_to_select, const QString &url) {
  // Load categories.
  loadCategories(m_serviceRoot->getSubTreeCategories(), m_serviceRoot);

  if (input_feed == nullptr) {
    // User is adding new category.
    setWindowTitle(tr("Add new feed"));

    // Make sure that "default" icon is used as the default option for new
    // feed.
    m_actionUseDefaultIcon->trigger();

    int default_encoding_index = m_ui->m_cmbEncoding->findText(DEFAULT_FEED_ENCODING);

    if (default_encoding_index >= 0) {
      m_ui->m_cmbEncoding->setCurrentIndex(default_encoding_index);
    }

    if (parent_to_select != nullptr) {
      if (parent_to_select->kind() == RootItemKind::Category) {
        m_ui->m_cmbParentCategory->setCurrentIndex(m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select)));
      }
      else if (parent_to_select->kind() == RootItemKind::Feed) {
        int target_item = m_ui->m_cmbParentCategory->findData(QVariant::fromValue((void*) parent_to_select->parent()));

        if (target_item >= 0) {
          m_ui->m_cmbParentCategory->setCurrentIndex(target_item);
        }
      }
    }

    if (!url.isEmpty()) {
      m_ui->m_txtUrl->lineEdit()->setText(url);
    }
    else if (Application::clipboard()->mimeData()->hasText()) {
      m_ui->m_txtUrl->lineEdit()->setText(Application::clipboard()->text());
    }
  }
  else {
    // User is editing existing category.
    setWindowTitle(tr("Edit feed '%1'").arg(input_feed->title()));
    setEditableFeed(input_feed);
  }

  // Run the dialog.
  return QDialog::exec();
}
コード例 #6
0
void MXPImporter::importMXP( QTextStream &stream )
{
	Recipe recipe;

	kapp->processEvents(); //don't want the user to think its frozen... especially for files with thousands of recipes

	//kDebug()<<"Found recipe MXP format: * Exported from MasterCook *";
	QString current;

	// title
	stream.skipWhiteSpace();
	recipe.title = stream.readLine().trimmed();
	//kDebug()<<"Found title: "<<m_title;

	//author
	stream.skipWhiteSpace();
	current = stream.readLine().trimmed();
	if ( current.mid( 0, current.indexOf( ":" ) ).simplified().toLower() == "recipe by" ) {
		Element new_author( current.mid( current.indexOf( ":" ) + 1, current.length() ).trimmed() );
		recipe.authorList.append( new_author );
		//kDebug()<<"Found author: "<<new_author.name;
	}
	else {
		addWarningMsg( i18n( "While loading recipe \"%1\" "
		                              "the field \"Recipe By:\" is either missing or could not be detected.", recipe.title ) );
	}

	//servings
	stream.skipWhiteSpace();
	current = stream.readLine().trimmed();
	if ( current.mid( 0, current.indexOf( ":" ) ).simplified().toLower() == "serving size" ) {
		//allows serving size to be loaded even if preparation time is missing
		int end_index;
		if ( current.contains( "preparation time", Qt::CaseInsensitive ) )
			end_index = current.indexOf( "preparation time", 0, Qt::CaseInsensitive ) - 15;
		else
			end_index = current.length();

		recipe.yield.setAmount(current.mid( current.indexOf( ":" ) + 1, end_index ).trimmed().toInt());
		recipe.yield.setType(i18n("servings"));
		//kDebug()<<"Found serving size: "<<recipe.yield.amount;
	}
	else {
		addWarningMsg( i18n( "While loading recipe \"%1\" "
		                              "the field \"Serving Size:\" is either missing or could not be detected." , recipe.title ) );
	}

	if ( current.contains( "preparation time", Qt::CaseInsensitive ) ) {
		QString prep_time = current.mid( current.indexOf( ":", current.indexOf( "preparation time", 0, Qt::CaseInsensitive ) ) + 1,
		                                 current.length() ).trimmed();
		recipe.prepTime = QTime( prep_time.section( ':', 0, 0 ).toInt(), prep_time.section( ':', 1, 1 ).toInt() );
		kDebug() << "Found preparation time: " << prep_time ;
	}
	else {
		addWarningMsg( i18n( "While loading recipe \"%1\" "
			"the field \"Preparation Time:\" is either missing or could not be detected." , recipe.title ) );
	}

	loadCategories( stream, recipe );
	loadIngredients( stream, recipe );
	loadInstructions( stream, recipe );
	loadOptionalFields( stream, recipe );

	add
		( recipe );

	if ( !stream.atEnd() ) {
		importMXP( stream );
		return ;
	}
}
コード例 #7
0
void RecipeDB::updateCategoryCache( int limit )
{
	m_categoryCache = new CategoryTree;
	loadCategories( m_categoryCache, limit, 0, -1, true );
}
コード例 #8
0
ファイル: categories.cpp プロジェクト: gz818/itest
void MainWindow::discardCategories()
{
    loadCategories(); statusBar()->showMessage(tr("Categories discarded"), 10000);
}
コード例 #9
0
ファイル: ytcategories.cpp プロジェクト: Gira-X/minitube
void YTCategories::requestError(QNetworkReply *reply) {
    if (lastLanguage != "en") loadCategories("en");
    else emit error(reply->errorString());
}
コード例 #10
0
ファイル: database.cpp プロジェクト: flysky217/itest
void MainWindow::openDB(const QString &openDBName, bool useCP1250)
{
    if (openDBName.isNull())
        return;
    this->setEnabled(false); qApp->processEvents();
    try {
        QFile file(openDBName);
        if (!file.open(QFile::ReadOnly | QFile::Text)) {
            QMessageBox::critical(this, tr("Open database"), tr("Cannot read file %1:\n%2.").arg(openDBName).arg(file.errorString()));
            this->setEnabled(true); return;
        }
        setProgress(3); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        QTextStream rfile(&file);
        if (useCP1250) {
            rfile.setCodec("CP 1250");
        } else {
            rfile.setCodec("UTF-8");
        }

        QString db_buffer;
        QStringList bufferlist;
        // ---------------------------------------------------------------------
        if (rfile.readLine() != "[ITEST_VERSION]") { throw xInvalidDBFile(0); }
        rfile.readLine();
        if (rfile.readLine() != "[ITEST_DB_VERSION]") { throw xInvalidDBFile(1); }
        double db_version = rfile.readLine().toDouble();
        if (db_version > F_ITDB_VERSION) {
            QMessageBox::critical(this, tr("iTest version notice"), tr("You need a newer version of iTest to open this database file."));
            this->setEnabled(true);
            return;
        }
        if (!useCP1250) {
            if (db_version == 1.0) {
                openDB(openDBName, true);
                return;
            }
        }

        if (rfile.readLine() != "[DB_NAME]") { throw xInvalidDBFile(10); }
        // Database name
        QString db_name = rfile.readLine();
        if (rfile.readLine() != "[DB_DATE]") { throw xInvalidDBFile(12); }
        // Database date
        QString db_date = rfile.readLine();
        if (rfile.readLine() != "[DB_DATE_ULSD]") { throw xInvalidDBFile(14); }
        // Use last save date
        rfile.readLine();
        if (rfile.readLine() != "[DB_COMMENTS]") { throw xInvalidDBFile(16); }
        // Database comments
        QString db_comments = rfile.readLine();
        if (rfile.readLine() != "[DB_QNUM]") { throw xInvalidDBFile(18); }
        // Question number
        int db_qnum = rfile.readLine().toInt();
        if (rfile.readLine() != "[DB_SNUM]") { throw xInvalidDBFile(20); }
        // Number of saved sessions
        int db_snum = rfile.readLine().toInt();
        int db_cnum = 0;
        if (db_version >= 1.35) {
            if (rfile.readLine() != "[DB_CNUM]") { throw xInvalidDBFile(22); }
            // Number of classes
            db_cnum = rfile.readLine().toInt();
        }
        if (rfile.readLine() != "[DB_FLAGS]") { throw xInvalidDBFile(50); }
        setProgress(6); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        // Categories enabled
        db_buffer = rfile.readLine();
        QVector<bool> db_categories_enabled(db_buffer.length());
        for (int i = 0; i < db_categories_enabled.size(); ++i) {
            if (db_buffer.at(i) == '+') {
                db_categories_enabled[i] = true;
            } else if (db_buffer.at(i) == '-') {
                db_categories_enabled[i] = false;
            } else {
                throw xInvalidDBFile(52);
            }
        }
        // Categories
        QVector<QString> db_categories(db_buffer.length());
        for (int i = 0; i < db_categories.size(); ++i) {
            if (rfile.readLine() != QString("[DB_F%1]").arg(i)) { throw xInvalidDBFile(54); }
            db_categories[i] = rfile.readLine();
        }
        // End of categories
        if (rfile.readLine() != "[DB_FLAGS_END]") { throw xInvalidDBFile(59); }
        setProgress(10); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        int count = db_qnum + db_snum;
        // Questions
        QuestionItem *item;
        QStringList answers;
        for (int i = 0; i < db_qnum; ++i) {
            answers.clear();
            // Question name
            if (rfile.readLine() != "[Q_NAME]") { throw xInvalidDBFile(100); }
            item = new QuestionItem (rfile.readLine());
            // Category
            if (rfile.readLine() != "[Q_FLAG]") { throw xInvalidDBFile(102); }
            item->setCategory(rfile.readLine().toInt());
            if (db_version >= 1.2) {
                // Question group
                if (rfile.readLine() != "[Q_GRP]") { throw xInvalidDBFile(104); }
                item->setGroup(rfile.readLine());
            }
            // Difficulty
            if (db_version >= 1.2) {
                if (rfile.readLine() != "[Q_DIF]") { throw xInvalidDBFile(106); }
            } else {
                if (rfile.readLine() != "[Q_DIFFICULTY]") { throw xInvalidDBFile(108); }
            }
            item->setDifficulty(rfile.readLine().toInt());
            // Question text
            if (rfile.readLine() != "[Q_TEXT]") { throw xInvalidDBFile(110); }
            item->setText(rfile.readLine());
            if (db_version >= 1.35) {
                // Answers
                if (rfile.readLine() != "[Q_ANS]") { throw xInvalidDBFile(112); }
                item->setSelectionType((Question::SelectionType)rfile.readLine().toInt());
                item->setCorrectAnswers((Question::Answer)rfile.readLine().toInt());
                int numanswers = rfile.readLine().toInt();
                for (int a = 0; a < numanswers; ++a) { answers << rfile.readLine(); }
                // Explanation
                if (rfile.readLine() != "[Q_EXPL]") { throw xInvalidDBFile(114); }
                item->setExplanation(rfile.readLine());
            } else {
                // Answer A
                if (rfile.readLine() != "[Q_ANSA]") { throw xInvalidDBFile(116); }
                answers << rfile.readLine();
                if (db_version < 1.2) {
                    if (rfile.readLine() != "[Q_ANSA_C]") { throw xInvalidDBFile(118); }
                }
                item->setAnswerCorrect(Question::A, rfile.readLine() == "true");
                // Answer B
                if (rfile.readLine() != "[Q_ANSB]") { throw xInvalidDBFile(120); }
                answers << rfile.readLine();
                if (db_version < 1.2) {
                    if (rfile.readLine() != "[Q_ANSB_C]") { throw xInvalidDBFile(122); }
                }
                item->setAnswerCorrect(Question::B, rfile.readLine() == "true");
                // Answer C
                if (rfile.readLine() != "[Q_ANSC]") { throw xInvalidDBFile(124); }
                answers << rfile.readLine();
                if (db_version < 1.2) {
                    if (rfile.readLine() != "[Q_ANSC_C]") { throw xInvalidDBFile(126); }
                }
                item->setAnswerCorrect(Question::C, rfile.readLine() == "true");
                // Answer D
                if (rfile.readLine() != "[Q_ANSD]") { throw xInvalidDBFile(128); }
                answers << rfile.readLine();
                if (db_version < 1.2) {
                    if (rfile.readLine() != "[Q_ANSD_C]") { throw xInvalidDBFile(130); }
                }
                item->setAnswerCorrect(Question::D, rfile.readLine() == "true");
            }
            // Statistics
            if (db_version < 1.2) {
                if (rfile.readLine() != "[Q_ICNT]") { throw xInvalidDBFile(132); }
            } else {
                if (rfile.readLine() != "[Q_ICCNT]") { throw xInvalidDBFile(134); }
            }
            item->setIncorrectAnsCount(rfile.readLine().toUInt());
            if (db_version < 1.2) {
                if (rfile.readLine() != "[Q_CCNT]") { throw xInvalidDBFile(136); }
            }
            item->setCorrectAnsCount(rfile.readLine().toUInt());
            // Hidden
            if (db_version >= 1.2) {
                if (rfile.readLine() != "[Q_HID]") { throw xInvalidDBFile(138); }
                item->setHidden(rfile.readLine() == "true");
            }
            if (db_version > 1.25) {
                // SVG
                if (rfile.readLine() != "[Q_SVG]") { throw xInvalidDBFile(140); }
                int numsvgitems = rfile.readLine().toInt();
                for (int g = 0; g < numsvgitems; ++g) {
                    db_buffer = rfile.readLine();
                    item->addSvgItem(new SvgItem(db_buffer, rfile.readLine()));
                }
            }
            // End
            if (db_version < 1.25) {
                if (rfile.readLine() != "[Q_END]") { throw xInvalidDBFile(199); }
            }
            // Add map entry
            item->setAnswers(answers);
            QListWidgetItem *q_item = new QListWidgetItem (item->group().isEmpty() ? item->name() : QString("[%1] %2").arg(item->group()).arg(item->name()));
            LQListWidget->addItem(q_item);
            current_db_questions.insert(q_item, item);
            setQuestionItemIcon(q_item, item->difficulty());
            setQuestionItemColour(q_item, item->category());
            hideQuestion(q_item, item);
            setProgress((85/(i+1)*count)+10); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>
        }
        // Saved sessions
        int ans_category = -1;
        int ans_dif = 0;
        Question::Answer c_ans;
        Question::Answer ans;
        Question::SelectionType ans_selectiontype = Question::SingleSelection;
        for (int i = 0; i < db_snum; ++i) {
            if (rfile.atEnd())
                break;
            if (rfile.readLine() != "[SESSION]")
                continue;
            Session *session = new Session;
            session->setName(rfile.readLine());
            session->setDateTimeFromString(rfile.readLine());
            if (db_version >= 1.2) {
                if (rfile.readLine() != "[PASSMARK]") { throw xInvalidDBFile(202); }
                PassMark pm(rfile.readLine().toInt());
                int pm_count = rfile.readLine().toInt();
                int pm_c, pm_v;
                for (int i = 0; i < pm_count; ++i) {
                    pm_c = rfile.readLine().toInt();
                    pm_v = rfile.readLine().toInt();
                    pm.addCondition(pm_c, pm_v, pm_v);
                }
                session->setPassMark(pm);
            } else {
                session->setPassMark(PassMark(rfile.readLine().toInt()));
            }
            ScoringSystem sys;
            if (db_version >= 1.35) {
                db_buffer = rfile.readLine(); db_buffer.append("\n");
                db_buffer.append(rfile.readLine()); db_buffer.append("\n");
                db_buffer.append(rfile.readLine());
                sys.loadData(db_buffer);
            }
            int s_snum = rfile.readLine().toInt();
            int s_lenum = rfile.readLine().toInt();
            for (int le = 0; le < s_lenum; ++le) {
                bufferlist.clear();
                bufferlist = rfile.readLine().split(';');
                if (bufferlist.count() == 6) {
                    session->addLogEntry(bufferlist.at(0).toInt(),
                                         bufferlist.at(1).toInt(),
                                         bufferlist.at(2).toInt(),
                                         bufferlist.at(3).toInt(),
                                         bufferlist.at(4).toInt(),
                                         bufferlist.at(5).toInt(),
                                         rfile.readLine());
                } else {
                    session->addLogEntry(255, 255, 255, 0, 0, 0, rfile.readLine());
                }
            }
            for (int s = 0; s < s_snum; ++s) {
                if (rfile.atEnd())
                    break;
                if (rfile.readLine() != "[STUDENT]")
                    continue;
                Student *student = new Student(rfile.readLine());
                student->setReady(rfile.readLine() == "true");
                if (db_version >= 1.2) {
                    student->setPassed(rfile.readLine() == "true");
                }
                student->setNumber(rfile.readLine().toInt());
                if (db_version < 1.35) {
                    rfile.readLine(); // SCORE
                }
                int numresults = rfile.readLine().toInt();
                QMap<QString, QuestionAnswer> *results = new QMap<QString, QuestionAnswer>;
                for (int a = 0; a < numresults; ++a) {
                    db_buffer = rfile.readLine();
                    if (db_version >= 1.2) {
                        ans_category = rfile.readLine().toInt();
                    }

                    QuestionItem *item = NULL;
                    QMapIterator<QListWidgetItem *, QuestionItem *> q(current_db_questions);
                    while (q.hasNext()) { q.next();
                        if (q.value()->name() == db_buffer) {
                            item = q.value();
                            break;
                        }
                    }

                    if (db_version >= 1.35) {
                        ans_dif = rfile.readLine().toInt();
                        ans_selectiontype = (Question::SelectionType)rfile.readLine().toInt();
                    } else {
                        if (item == NULL) {
                            if (db_version < 1.2) {
                                ans_category = -1;
                            }
                            if (db_version < 1.35) {
                                ans_dif = 0;
                                ans_selectiontype = Question::SingleSelection;
                            }
                        } else {
                            if (db_version < 1.2) {
                                ans_category = item->category();
                            }
                            if (db_version < 1.35) {
                                ans_dif = item->difficulty();
                                ans_selectiontype = item->selectionType();
                            }
                        }
                    }

                    if (db_version < 1.27) {
                        ans = Question::convertOldAnsNumber(rfile.readLine().toInt());
                        c_ans = Question::convertOldAnsNumber(rfile.readLine().toInt());
                    } else {
                        ans = (Question::Answer)rfile.readLine().toInt();
                        c_ans = (Question::Answer)rfile.readLine().toInt();
                    }

                    QuestionAnswer qans(c_ans, ans, item ? item->numAnswers() : 9, ans_category, ans_dif, ans_selectiontype);
                    results->insert(db_buffer, qans);
                }
                student->setResults(results);
                student->updateScore(sys);
                if (db_version < 1.2) {
                    student->setPassed(session->passMark().check(student->results(), &current_db_questions, sys));
                }
                session->addStudent(student);
            }
            session->setScoringSystem(sys);
            current_db_sessions.insert(session->dateTime(), session);
            QListWidgetItem *item = new QListWidgetItem (QString("%1 - %2").arg(session->dateTimeToString()).arg(session->name()));
            SVLSListWidget->insertItem(0, item);
            item->setData(Qt::UserRole, session->dateTime());
            setProgress((85/(db_qnum+i+1)*count)+10); // PROGRESS >>>>>>>>>>>>>>
        }
        // Classes
        for (int i = 0; i < db_cnum; ++i) {
            if (rfile.atEnd())
                break;
            if (rfile.readLine() != "[CLASS]")
                continue;
            Class *cl = new Class(rfile.readLine());
            bufferlist = rfile.readLine().split("-", QString::SkipEmptyParts);
            cl->setFirstYear(bufferlist.at(0).toInt());
            cl->setLastYear(bufferlist.at(1).toInt());
            QStringList cl_sessions = rfile.readLine().split(";", QString::SkipEmptyParts);
            for (int s = 0; s < cl_sessions.count(); ++s) {
                cl->addSession(cl_sessions.at(s));
            }
            int mnum = rfile.readLine().toInt();
            for (int m = 0; m < mnum; ++m) {
                if (rfile.readLine() != "[MEM]")
                    continue;
                ClassMember *mem = new ClassMember(rfile.readLine());
                int msnum = rfile.readLine().toInt();
                for (int ms = 0; ms < msnum; ++ms) {
                    db_buffer = rfile.readLine();
                    mem->addSession(db_buffer, rfile.readLine().toInt());
                }
                cl->addMember(mem);
            }
            QListWidgetItem *cl_item = new QListWidgetItem(QString("%1-%2: %3").arg(cl->firstYear()).arg(cl->lastYear()).arg(cl->name()), CLLCListWidget);
            current_db_classes.insert(cl_item, cl);
        }

        ECTextEdit->setHtml( db_comments );
        // Set categories
        current_db_categories_enabled = db_categories_enabled;
        current_db_categories = db_categories;
        setProgress(97); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        // Apply categories
        setCategories(); loadCategories();
        setProgress(98); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        // Enable All
        setAllEnabled(true);
        setProgress(99); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        // Save values
        current_db_file = openDBName;
        current_db_comments = db_comments;
        current_db_open = true;
#ifdef Q_OS_MAC
        this->setWindowTitle(QString("%1[*]").arg(currentDatabaseName()));
#else
        this->setWindowTitle(QString("%1[*] - iTestServer").arg(currentDatabaseName()));
#endif
        this->setWindowModified(false);
        statusBar()->showMessage(tr("Database open"), 10000);
        setProgress(100); setProgress(-1); // PROGRESS >>>>>>>>>>>>>>>>>>>>>>>>>
        actionEdit_questions->setChecked(true);
        mainStackedWidget->setCurrentIndex(1);
        // ---------------------------------------------------------------------
        this->setEnabled(true);
    }
    catch (xInvalidDBFile e) {
        errorInvalidDBFile(tr("Open database"), openDBName, e.error());
    }
    catch (...) {
        QMessageBox::critical(this, tr("iTestServer"), tr("Error opening database."));
        clearAll(); setAllEnabled(false); current_db_open = false;
        this->setWindowTitle(tr("iTestServer"));
        this->setWindowModified(false); setProgress(-1);
        mainStackedWidget->setCurrentIndex(0);
        this->setEnabled(true);
    }
}
コード例 #11
0
ファイル: advancedScriptManager.cpp プロジェクト: Elv13/KliNG
  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");
  }