HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent) : QWidget(parent) , ui(new Ui::HistoryManager) , p_QupZilla(mainClass) , m_historyModel(mApp->history()) { ui->setupUi(this); ui->historyTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->historyTree->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->deleteB->setShortcut(QKeySequence("Del")); connect(ui->historyTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*))); connect(ui->historyTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*))); connect(ui->deleteB, SIGNAL(clicked()), this, SLOT(deleteItem())); connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory())); connect(ui->historyTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); connect(m_historyModel, SIGNAL(historyEntryAdded(HistoryModel::HistoryEntry)), this, SLOT(historyEntryAdded(HistoryModel::HistoryEntry))); connect(m_historyModel, SIGNAL(historyEntryDeleted(HistoryModel::HistoryEntry)), this, SLOT(historyEntryDeleted(HistoryModel::HistoryEntry))); connect(m_historyModel, SIGNAL(historyEntryEdited(HistoryModel::HistoryEntry, HistoryModel::HistoryEntry)), this, SLOT(historyEntryEdited(HistoryModel::HistoryEntry, HistoryModel::HistoryEntry))); connect(m_historyModel, SIGNAL(historyClear()), ui->historyTree, SLOT(clear())); connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb())); //QTimer::singleShot(0, this, SLOT(refreshTable())); ui->historyTree->setFocus(); }
QlipperModel::QlipperModel(QObject *parent) : QAbstractListModel(parent) { m_network = new QlipperNetwork(this); m_boldFont.setBold(true); m_sticky = QlipperPreferences::Instance()->getStickyItems(); m_dynamic = QlipperPreferences::Instance()->getDynamicItems(); // a little hack-a-magic to have almost if (m_sticky.count() + m_dynamic.count() == 0) { clipboard_changed(QClipboard::Clipboard); if (m_dynamic.count() == 0) { clearHistory(); } } #ifdef Q_WS_MAC m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(timer_timeout())); m_timer->start(1000); #endif connect(ClipboardWrap::Instance(), &ClipboardWrap::changed, this, &QlipperModel::clipboard_changed); }
ConnectDialog::ConnectDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ConnectDialog) { ui->setupUi(this); setWindowIcon(QIcon(QString::fromUtf8(":/resources/conceptclienticon.png"))); ui->label->setBuddy(ui->addressEdit); QStringList wordList; AnsiString history; #ifdef _WIN32 h_path = getenv("LOCALAPPDATA"); if (!h_path.Length()) h_path = getenv("APPDATA"); mkdir(h_path + "/ConceptClient-private"); h_path += (char *)"/ConceptClient-history.dat"; #else h_path = getenv("HOME"); mkdir(h_path + "/.ConceptClient-private", 0777L); h_path += (char *)"/.ConceptClient-history"; #endif history.LoadFile(h_path.c_str()); this->history = history; AnsiString sep = "\n"; int len_sep = sep.Length(); int pos = history.Pos(sep); int index = 0; int start = 0; while (pos > 0) { if (pos > 1) { history.c_str()[pos - 1] = 0; wordList << history.c_str(); } AnsiString temp = history; history = temp.c_str() + pos + len_sep - 1; pos = history.Pos(sep); } QCompleter *completer = new QCompleter(wordList); completer->setCaseSensitivity(Qt::CaseInsensitive); ui->addressEdit->setCompleter(completer); ui->addressEdit->setText(QString::fromUtf8("concept://")); ui->addressEdit->addAction(QIcon(QString::fromUtf8(":/resources/gtk-index.png")), QLineEdit::LeadingPosition); QAction *action = ui->addressEdit->addAction(QIcon(QString::fromUtf8(":/resources/gtk-delete.png")), QLineEdit::TrailingPosition); QStyle *l_style = QApplication::style(); ui->OkButton->setIcon(l_style->standardIcon(QStyle::SP_DialogOkButton)); ui->CancelButton->setIcon(l_style->standardIcon(QStyle::SP_DialogCancelButton)); QObject::connect(action, SIGNAL(triggered()), this, SLOT(clearHistory())); }
void PinMapDocument::init( const PinMapping & pinMapping, MicroInfo * microInfo ) { m_pinMappingType = pinMapping.type(); m_pPicComponent = static_cast<PIC_IC*>( addItem( "PIC_IC", QPoint( 336, 224 ), true ) ); m_pPicComponent->initPackage( microInfo ); const QStringList pins = pinMapping.pins(); const QStringList::const_iterator end = pins.end(); int keypadCols = -1; // -1 means no keypad switch ( m_pinMappingType ) { case PinMapping::SevenSegment: { m_pSevenSegment = static_cast<ECSevenSegment*>( addItem( "ec/seven_segment", QPoint( 144, 232 ), true ) ); char ssPin = 'a'; for ( QStringList::const_iterator it = pins.begin(); it != end; ++it ) { ICNDocument::createConnector( m_pSevenSegment->childNode( QChar(ssPin) ), m_pPicComponent->childNode(*it) ); ssPin++; } break; } case PinMapping::Keypad_4x3: m_pKeypad = static_cast<ECKeyPad*>( addItem( "ec/keypad", QPoint( 144, 232 ), true ) ); m_pKeypad->property("numCols")->setValue(3); keypadCols = 3; break; case PinMapping::Keypad_4x4: m_pKeypad = static_cast<ECKeyPad*>( addItem( "ec/keypad", QPoint( 144, 232 ), true ) ); m_pKeypad->property("numCols")->setValue(4); keypadCols = 4; break; case PinMapping::Invalid: kDebug() << k_funcinfo << "m_pinMappingType == Invalid" << endl; break; } if ( keypadCols != -1 ) { QStringList::const_iterator it = pins.begin(); for ( unsigned row = 0; (row < 4) && (it != end); ++row, ++it ) ICNDocument::createConnector( m_pKeypad->childNode( QString("row_%1").arg( row ) ), m_pPicComponent->childNode( *it ) ); for ( int col = 0; (col < keypadCols) && (it != end); ++col, ++it ) ICNDocument::createConnector( m_pKeypad->childNode( QString("col_%1").arg( col ) ), m_pPicComponent->childNode( *it ) ); } clearHistory(); // Don't allow undoing of initial creation of stuff }
void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) { // reset so that any current loads are stopped // NOTE: that this has to be done before the layoutTestController is // reset or we get timeouts for some tests. m_page->blockSignals(true); m_page->triggerAction(QWebPage::Stop); m_page->blockSignals(false); QList<QWebSecurityOrigin> knownOrigins = QWebSecurityOrigin::allOrigins(); for (int i = 0; i < knownOrigins.size(); ++i) knownOrigins[i].setDatabaseQuota(databaseDefaultQuota); // reset the layoutTestController at this point, so that we under no // circumstance dump (stop the waitUntilDone timer) during the reset // of the DRT. m_controller->reset(); // reset mouse clicks counter m_eventSender->resetClickCount(); closeRemainingWindows(); m_page->resetSettings(); #ifndef QT_NO_UNDOSTACK m_page->undoStack()->clear(); #endif m_page->mainFrame()->setZoomFactor(1.0); clearHistory(m_page); DumpRenderTreeSupportQt::clearFrameName(m_page->mainFrame()); m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded); if (url.scheme() == "http" || url.scheme() == "https") { // credentials may exist from previous tests. m_page->setNetworkAccessManager(0); delete m_networkAccessManager; m_networkAccessManager = new NetworkAccessManager(this); m_page->setNetworkAccessManager(m_networkAccessManager); } WorkQueue::shared()->clear(); WorkQueue::shared()->setFrozen(false); DumpRenderTreeSupportQt::resetOriginAccessWhiteLists(); // Qt defaults to Windows editing behavior. DumpRenderTreeSupportQt::setEditingBehavior(m_page, "win"); QLocale::setDefault(QLocale::c()); layoutTestController()->setDeveloperExtrasEnabled(true); #ifndef Q_OS_WINCE setlocale(LC_ALL, ""); #endif }
Dialog::Dialog(QWidget *parent) : QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui(new Ui::Dialog), mSettings(new RazorSettings("razor-runner", this)), mGlobalShortcut(new QxtGlobalShortcut(this)) { ui->setupUi(this); setWindowTitle("Razor Runner"); connect(RazorSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings())); ui->commandEd->installEventFilter(this); connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand())); mCommandItemModel = new CommandItemModel(this); ui->commandList->installEventFilter(this); ui->commandList->setModel(mCommandItemModel); ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand())); setFilter(""); ui->commandList->setItemDelegate(new HtmlDelegate(QSize(32, 32), ui->commandList)); connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide())); // Popup menu ............................... QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure razor-runner"), this); connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog())); addAction(a); a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear razor-runner History"), this); connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory())); addAction(a); mPowerManager = new PowerManager(this); addActions(mPowerManager->availableActions()); mScreenSaver = new ScreenSaver(this); addActions(mScreenSaver->availableActions()); setContextMenuPolicy(Qt::ActionsContextMenu); QMenu *menu = new QMenu(this); menu->addActions(actions()); ui->actionButton->setMenu(menu); ui->actionButton->setIcon(XdgIcon::fromTheme("configure")); // End of popup menu ........................ applySettings(); resize(mSettings->value("dialog/width", 400).toInt(), size().height()); }
//check bump sensors and act accordingly -- not used currently void alignToWall() { if (bumpLeft && bumpRight) { //both bumps -- clear history after bump turn(TURN_60_DEGREES); } else if (bumpLeft) { turn(TURN_90_DEGREES); } else if (bumpRight) { turn(TURN_30_DEGREES); } clearHistory(); }
void Board::marked(int x, int y) { // make sure that the last arrow is correctly undrawn undrawArrow(); if(getField(x, y) == EMPTY) return; if(x == mark_x && y == mark_y) { // unmark the piece mark_x = -1; mark_y = -1; updateField(x, y); return; } if(mark_x == -1) { mark_x = x; mark_y = y; updateField(x, y); return; } else { int fld1 = getField(mark_x, mark_y); int fld2 = getField(x, y); // both field same? if(fld1 != fld2) { emit markError(); return; } // trace if(findPath(mark_x, mark_y, x, y)) { emit madeMove(mark_x, mark_y, x, y); drawArrow(mark_x, mark_y, x, y); setField(mark_x, mark_y, EMPTY); setField(x, y, EMPTY); mark_x = -1; mark_y = -1; int dummyx; History dummyh[4]; // game is over? if(!getHint_I(dummyx,dummyx,dummyx,dummyx,dummyh)) { time_for_game = (int)time((time_t)NULL) - starttime; emit endOfGame(); } } else { clearHistory(); emit markError(); } } }
void deviceRobotSonarDetectorInit() { // Timer for detector addTimer(ROBOT_SONAR_DETECTOR_TIMER_INDEX, TIME_DIVIDER_16_HERTZ, deviceRobotSonarDetectorCallbackFunc, "ROBOT SONAR DETECTOR TIMER"); // useSonar = isConfigSet(CONFIG_USE_LASER_MASK); clearHistory(); startSRF02Ranging(robotSonarDetectorI2cBusConnection, SONAR_INDEX); delaymSec(65); getSRF02DistanceEndRanging(robotSonarDetectorI2cBusConnection, SONAR_INDEX); obstacle = false; readNextDistanceFlag = false; }
bool Board::findPath(int x1, int y1, int x2, int y2) { clearHistory(); if(findSimplePath(x1, y1, x2, y2)) return TRUE; else { // find 3-way path int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int i; for(i = 0; i < 4; i++) { int newx = x1 + dx[i], newy = y1 + dy[i]; while(getField(newx, newy) == EMPTY && newx >= -1 && newx <= x_tiles() && newy >= -1 && newy <= y_tiles()) { if(findSimplePath(newx, newy, x2, y2)) { // make place for history point for(int j = 3; j > 0; j--) history[j] = history[j-1]; // insert history point history[0].x = x1; history[0].y = y1; return TRUE; } newx += dx[i]; newy += dy[i]; } } clearHistory(); return FALSE; } return FALSE; }
HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent) : QWidget(parent) , ui(new Ui::HistoryManager) , p_QupZilla(mainClass) { ui->setupUi(this); connect(ui->historyTree, SIGNAL(openLink(QUrl, HistoryView::OpenBehavior)), this, SLOT(openLink(QUrl, HistoryView::OpenBehavior))); connect(ui->deleteB, SIGNAL(clicked()), ui->historyTree, SLOT(removeItems())); connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory())); connect(ui->optimizeDb, SIGNAL(clicked(QPoint)), this, SLOT(optimizeDb())); ui->historyTree->setFocus(); }
int CallModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: destroyCall((*reinterpret_cast< Call*(*)>(_a[1]))); break; case 1: clearHistory(); break; default: ; } _id -= 2; } return _id; }
void RCommandLine::keyPressEvent(QKeyEvent * event) { switch (event->key()) { case Qt::Key_L: if (event->modifiers() == Qt::ControlModifier) { emit clearHistory(); return; } break; case Qt::Key_Enter: case Qt::Key_Return: { QString t = text(); emit commandConfirmed(t); if (!t.isEmpty() && (history.isEmpty() || history.last() != t)) { history.append(t); it = history.end(); } } break; case Qt::Key_Up: if (it != history.begin()) { it--; setText(*it); } return; break; case Qt::Key_Down: if (it != history.end()) { it++; if (it != history.end()) { setText(*it); } else { clear(); } } return; break; case Qt::Key_Escape: if (text().isEmpty()) { event->ignore(); } else { clear(); } break; default: break; } QLineEdit::keyPressEvent(event); }
bool Board::getHint_I(int &x1, int &y1, int &x2, int &y2, History h[4]) { short done[45]; for( short index = 0; index < 45; index++ ) done[index] = 0; // remember old history History old[4]; for(int i = 0; i < 4; i++) old[i] = history[i]; // initial no hint x1 = -1; x2 = -1; y1 = -1; y2 = -1; for(int x = 0; x < x_tiles(); x++) for(int y = 0; y < y_tiles(); y++) if(getField(x, y) != EMPTY && done[getField(x, y)] != 4) { int tile = getField(x, y); // for all these types of tile search path's for(int xx = 0; xx < x_tiles(); xx++) for(int yy = 0; yy < y_tiles(); yy++) if(xx != x || yy != y) if(getField(xx, yy) == tile) if(findPath(x, y, xx, yy)) { for(int i = 0; i < 4; i++) h[i] = history[i]; x1 = x; x2 = xx; y1 = y; y2 = yy; for(int i = 0; i < 4; i++) history[i] = old[i]; return TRUE; } clearHistory(); done[tile]++; } for(int i = 0; i < 4; i++) history[i] = old[i]; return FALSE; }
bool ItemDocument::openURL(const KURL &url) { ItemDocumentData data(type()); if (!data.loadData(url)) return false; // Why do we stop simulating while loading a document? // Crash possible when loading a circuit document, and the Qt event loop is // reentered (such as when a PIC component pops-up a message box), which // will then call the Simulator::step function, which might use components // that have not fully initialized themselves. m_bIsLoading = true; bool wasSimulating = Simulator::self()->isSimulating(); Simulator::self()->slotSetSimulating(false); data.restoreDocument(this); Simulator::self()->slotSetSimulating(wasSimulating); m_bIsLoading = false; setURL(url); clearHistory(); m_savedState = m_currentState; setModified(false); if (FlowCodeDocument *fcd = dynamic_cast<FlowCodeDocument*>(this)) { // We need to tell all pic-depedent components about what pic type is in use emit fcd->picTypeChanged(); } requestEvent(ItemDocument::ItemDocumentEvent::ResizeCanvasToItems); // Load Z-position info m_zOrder.clear(); ItemMap::iterator end = m_itemList.end(); for (ItemMap::iterator it = m_itemList.begin(); it != end; ++it) { if (!(it->second) || it->second->parentItem()) continue; assert(it->second->itemDocument() == this); m_zOrder[it->second->baseZ()] = it->second; } slotUpdateZOrdering(); return true; }
bool checkObstacle() { unsigned int i; unsigned int matchCount = 0; for (i = 0; i < ROBOT_SONAR_DETECTOR_DEVICE_HISTORY_SIZE; i++) { if (distances[i] != 0 && distances[i] < ROBOT_SONAR_DETECTOR_DEVICE_DISTANCE_THRESHOLD) { matchCount++; } } if (matchCount >= ROBOT_SONAR_DETECTOR_DEVICE_HISTORY_THRESHOLD) { clearHistory(); // Wait 30 interrupt before rearming test doNotCheckBeforeCounter = ROBOT_SONAR_DETECTOR_TIMER_SKIP_FOR_NEW_DETECTION; return true; } return false; }
void WorkingBuffers::initialize() { clearHistory(); DataAccess& data_access = DataAccess::instance(); int imageWidth, imageHeight; int styleWidth, styleHeight; data_access.getImageDimensions(imageWidth, imageHeight); data_access.getMaxStyleDimensions(styleWidth, styleHeight); styleHeight *= data_access.getNumStyles(); bool is_right_size = (int)imageWidth == _image_width && (int)imageHeight == _image_height && (int)styleWidth == _style_width && (int)styleHeight == _style_height; if (_is_initialized && is_right_size) { return; } std::cout << "Initializing CUDA working memory (" << imageWidth << " " << imageHeight << " " << styleWidth << " " << styleHeight << ")" << std::endl; // Image-size buffers offsets.initialize(imageWidth, imageHeight); residualCache.initialize(imageWidth, imageHeight); canvasOutputCache.initialize(imageWidth, imageHeight); //canvasInputCache.initialize(imageWidth, imageHeight); canvasVelFCache.initialize(imageWidth, imageHeight); canvasVelBCache.initialize(imageWidth, imageHeight); distTransCache.initialize(imageWidth, imageHeight); ribbonField.initialize(imageWidth, imageHeight); advectedF.initialize(imageWidth, imageHeight); advectedB.initialize(imageWidth, imageHeight); tempOutput.initialize(imageWidth, imageHeight); // Style-size buffers offsetsHistogram.initialize(styleWidth, styleHeight); _is_initialized = true; _style_width = styleWidth; _style_height = styleHeight; _image_width = imageWidth; _image_height = imageHeight; _current_level = 0; }
KTouchStatistics::KTouchStatistics(QWidget* parent) : KTouchStatisticsDlg(parent) { sessionsRadio->setChecked(true); WPMRadio->setChecked(true); eventRadio->setChecked(true); connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()) ); connect(lectureCombo, SIGNAL(activated(int)), this, SLOT(lectureActivated(int)) ); connect(clearButton, SIGNAL(clicked()), this, SLOT(clearHistory()) ); // connect the radio buttons with the chart update function connect(buttonGroup1, SIGNAL(clicked(int)), this, SLOT(updateChartTab()) ); connect(buttonGroup2, SIGNAL(clicked(int)), this, SLOT(updateChartTab()) ); connect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(updateChartTab()) ); // TODO : temporarily remove detailed stats page and deactivate options levelsRadio->setEnabled(false); }
HistoryManager::HistoryManager(BrowserWindow* window, QWidget* parent) : QWidget(parent) , ui(new Ui::HistoryManager) , m_window(window) { ui->setupUi(this); ui->historyTree->setViewType(HistoryTreeView::HistoryManagerViewType); connect(ui->historyTree, SIGNAL(urlActivated(QUrl)), this, SLOT(urlActivated(QUrl))); connect(ui->historyTree, SIGNAL(urlCtrlActivated(QUrl)), this, SLOT(urlCtrlActivated(QUrl))); connect(ui->historyTree, SIGNAL(urlShiftActivated(QUrl)), this, SLOT(urlShiftActivated(QUrl))); connect(ui->historyTree, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(createContextMenu(QPoint))); connect(ui->deleteB, SIGNAL(clicked()), ui->historyTree, SLOT(removeSelectedItems())); connect(ui->clearAll, SIGNAL(clicked()), this, SLOT(clearHistory())); ui->historyTree->setFocus(); }
bool px_ChangeHistory::addChangeRecord(PX_ChangeRecord * pcr) { // add a change record to the history. // blow away any redo, since it is now invalid. xxx_UT_DEBUGMSG(("Add CR Pos %d Type %d indexAP %x \n",pcr->getPosition(),pcr->getType(),pcr->getIndexAP())); xxx_UT_DEBUGMSG(("Before invalidate Undo pos %d savepos %d iAdjust %d \n",m_undoPosition,m_savePosition,m_iAdjustOffset)); if (pcr && pcr->getDocument() == NULL) { pcr->setDocument(getDoc()); } if (m_bOverlap) { clearHistory(); } if (!m_pPT->isDoingTheDo()) { if(pcr && pcr->isFromThisDoc()) { _invalidateRedo(); bool bResult = (m_vecChangeRecords.insertItemAt(pcr,m_undoPosition++) == 0); UT_ASSERT_HARMLESS(bResult); xxx_UT_DEBUGMSG(("After Invalidate Undo pos %d savepos %d iAdjust %d \n",m_undoPosition,m_savePosition,m_iAdjustOffset)); m_iAdjustOffset = 0; return bResult; } else { m_vecChangeRecords.addItem(pcr); UT_sint32 iPos = m_undoPosition - m_iAdjustOffset; m_undoPosition = m_vecChangeRecords.getItemCount(); m_iAdjustOffset = m_undoPosition - iPos; return true; } } else { // // Just save the cr for later deletion with the PT // UT_ASSERT(UT_SHOULD_NOT_HAPPEN); m_vecChangeRecords.addItem(pcr); return true; } }
static void lcd_menu_material_main() { lcd_tripple_menu(PSTR("CHANGE"), PSTR("SETTINGS"), PSTR("RETURN")); if (lcd_lib_button_pressed) { if (IS_SELECTED_MAIN(0)) { minProgress = 0; clearHistory(); lcd_change_to_menu(lcd_menu_change_material_preheat); } else if (IS_SELECTED_MAIN(1)) lcd_change_to_menu(lcd_menu_material_select, SCROLL_MENU_ITEM_POS(0)); else if (IS_SELECTED_MAIN(2)) lcd_change_to_menu(lcd_menu_main); } lcd_lib_update_screen(); }
void PrinterWidget::deleteQueueItem(QListWidgetItem* item) { QListWidget& lst = *ui->print_list; const QString& path = item->data(3).toString(); clearHistory(edit_history->find(path)); if (previousItem == item) { previousItem = NULL; } if (currentItem == item) { currentItem = NULL; QLabel* l = dynamic_cast<QLabel*>(ui->monitor_area->widget()); if (cut_rect_show_pix != NULL) { delete cut_rect_show_pix; } if (work_pix != NULL) { delete work_pix; } work_pix = new QPixmap; cut_rect_show_pix = new QPixmap; setRedBox(cut_rect_show_pix, cut_rect_show_pix->rect()); l->setPixmap(*cut_rect_show_pix); resetCutParameters(0,0); } removeCurrentState(path); delete item; if (lst.count() == 0) { ui->selection_button->setText("Выделить всё"); copies_table->clear(); } }
void Board::undrawArrow() { if(trying) return; // is already undrawn? if(history[0].x == -2) return; // redraw all affected fields int num = 0; while(num < 3 && history[num+1].x != -2) { if(history[num].y == history[num+1].y) for(int i = MIN(history[num].x, history[num+1].x); i <= MAX(history[num].x, history[num+1].x); i++) updateField(i, history[num].y); else for(int i = MIN(history[num].y, history[num+1].y); i <= MAX(history[num].y, history[num+1].y); i++) updateField(history[num].x, i); num++; } clearHistory(); }
int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ TCHAR progtitle[1000]; TCHAR resstr[100]; HMENU menu; HWND hToolbar; HIMAGELIST hImageList; HANDLE haccel; HBITMAP tempBm; int i; TCHAR tooltips[16][30]; HDC hDC; TCHAR *c; TCHAR sfnFilename[1000]; TCHAR sfnFiletitle[256]; TCHAR sfnFilter[1000]; TCHAR ofnFilename[1000]; TCHAR ofnFiletitle[256]; TCHAR ofnFilter[1000]; TCHAR miniaturetitle[100]; static int custColors[16] = { 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff }; /* init font for text tool */ lfTextFont.lfHeight = 0; lfTextFont.lfWidth = 0; lfTextFont.lfEscapement = 0; lfTextFont.lfOrientation = 0; lfTextFont.lfWeight = FW_NORMAL; lfTextFont.lfItalic = FALSE; lfTextFont.lfUnderline = FALSE; lfTextFont.lfStrikeOut = FALSE; lfTextFont.lfCharSet = DEFAULT_CHARSET; lfTextFont.lfOutPrecision = OUT_DEFAULT_PRECIS; lfTextFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; lfTextFont.lfQuality = DEFAULT_QUALITY; lfTextFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; lstrcpy(lfTextFont.lfFaceName, _T("")); hfontTextFont = CreateFontIndirect(&lfTextFont); /* init palette */ selectedPalette = 1; CopyMemory(palColors, modernPalColors, sizeof(palColors)); hProgInstance = hThisInstance; /* initialize common controls library */ InitCommonControls(); /* register application defined window classes */ RegisterWclMain(); RegisterWclScrollbox(); RegisterWclPal(); RegisterWclSettings(); RegisterWclSelection(); RegisterWclSizebox(); RegisterWclTextEdit(); LoadString(hThisInstance, IDS_DEFAULTFILENAME, filename, SIZEOF(filename)); LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr)); _stprintf(progtitle, resstr, filename); LoadString(hThisInstance, IDS_MINIATURETITLE, miniaturetitle, SIZEOF(miniaturetitle)); /* create main window */ hwnd = CreateWindowEx(0, _T("MainWindow"), progtitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, hThisInstance, NULL); hMainWnd = hwnd; hwndMiniature = CreateWindowEx(WS_EX_PALETTEWINDOW, _T("MainWindow"), miniaturetitle, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 180, 200, 120, 100, hwnd, NULL, hThisInstance, NULL); /* loading and setting the window menu from resource */ menu = LoadMenu(hThisInstance, MAKEINTRESOURCE(ID_MENU)); SetMenu(hwnd, menu); haccel = LoadAccelerators(hThisInstance, MAKEINTRESOURCE(800)); /* preloading the draw transparent/nontransparent icons for later use */ hNontranspIcon = LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_NONTRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR); hTranspIcon = LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_TRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR); hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL)); hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR)); hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM)); hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN)); hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH)); CreateWindowEx(0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL); hToolBoxContainer = CreateWindowEx(0, _T("MainWindow"), _T(""), WS_CHILD | WS_VISIBLE, 2, 2, 52, 350, hwnd, NULL, hThisInstance, NULL); /* creating the 16 bitmap radio buttons and setting the bitmap */ /* * FIXME: Unintentionally there is a line above the tool bar (hidden by y-offset). * To prevent cropping of the buttons height has been increased from 200 to 205 */ hToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT | CCS_NORESIZE | TBSTYLE_TOOLTIPS, 1, -2, 50, 205, hToolBoxContainer, NULL, hThisInstance, NULL); hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0); SendMessage(hToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList); tempBm = LoadImage(hThisInstance, MAKEINTRESOURCE(IDB_TOOLBARICONS), IMAGE_BITMAP, 256, 16, 0); ImageList_AddMasked(hImageList, tempBm, 0xff00ff); DeleteObject(tempBm); SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); for(i = 0; i < 16; i++) { TBBUTTON tbbutton; int wrapnow = 0; if (i % 2 == 1) wrapnow = TBSTATE_WRAP; LoadString(hThisInstance, IDS_TOOLTIP1 + i, tooltips[i], 30); ZeroMemory(&tbbutton, sizeof(TBBUTTON)); tbbutton.iString = (INT_PTR) tooltips[i]; tbbutton.fsStyle = TBSTYLE_CHECKGROUP; tbbutton.fsState = TBSTATE_ENABLED | wrapnow; tbbutton.idCommand = ID_FREESEL + i; tbbutton.iBitmap = i; SendMessage(hToolbar, TB_ADDBUTTONS, 1, (LPARAM) &tbbutton); } SendMessage(hToolbar, TB_CHECKBUTTON, ID_PEN, MAKELONG(TRUE, 0)); SendMessage(hToolbar, TB_SETMAXTEXTROWS, 0, 0); SendMessage(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(25, 25)); /* creating the tool settings child window */ hToolSettings = CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD | WS_VISIBLE, 5, 208, 42, 140, hToolBoxContainer, NULL, hThisInstance, NULL); hTrackbarZoom = CreateWindowEx(0, TRACKBAR_CLASS, _T(""), WS_CHILD | TBS_VERT | TBS_AUTOTICKS, 1, 1, 40, 64, hToolSettings, NULL, hThisInstance, NULL); SendMessage(hTrackbarZoom, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG(0, 6)); SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 3); /* creating the palette child window */ hPalWin = CreateWindowEx(0, _T("Palette"), _T(""), WS_CHILD | WS_VISIBLE, 56, 9, 255, 32, hwnd, NULL, hThisInstance, NULL); /* creating the scroll box */ hScrollbox = CreateWindowEx(WS_EX_CLIENTEDGE, _T("Scrollbox"), _T(""), WS_CHILD | WS_GROUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 56, 49, 472, 248, hwnd, NULL, hThisInstance, NULL); /* creating the status bar */ hStatusBar = CreateWindowEx(0, STATUSCLASSNAME, _T(""), SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, NULL, hThisInstance, NULL); SendMessage(hStatusBar, SB_SETMINHEIGHT, 21, 0); hScrlClient = CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 500, 500, hScrollbox, NULL, hThisInstance, NULL); /* create selection window (initially hidden) */ hSelection = CreateWindowEx(WS_EX_TRANSPARENT, _T("Selection"), _T(""), WS_CHILD | BS_OWNERDRAW, 350, 0, 100, 100, hScrlClient, NULL, hThisInstance, NULL); /* creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn */ hImageArea = CreateWindowEx(0, _T("MainWindow"), _T(""), WS_CHILD | WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient, NULL, hThisInstance, NULL); hDC = GetDC(hImageArea); hDrawingDC = CreateCompatibleDC(hDC); hSelDC = CreateCompatibleDC(hDC); ReleaseDC(hImageArea, hDC); SelectObject(hDrawingDC, CreatePen(PS_SOLID, 0, fgColor)); SelectObject(hDrawingDC, CreateSolidBrush(bgColor)); hBms[0] = CreateDIBWithProperties(imgXRes, imgYRes); SelectObject(hDrawingDC, hBms[0]); Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, imgYRes + 1); if (lpszArgument[0] != 0) { HBITMAP bmNew = NULL; LoadDIBFromFile(&bmNew, lpszArgument, &fileTime, &fileSize, &fileHPPM, &fileVPPM); if (bmNew != NULL) { TCHAR tempstr[1000]; TCHAR resstr[100]; TCHAR *temp; insertReversible(bmNew); GetFullPathName(lpszArgument, SIZEOF(filepathname), filepathname, &temp); _tcscpy(filename, temp); LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr)); _stprintf(tempstr, resstr, filename); SetWindowText(hMainWnd, tempstr); clearHistory(); isAFile = TRUE; } else { exit(0); } } /* initializing the CHOOSECOLOR structure for use with ChooseColor */ choosecolor.lStructSize = sizeof(CHOOSECOLOR); choosecolor.hwndOwner = hwnd; choosecolor.hInstance = NULL; choosecolor.rgbResult = 0x00ffffff; choosecolor.lpCustColors = (COLORREF*) &custColors; choosecolor.Flags = 0; choosecolor.lCustData = 0; choosecolor.lpfnHook = NULL; choosecolor.lpTemplateName = NULL; /* initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName */ CopyMemory(ofnFilename, filename, sizeof(filename)); LoadString(hThisInstance, IDS_OPENFILTER, ofnFilter, SIZEOF(ofnFilter)); for(c = ofnFilter; *c; c++) if (*c == '\1') *c = '\0'; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd; ofn.hInstance = hThisInstance; ofn.lpstrFilter = ofnFilter; ofn.lpstrFile = ofnFilename; ofn.nMaxFile = SIZEOF(ofnFilename); ofn.lpstrFileTitle = ofnFiletitle; ofn.nMaxFileTitle = SIZEOF(ofnFiletitle); ofn.Flags = OFN_HIDEREADONLY; CopyMemory(sfnFilename, filename, sizeof(filename)); LoadString(hThisInstance, IDS_SAVEFILTER, sfnFilter, SIZEOF(sfnFilter)); for(c = sfnFilter; *c; c++) if (*c == '\1') *c = '\0'; ZeroMemory(&sfn, sizeof(OPENFILENAME)); sfn.lStructSize = sizeof(OPENFILENAME); sfn.hwndOwner = hwnd; sfn.hInstance = hThisInstance; sfn.lpstrFilter = sfnFilter; sfn.lpstrFile = sfnFilename; sfn.nMaxFile = SIZEOF(sfnFilename); sfn.lpstrFileTitle = sfnFiletitle; sfn.nMaxFileTitle = SIZEOF(sfnFiletitle); sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; /* creating the size boxes */ hSizeboxLeftTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxCenterTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxRightTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxLeftCenter = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxRightCenter = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxLeftBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxCenterBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); hSizeboxRightBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL); /* placing the size boxes around the image */ SendMessage(hImageArea, WM_SIZE, 0, 0); /* by moving the window, the things in WM_SIZE are done */ MoveWindow(hwnd, 100, 100, 600, 450, TRUE); /* creating the text editor window for the text tool */ hwndTextEdit = CreateWindowEx(0, _T("TextEdit"), _T(""), WS_OVERLAPPEDWINDOW, 300, 0, 300, 200, hwnd, NULL, hThisInstance, NULL); /* creating the edit control within the editor window */ hwndEditCtl = CreateWindowEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0, 0, 100, 100, hwndTextEdit, NULL, hThisInstance, NULL); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); /* inform the system, that the main window accepts dropped files */ DragAcceptFiles(hwnd, TRUE); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage(&messages, NULL, 0, 0)) { TranslateAccelerator(hwnd, haccel, &messages); /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; }
void commandDecider (CMD_t *inputCommand) { char *commandName = inputCommand -> argv[0]; if (ifRedirection (inputCommand)) { // Send to Redirection executeRedirection (inputCommand); return; } if (ifPiping (inputCommand)) { // Send to Piping executePiping (inputCommand); return; } if (ifReturn (inputCommand)) { // Don't do anything return; } if (!strcmp (commandName, "help")) { // Send to help executeHelp (inputCommand); return; } if (!strcmp (commandName, "clear")) { // Send to clear executeClear (inputCommand); return; } if (!strcmp (commandName, "pwd")) { // Send to pwd showPWD (); return; } if (!strcmp (commandName, "ls")) { // Send to ls executeLS (inputCommand); return; } if (!strcmp (commandName, "whoami")) { // Send to whoami showWhoami (); return; } if (!strcmp (commandName, "cd")) { // Send to cd executeCD (inputCommand); return; } if (!strcmp (commandName, "pid")) { // Send to pid executePID (inputCommand); return; } if (!strcmp (commandName, "history")) { // Send to history executeHistory (inputCommand); return; } if (!strcmp (commandName, "kill")) { // Send to kill executeKill (inputCommand); return; } if (!strcmp (commandName, "exit")) { clearHistory (); exit (0); } printf ("ERROR: INVALID_COMMAND :: \"%s\" is not a recognised command.. Type \"help\" for more information\n", commandName); return; }
void initHistory() { historyBlock = (HistRec *) new char[historySize]; clearHistory(); }
fullscreen = new QCheckBox(tr("Disable multi-tasking (including Phone app)")); fullscreen->setChecked(settings.value("fullscreen", FULLSCREEN).toBool()); ui->advanced->addWidget(fullscreen); row++; prevent_device_lock = new QCheckBox(tr("Prevent device lock (aka. \"Secure Device\")")); prevent_device_lock->setChecked(settings.value("prevent_device_lock", false).toBool()); clear_history = new QPushButton(tr("Clear alarm history")); clear_history->setEnabled(settings.childGroups().contains("history")); ui->advanced->addWidget(prevent_device_lock); ui->advanced->addWidget(clear_history); row++; connect(clear_history, SIGNAL(clicked()), this, SLOT(clearHistory())); moduleChanged(); //manually update after loading settings so unrelated options can be disabled } Settings::~Settings() { delete ui; } void Settings::closeEvent(QCloseEvent*) { save(); } void Settings::pickSoundFile() { QString name = QFileDialog::getOpenFileName(this, tr("Choose Sound File"), sound_filename->valueText(), "Sound Files(*.wav *.mp3 *.ogg *.aac)"); if(!name.isEmpty())
RideFileCommand::~RideFileCommand() { clearHistory(); }
//---------------------------------------------------------------------- // The public interface to the commands //---------------------------------------------------------------------- RideFileCommand::RideFileCommand(RideFile *ride) : ride(ride), stackptr(0), inLUW(false), luw(NULL) { connect(ride, SIGNAL(saved()), this, SLOT(clearHistory())); connect(ride, SIGNAL(reverted()), this, SLOT(clearHistory())); }
CQTaskMethodWidget::~CQTaskMethodWidget() { clearHistory(); }