Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all
Unified · Split
| @@ -200,7 +200,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 199 unmodified lines | |||
| 200 | _packetCount(0), | 200 | _packetCount(0), |
| 201 | _packetsPerSecond(0), | 201 | _packetsPerSecond(0), |
| 202 | _bytesPerSecond(0), | 202 | _bytesPerSecond(0), |
| 203 | _bytesCount(0) | 203 | _bytesCount(0), |
| 204 | _swatch(NULL) | ||
| 204 | { | 205 | { |
| 205 | _applicationStartupTime = startup_time; | 206 | _applicationStartupTime = startup_time; |
| 206 | _window->setWindowTitle("Interface"); | 207 | _window->setWindowTitle("Interface"); |
| @@ -276,11 +277,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 69 unmodified lines | |||
| 276 | FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml"); | 277 | FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml"); |
| 277 | FvUpdater::sharedUpdater()->CheckForUpdatesSilent(); | 278 | FvUpdater::sharedUpdater()->CheckForUpdatesSilent(); |
| 278 | #endif | 279 | #endif |
| 279 | 280 | ||
| 280 | initMenu(); | 281 | initMenu(); |
| 281 | 282 | ||
| 282 | _swatch = new Swatch(_voxelPaintColor); | ||
| 283 | |||
| 284 | QRect available = desktop()->availableGeometry(); | 283 | QRect available = desktop()->availableGeometry(); |
| 285 | _window->resize(available.size()); | 284 | _window->resize(available.size()); |
| 286 | _window->setVisible(true); | 285 | _window->setVisible(true); |
| @@ -727,7 +726,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 440 unmodified lines | |||
| 727 | case Qt::Key_6: | 726 | case Qt::Key_6: |
| 728 | case Qt::Key_7: | 727 | case Qt::Key_7: |
| 729 | case Qt::Key_8: | 728 | case Qt::Key_8: |
| 730 | _swatch->handleEvent(event->key(), _eyedropperMode->isChecked()); | 729 | _swatch.handleEvent(event->key(), _eyedropperMode->isChecked()); |
| 731 | break; | 730 | break; |
| 732 | default: | 731 | default: |
| 733 | event->ignore(); | 732 | event->ignore(); |
| @@ -1241,7 +1240,7 @@ void Application::increaseVoxelSize() { · 507 unmodified lines | |||
| 1241 | } | 1240 | } |
| 1242 | 1241 | ||
| 1243 | void Application::resetSwatchColors() { | 1242 | void Application::resetSwatchColors() { |
| 1244 | _swatch->reset(); | 1243 | _swatch.reset(); |
| 1245 | } | 1244 | } |
| 1246 | 1245 | ||
| 1247 | static QIcon createSwatchIcon(const QColor& color) { | 1246 | static QIcon createSwatchIcon(const QColor& color) { |
| @@ -1547,6 +1546,8 @@ void Application::initMenu() { · 299 unmodified lines | |||
| 1547 | 1546 | ||
| 1548 | _voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this, | 1547 | _voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this, |
| 1549 | SLOT(chooseVoxelPaintColor()), Qt::META | Qt::Key_C); | 1548 | SLOT(chooseVoxelPaintColor()), Qt::META | Qt::Key_C); |
| 1549 | _swatch.setAction(_voxelPaintColor); | ||
| 1550 | |||
| 1550 | QColor paintColor(128, 128, 128); | 1551 | QColor paintColor(128, 128, 128); |
| 1551 | _voxelPaintColor->setData(paintColor); | 1552 | _voxelPaintColor->setData(paintColor); |
| 1552 | _voxelPaintColor->setIcon(createSwatchIcon(paintColor)); | 1553 | _voxelPaintColor->setIcon(createSwatchIcon(paintColor)); |
| @@ -1679,7 +1680,7 @@ void Application::init() { · 126 unmodified lines | |||
| 1679 | _palette.init(_glWidget->width(), _glWidget->height()); | 1680 | _palette.init(_glWidget->width(), _glWidget->height()); |
| 1680 | _palette.addAction(_addVoxelMode, 0, 0); | 1681 | _palette.addAction(_addVoxelMode, 0, 0); |
| 1681 | _palette.addAction(_deleteVoxelMode, 0, 1); | 1682 | _palette.addAction(_deleteVoxelMode, 0, 1); |
| 1682 | _palette.addTool(_swatch); | 1683 | _palette.addTool(&_swatch); |
| 1683 | _palette.addAction(_colorVoxelMode, 0, 2); | 1684 | _palette.addAction(_colorVoxelMode, 0, 2); |
| 1684 | _palette.addAction(_eyedropperMode, 0, 3); | 1685 | _palette.addAction(_eyedropperMode, 0, 3); |
| 1685 | _palette.addAction(_selectVoxelMode, 0, 4); | 1686 | _palette.addAction(_selectVoxelMode, 0, 4); |
| @@ -2434,28 +2435,28 @@ void Application::displayOverlay() { · 748 unmodified lines | |||
| 2434 | 2435 | ||
| 2435 | _palette.render(_glWidget->width(), _glWidget->height()); | 2436 | _palette.render(_glWidget->width(), _glWidget->height()); |
| 2436 | 2437 | ||
| 2437 | if (_eyedropperMode->isChecked() && _voxelPaintColor->data().value<QColor>() != _swatch->getColor()) { | 2438 | if (_eyedropperMode->isChecked() && _voxelPaintColor->data().value<QColor>() != _swatch.getColor()) { |
| 2438 | QColor color(_voxelPaintColor->data().value<QColor>()); | 2439 | QColor color = _voxelPaintColor->data().value<QColor>(); |
| 2439 | TextRenderer textRenderer(SANS_FONT_FAMILY, 11, 50); | 2440 | TextRenderer textRenderer(SANS_FONT_FAMILY, 11, 50); |
| 2440 | const char* line1("Assign this color to a swatch"); | 2441 | const char line1[] = "Assign this color to a swatch"; |
| 2441 | const char* line2("by choosing a key from 1 to 8."); | 2442 | const char line2[] = "by choosing a key from 1 to 8."; |
| 2442 | double step(0.05f); | 2443 | double step = 0.05f; |
| 2443 | int left((_glWidget->width() - 300)/2); | 2444 | int left = (_glWidget->width() - 300) / 2; |
| 2444 | int top(_glWidget->height()/40.0f); | 2445 | int top = _glWidget->height() / 40.0f; |
| 2445 | double margin(10.0f); | 2446 | double margin = 10.0f; |
| 2446 | 2447 | ||
| 2447 | glBegin(GL_POLYGON); | 2448 | glBegin(GL_POLYGON); |
| 2448 | glColor3f(0.0f, 0.0f, 0.0f); | 2449 | glColor3f(0.0f, 0.0f, 0.0f); |
| 2449 | for (double a(M_PI); a < 1.5f*M_PI; a += step) { | 2450 | for (double a = M_PI; a < 1.5f * M_PI; a += step) { |
| 2450 | glVertex2f(left + margin*cos(a), top + margin*sin(a)); | 2451 | glVertex2f(left + margin * cos(a), top + margin * sin(a)); |
| 2451 | } | 2452 | } |
| 2452 | for (double a(1.5f*M_PI); a < 2.0f*M_PI; a += step) { | 2453 | for (double a = 1.5f * M_PI; a < 2.0f*M_PI; a += step) { |
| 2453 | glVertex2f(left + 280 + margin*cos(a), top + margin*sin(a)); | 2454 | glVertex2f(left + 280 + margin * cos(a), top + margin * sin(a)); |
| 2454 | } | 2455 | } |
| 2455 | for (double a(0.0f); a < 0.5f*M_PI; a += step) { | 2456 | for (double a = 0.0f; a < 0.5f * M_PI; a += step) { |
| 2456 | glVertex2f(left + 280 + margin*cos(a), top + 30 + margin*sin(a)); | 2457 | glVertex2f(left + 280 + margin * cos(a), top + 30 + margin * sin(a)); |
| 2457 | } | 2458 | } |
| 2458 | for (double a(0.5f*M_PI); a < 1.0f*M_PI; a += step) { | 2459 | for (double a = 0.5f*M_PI; a < 1.0f*M_PI; a += step) { |
| 2459 | glVertex2f(left + margin*cos(a), top + 30 + margin*sin(a)); | 2460 | glVertex2f(left + margin*cos(a), top + 30 + margin*sin(a)); |
| 2460 | } | 2461 | } |
| 2461 | glEnd(); | 2462 | glEnd(); |
| @@ -2475,7 +2476,7 @@ void Application::displayOverlay() { · 13 unmodified lines | |||
| 2475 | textRenderer.draw(left + 74, top + 28, line2); | 2476 | textRenderer.draw(left + 74, top + 28, line2); |
| 2476 | } | 2477 | } |
| 2477 | else { | 2478 | else { |
| 2478 | _swatch->checkColor(); | 2479 | _swatch.checkColor(); |
| 2479 | } | 2480 | } |
| 2480 | 2481 | ||
| 2481 | glPopMatrix(); | 2482 | glPopMatrix(); |
| @@ -3027,7 +3028,7 @@ void Application::loadSettings(QSettings* settings) { · 545 unmodified lines | |||
| 3027 | 3028 | ||
| 3028 | scanMenuBar(&Application::loadAction, settings); | 3029 | scanMenuBar(&Application::loadAction, settings); |
| 3029 | getAvatar()->loadData(settings); | 3030 | getAvatar()->loadData(settings); |
| 3030 | _swatch->loadData(settings); | 3031 | _swatch.loadData(settings); |
| 3031 | } | 3032 | } |
| 3032 | 3033 | ||
| 3033 | 3034 | ||
| @@ -3049,7 +3050,7 @@ void Application::saveSettings(QSettings* settings) { · 15 unmodified lines | |||
| 3049 | 3050 | ||
| 3050 | scanMenuBar(&Application::saveAction, settings); | 3051 | scanMenuBar(&Application::saveAction, settings); |
| 3051 | getAvatar()->saveData(settings); | 3052 | getAvatar()->saveData(settings); |
| 3052 | _swatch->saveData(settings); | 3053 | _swatch.saveData(settings); |
| 3053 | } | 3054 | } |
| 3054 | 3055 | ||
| 3055 | void Application::importSettings() { | 3056 | void Application::importSettings() { |