Ejemplo n.º 1
0
void IndicatorWidget::stateChanged(CAbstractUpdateController::EUpdateControllerState new_state)
{
    ui->stateImage->setPixmap(QPixmap(mStateImages[new_state]));
    switch(new_state)
    {
        case CAbstractUpdateController::eCHECKING:            
            onCheck();
            break;

        case CAbstractUpdateController::eFULLY_UPDATED:
            onFullyUpdated();
            break;

        case CAbstractUpdateController::eUPDATES_AVAIL:
            onUpdateAvail();
            break;

        case CAbstractUpdateController::eUPDATING:
            onUpdateProgress();
            break;

         case CAbstractUpdateController::eUPDATING_ERROR:
            onUpdateError();

        default:
            //FIXME: Error maybe?
            onFullyUpdated();
            break;
    }
}
Ejemplo n.º 2
0
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
_save(this, lang(lng_settings_save), st::defaultBoxButton),
_cancel(this, lang(lng_cancel), st::cancelBoxButton),
_username(this, st::defaultInputField, qsl("@username"), App::self()->username, false),
_link(this, QString(), st::defaultBoxLinkButton),
_saveRequestId(0), _checkRequestId(0),
_about(st::boxWidth - st::usernamePadding.left()) {
	setBlueTitle(true);

	_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);

	textstyleSet(&st::usernameTextStyle);
	_about.setRichText(st::boxTextFont, lang(lng_username_about));
	resizeMaxHeight(st::boxWidth, st::boxTitleHeight + st::usernamePadding.top() + _username.height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom());
	textstyleRestore();

	connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_username, SIGNAL(changed()), this, SLOT(onChanged()));
	connect(&_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));

	connect(&_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));

	_checkTimer.setSingleShot(true);
	connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));

	prepare();
}
Ejemplo n.º 3
0
qt_widget_test::qt_widget_test(QWidget *parent, Qt::WFlags flags)
	: QWidget(parent, flags)
{
	ui.setupUi(this);


	WCHAR szReplaceProgIdValue[MAX_PATH] = {0};
	int x = sizeof(szReplaceProgIdValue);

	ITest* pTest = new CTest;
	delete pTest;

	QString pattern = ".*(ja.*io).*(jp.*rt).*(ga.*or)";
	QRegExp rx(pattern);
	int pos = rx.indexIn("jkjfkjafejgiosdfsdffdjfdjgkljperitjwkrtjktjweotijirepkjgafkdh9orjeit");
	QStringList list = rx.capturedTexts();
	int a = 1;



// 	OSVERSIONINFOW verInfo;
// 	verInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
// 	::GetVersionExW(&verInfo);
// 	
// 	if (verInfo.dwMajorVersion <= 5)
// 	{
// 		::MessageBoxA(NULL, "×ð¹óµÄXP", "system" ,MB_OK);
// 	}


	HKEY hSubKey = NULL;
	LONG lRes = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\RegisteredApplications", 0, NULL,
		REG_OPTION_NON_VOLATILE,
		KEY_ALL_ACCESS | KEY_WOW64_64KEY,
		NULL, &hSubKey, NULL);

	if (lRes == ERROR_SUCCESS)
	{
		::MessageBoxA(NULL, "have register access in qt_widget_text", "xx", MB_OK);
	}
	else
	{
		::MessageBoxA(NULL, "Not !!! have register access in qt_widget_text", "xx", MB_OK);
	}

	connect(ui.pushButton,
		SIGNAL(clicked()),
		this,
		SLOT(onCheck()));

// 	QWidget* modalChild = new QWidget(this, Qt::Dialog);
// 	modalChild->move(50, 50);
// 	modalChild->setFixedSize(100, 100);
// 	modalChild->setWindowModality(Qt::WindowModal);
// 	modalChild->show();
}
Ejemplo n.º 4
0
void UsernameBox::initBox() {
	resizeMaxHeight(st::usernameWidth, st::boxTitleHeight + st::addContactPadding.top() + _usernameInput.height() + st::addContactPadding.bottom() + _about.countHeight(st::usernameWidth - 2 * st::boxTitlePos.x()) + st::usernameSkip + _saveButton.height());

	connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_usernameInput, SIGNAL(changed()), this, SLOT(onChanged()));

	_checkTimer.setSingleShot(true);
	connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));

	prepare();
}
    void InteractionComponent::check() {
        if(isReady() && this->isEnabled()) {
            mRemainTime = mInterval;
            Ogre::Vector3 start, end;
            start = getNode()->getRotation(Node::SCENE) * Ogre::Vector3(0.0, 0.0, - mOffset)
                + getNode()->getPosition(Node::SCENE);
            end = getNode()->getRotation(Node::SCENE) * Ogre::Vector3(0.0, 0.0, - mRange)
                + getNode()->getPosition(Node::SCENE);


            emit sCheck(start, end);
            onCheck(start, end);
        }
    }
Ejemplo n.º 6
0
void UsernameBox::prepare() {
	_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);

	setTitle(langFactory(lng_username_title));

	addButton(langFactory(lng_settings_save), [this] { onSave(); });
	addButton(langFactory(lng_cancel), [this] { closeBox(); });

	connect(_username, SIGNAL(changed()), this, SLOT(onChanged()));
	connect(_username, SIGNAL(submitted(bool)), this, SLOT(onSave()));
	connect(_link, SIGNAL(clicked()), this, SLOT(onLinkClick()));

	_about.setRichText(st::usernameTextStyle, lang(lng_username_about));
	setDimensions(st::boxWidth, st::usernamePadding.top() + _username->height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom());

	_checkTimer->setSingleShot(true);
	connect(_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));

	updateLinkText();
}
Ejemplo n.º 7
0
UpdateStateRow::UpdateStateRow(QWidget *parent) : RpWidget(parent)
, _check(this, lang(lng_settings_check_now))
, _restart(this, lang(lng_settings_update_now)) {
	connect(_check, SIGNAL(clicked()), this, SLOT(onCheck()));
	connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart()));

	_versionText = lng_settings_current_version_label(lt_version, currentVersionText());

	Core::UpdateChecker checker;
	checker.checking() | rpl::start_with_next([=] {
		onChecking();
	}, lifetime());
	checker.isLatest() | rpl::start_with_next([=] {
		onLatest();
	}, lifetime());
	checker.progress(
	) | rpl::start_with_next([=](Core::UpdateChecker::Progress progress) {
		onDownloading(progress.already, progress.size);
	}, lifetime());
	checker.failed() | rpl::start_with_next([=] {
		onFailed();
	}, lifetime());
	checker.ready() | rpl::start_with_next([=] {
		onReady();
	}, lifetime());

	switch (checker.state()) {
	case Core::UpdateChecker::State::Download:
		setState(State::Download, true);
		setDownloadProgress(checker.already(), checker.size());
		break;
	case Core::UpdateChecker::State::Ready:
		setState(State::Ready, true);
		break;
	default:
		setState(State::None, true);
		break;
	}
}
Ejemplo n.º 8
0
UpdateStateRow::UpdateStateRow(QWidget *parent) : TWidget(parent)
, _check(this, lang(lng_settings_check_now))
, _restart(this, lang(lng_settings_update_now)) {
	connect(_check, SIGNAL(clicked()), this, SLOT(onCheck()));
	connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart()));

	Sandbox::connect(SIGNAL(updateChecking()), this, SLOT(onChecking()));
	Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onLatest()));
	Sandbox::connect(SIGNAL(updateProgress(qint64, qint64)), this, SLOT(onDownloading(qint64, qint64)));
	Sandbox::connect(SIGNAL(updateFailed()), this, SLOT(onFailed()));
	Sandbox::connect(SIGNAL(updateReady()), this, SLOT(onReady()));

	_versionText = lng_settings_current_version_label(lt_version, currentVersionText());

	switch (Sandbox::updatingState()) {
	case Application::UpdatingDownload:
		setState(State::Download, true);
		setDownloadProgress(Sandbox::updatingReady(), Sandbox::updatingSize());
	break;
	case Application::UpdatingReady: setState(State::Ready, true); break;
	default: setState(State::None, true); break;
	}
}
Ejemplo n.º 9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->storage->setWidgetResizable(true);
    signalMapper = new QSignalMapper();
    shopSignalMapper = new QSignalMapper();
    //signals
    std::map<std::string,int> storageItems;
    storage = new Storage(storageItems);
    factory = new Factory(storage, 0, 0, 1, 20, 10, 0,  std::vector<Worker*>(), std::map<std::size_t, Order*>());
    connect(ui->toggleMainViewButton, SIGNAL(clicked()), this, SLOT(toggleMainViews()));
    connect(factory, SIGNAL(moneyChanged(int)), this, SLOT(onMoneyChanged(int)));
    connect(factory, SIGNAL(orderCreated(int)), this, SLOT(onOrderCreated(int)));
    connect(factory, SIGNAL(orderRemoved(int)), this, SLOT(onOrderRemoved(int)));
    connect(factory, SIGNAL(ratingChanged(float)), this, SLOT(onRatingChanged(float)));
    connect(factory, SIGNAL(levelChanged(int)), this, SLOT(onLevelChanged(int)));
    connect(ui->takeOrder, SIGNAL(clicked()), this, SLOT(onOrderTaken()));
    connect(storage, SIGNAL(addedMaterial(std::string)), this, SLOT(onAddedMaterial(std::string)));
    connect(signalMapper, SIGNAL(mapped(QString)), this, SLOT(onTookMaterial(QString)));
    connect(ui->check, SIGNAL(clicked()), this, SLOT(onCheck()));
    connect(shopSignalMapper, SIGNAL(mapped(QString)), this, SLOT(onPartBought(QString)));
    connect(factory,SIGNAL(levelChanged(int)), this, SLOT(onLevelChanged(int)));
    disableInput();
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("\\w");
    storage->add_material("[aeoui]");
    storage->add_material("[aeoui]");
    storage->add_material("[aeoui]");
    storage->add_material(".?");
    storage->add_material(".?");
    storage->add_material(".?");
    storage->add_material(".?");
    storage->add_material(".?");
    storage->add_material("\\d");
    storage->add_material("\\d");
    storage->add_material("\\d");
    storage->add_material("\\d");
    storage->add_material("[a-c]");
    storage->add_material("[d-f]");
    storage->add_material("[q-t]");
    storage->add_material("[l-s]");
    storage->add_material("[x-z]");
    store = {{"( ͡° ͜ʖ ͡°)", 9001}, {"\\w", 2}, {"\\d", 2}, {"\\s", 2}, {"\\W", 2},
            {"[abcdf]", 1}, {"[xyzt]", 1}, {"[qwerty]", 1},
            {"[aeiouy]", 1}, {"[jklmn]", 1}, {"?", 5}, {"|", 5}, {".", 5},
            {"+", 10}, {"*", 15}, {"[", 0},{"]", 0}};

    ui->storageLayout->setContentsMargins(1, 1, 1, 1);
    populateStore();
    onLevelChanged(1);
}
Ejemplo n.º 10
0
Widget_CheckBox::Widget_CheckBox(Widget* parent) : Widget(parent)
{
    setSize({16, 16});
    onCheck(nullptr);
}