pax_global_header 0000666 0000000 0000000 00000000064 14743753373 0014532 g ustar 00root root 0000000 0000000 52 comment=2addc17d59a9e1cc990c60d2714aaa8b9df6709d
avogadroapp-1.100.0/ 0000775 0000000 0000000 00000000000 14743753373 0014174 5 ustar 00root root 0000000 0000000 avogadroapp-1.100.0/.clang-format 0000664 0000000 0000000 00000000402 14743753373 0016543 0 ustar 00root root 0000000 0000000 ---
# This configuration requires clang-format 3.8 or higher.
BasedOnStyle: Mozilla
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionReturnType: None
BinPackArguments: true
BinPackParameters: true
BreakConstructorInitializersBeforeComma: false
...
avogadroapp-1.100.0/.clang-tidy 0000664 0000000 0000000 00000001625 14743753373 0016234 0 ustar 00root root 0000000 0000000 Checks: 'clang-analyzer*,modernize-avoid-bind,modernize-concat-nested-namespaces,
modernize-loop-convert,modernize-macro-to-enum,modernize-use-bool-literals,
modernize-use-auto,modernize-use-nullptr,modernize-use-override,
modernize-raw-string-literal,modernize-use-emplace,modernize-pass-by-value
misc-unused-using-decls,
misc-unused-alias-decls,
misc-redundant-expression,
performance-for-range-copy,
performance-inefficient*,performance-type-promotion*,
performance-unnecessary-copy-initialization,
performance-move-const-arg,
readability-const-return-type,
readability-delete-null-pointer,
readability-redundant-string-cstr,
readability-simplify*
-readability-else-after-return,
-portability-restrict-system-includes,
-modernize-use-trailing-return-type'
FormatStyle: file
avogadroapp-1.100.0/.codacy.yaml 0000664 0000000 0000000 00000000116 14743753373 0016376 0 ustar 00root root 0000000 0000000 ---
engines:
cppcheck:
language: c++
exclude_paths:
- "thirdparty/**"
avogadroapp-1.100.0/.github/ 0000775 0000000 0000000 00000000000 14743753373 0015534 5 ustar 00root root 0000000 0000000 avogadroapp-1.100.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000172 14743753373 0017351 0 ustar 00root root 0000000 0000000 # These are supported funding model platforms
open_collective: avogadro # Replace with a single Open Collective username
avogadroapp-1.100.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14743753373 0017717 5 ustar 00root root 0000000 0000000 avogadroapp-1.100.0/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001531 14743753373 0022411 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
---
**Avogadro version: (please complete the following information from the About box):**
- Avogadrolibs: (e.g. 1.90.0-316-g6d14770)
- Qt: (e.g., 5.9.5)
**Desktop version: (please complete the following information):**
- OS: [e.g. MacOS]
- Version [e.g. 10.12.4]
- Compiler (if you built from source)
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here. **Please consider uploading or linking test files.**
avogadroapp-1.100.0/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001425 14743753373 0023446 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I wish Avogadro calculated XYQ moments to render with ..
**Describe the solution you'd like**
A clear and concise description of what you want to happen. Please be detailed. How might this feature work (e.g., first a window would open and you'd click to …)
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
Please consider opening a topic on https://discuss.avogadro.cc/ to allow further public discussion
avogadroapp-1.100.0/.github/PULL_REQUEST_TEMPLATE 0000664 0000000 0000000 00000002615 14743753373 0020742 0 ustar 00root root 0000000 0000000 Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
avogadroapp-1.100.0/.github/config.yml 0000664 0000000 0000000 00000001770 14743753373 0017531 0 ustar 00root root 0000000 0000000 # Configuration for welcome - https://github.com/behaviorbot/welcome
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Thanks for opening your first issue here! Please try to include example files and screenshots if possible.
If you're looking for support, please post on our forum: https://discuss.avogadro.cc/
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Thanks for opening this pull request! Please check out our contributing guidelines and check for the automated tests.
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Congrats on merging your first pull request! 🎉 Thanks for making Avogadro better for everyone!
avogadroapp-1.100.0/.github/dependabot.yml 0000664 0000000 0000000 00000000334 14743753373 0020364 0 ustar 00root root 0000000 0000000 # Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
avogadroapp-1.100.0/.github/move.yml 0000664 0000000 0000000 00000001032 14743753373 0017221 0 ustar 00root root 0000000 0000000 # Configuration for move-issues - https://github.com/dessant/move-issues
# Delete the command comment when it contains no other content
deleteCommand: true
# Close the source issue after moving
closeSourceIssue: true
# Lock the source issue after moving
lockSourceIssue: false
# Mention issue and comment authors
mentionAuthors: true
# Preserve mentions in the issue content
keepContentMentions: false
# Set custom aliases for targets
# aliases:
# r: repo
# or: owner/repo
# Repository to extend settings from
# _extends: repo
avogadroapp-1.100.0/.github/release-drafter.yml 0000664 0000000 0000000 00000001335 14743753373 0021326 0 ustar 00root root 0000000 0000000 name-template: 'Avogadro $RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'build'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: minor
template: |
## Changes
$CHANGES
## Credits
Thanks to many contributors, including: $CONTRIBUTORS
avogadroapp-1.100.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14743753373 0017571 5 ustar 00root root 0000000 0000000 avogadroapp-1.100.0/.github/workflows/build_cmake.yml 0000664 0000000 0000000 00000026653 14743753373 0022567 0 ustar 00root root 0000000 0000000 name: CMake Build Matrix
# Many thanks to Cristian Adam for examples
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/
on: [push, pull_request]
env:
BUILD_TYPE: Release
QT_VERSION: 5.15.2
# this is different from MACOSX_DEPLOYMENT_TARGET to prevent build problems
# we set MACOSX_DEPLOYMENT_TARGET later
MACOS_TARGET: 10.12
FEATURES: -DUSE_VTK=ON -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu GCC", artifact: "Ubuntu-Latest.tar.gz",
os: ubuntu-latest,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF -DCMAKE_BUILD_TYPE=Release",
cpack: "",
}
- {
name: "Ubuntu AppImage", artifact: "Avogadro2.AppImage",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "Release",
cmake_flags: "-G Ninja -DBUILD_MOLEQUEUE=OFF -DINSTALL_BUNDLE_FILES=ON -DCMAKE_BUILD_TYPE=Release",
cpack: "",
}
- {
name: "macOS Latest Clang", artifact: "macOS.dmg",
os: macos-latest,
cc: "clang", cxx: "clang++",
build_type: "Release",
cmake_flags: "-G Ninja -DBUILD_MOLEQUEUE=OFF",
cpack_flags: "-G DragNDrop",
}
- {
name: "Windows Latest MSVC", artifact: "Win64.exe",
os: windows-latest,
cc: "cl", cxx: "cl",
build_type: "Release",
cmake_flags: "-DBUILD_MOLEQUEUE=OFF",
build_flags: "-j 2",
cpack_flags: "-G NSIS",
ssl_env: "D:\\a\\avogadroapp\\Qt\\Tools\\OpenSSLv3\\Win_x64",
}
- {
name: "Ubuntu Address Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "asan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cpack: "",
}
- {
name: "Ubuntu Leak Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "lsan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cpack: "",
}
- {
name: "Ubuntu Thread Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "tsan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cpack: "",
}
- {
name: "Ubuntu Undefined Behavior Sanitizer", artifact: "",
os: ubuntu-20.04,
cc: "gcc", cxx: "g++",
build_type: "ubsan",
cmake_flags: "-G Ninja -DENABLE_TESTING=ON -DTEST_QTGL=OFF",
cpack: "",
}
steps:
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get -qq update
sudo apt-get -qq install ninja-build libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5x11extras5-dev libqt5svg5-dev
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja boost eigen glew open-babel
- name: Install Dependencies (Windows)
if: runner.os == 'Windows'
run: choco install ninja
- name: Checkout openchemistry
uses: actions/checkout@v4
with:
repository: openchemistry/openchemistry
submodules: recursive
- name: Checkout avogadroapp
uses: actions/checkout@v4
with:
path: avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@v4
with:
repository: openchemistry/avogadrolibs
path: avogadrolibs
- name: Cache Qt
id: cache-qt
uses: actions/cache@v4
with:
path: ../Qt
key: ${{ runner.os }}-QtCache
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
cache: true
version: ${{ env.QT_VERSION }}
- name: Install OpenSSL (Win64)
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
cache: true
host: 'windows'
target: 'desktop'
tools-only: 'true'
tools: 'tools_opensslv3_x64'
- name: Configure MSVC Command Prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
# won't have any effect except on Mac
echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}}
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Setup tmate session
if: failure()
uses: mxschmitt/action-tmate@v3
- name: Fix Mac plugins
if: runner.os == 'macOS'
working-directory: ${{ runner.workspace }}/build/prefix/lib/openbabel
run: |
for plugin in *.so; do
for libpath in `otool -L ${plugin} | grep '/Users/runner/work' | awk '{print $1}'`; do
export lib=`echo $libpath | cut -d '/' -f 9`;
echo "Fixing $plugin $lib $libpath"
install_name_tool -change $libpath @executable_path/../Frameworks/$lib $plugin
done
done
cd .. # build/prefix/lib
for plugin in libinchi.?.?.?.dylib; do
for libpath in `otool -L ${plugin} | grep '/Users/runner/work' | awk '{print $1}'`; do
export lib=`echo $libpath | cut -d '/' -f 9`;
echo "Fixing $plugin $lib $libpath"
install_name_tool -change $libpath @executable_path/../Frameworks/$lib $plugin
done
done
otool -L libinchi.?.?.?.dylib
cp -p libinchi* ../Avogadro2.app/Contents/Frameworks/
- name: Run tests
if: matrix.config.os == 'ubuntu-20.04'
shell: cmake -P {0}
run: |
include(ProcessorCount)
ProcessorCount(N)
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
set(ENV{ASAN_OPTIONS} "new_delete_type_mismatch=0")
execute_process(
COMMAND ctest -j ${N}
WORKING_DIRECTORY ${{ runner.workspace }}/build/avogadrolibs
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Running tests failed!")
endif()
- name: Install the Apple certificate
# From GitHub docs: https://docs.github.com/en/actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development
if: runner.os == 'macOS'
working-directory: ${{ runner.workspace }}/build
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
NOTARIZE_USERNAME: ${{ secrets.AC_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.AC_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
PRODUCT_BUNDLE_IDENTIFIER: cc.avogadro
run: |
# create variables
if [ -n "${P12_PASSWORD}" ]; then
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
# create temporary keychain if the cert is non-zero
if [ -s $CERTIFICATE_PATH ]; then
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# signing occurs via avogadroapp cpack instructions
fi # certificate exists
fi # password exists
- name: Pack
if: matrix.config.artifact != 0
shell: bash
run: |
if [ -z "${P12_PASSWORD}" ]; then
unset CODESIGN_IDENTITY # to prevent cpack failing when trying to sign
fi
if [ -z "${OPENSSL_ROOT_DIR}" ]; then
unset OPENSSL_ROOT_DIR
fi
cpack ${{ matrix.config.cpack_flags }}
env:
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
OPENSSL_ROOT_DIR: ${{ matrix.config.ssl_env }}
working-directory: ${{ runner.workspace }}/build/avogadroapp
- name: AppImage
if: matrix.config.os == 'ubuntu-18.04'
shell: bash
run: |
mkdir appdir
mv prefix appdir/usr
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
wget -c -nv "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x *.AppImage
./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -bundle-non-qt-libs -extra-plugins=iconengines
# add the custom AppRun
rm appdir/AppRun
cp ../avogadrolibs/avogadrolibs/scripts/AppImage.sh appdir/AppRun
chmod a+x appdir/AppRun
./appimagetool-x86_64.AppImage appdir
mv Avogadro2*.AppImage avogadroapp # for upload
# remove the cpack files
rm avogadroapp/Avogadro2*Linux.*
working-directory: ${{ runner.workspace }}/build
- name: Notarize Mac DMG
if: runner.os == 'macOS'
run: |
# check current directory (failing signing)
echo `pwd`
ls -ld
# check if we have the password and the username
if [ -n "${NOTARIZE_PASSWORD}" ] && [ -n "${NOTARIZE_USERNAME}" ]; then
codesign -s "$CODESIGN_IDENTITY" --timestamp Avogadro2*.dmg
npx notarize-cli --file Avogadro2*.dmg
fi
working-directory: ${{ runner.workspace }}/build/avogadroapp
env:
NOTARIZE_USERNAME: ${{ secrets.AC_USERNAME }}
NOTARIZE_PASSWORD: ${{ secrets.AC_PASSWORD }}
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_ID }}
PRODUCT_BUNDLE_IDENTIFIER: cc.avogadro
- name: Upload
if: matrix.config.artifact != 0
uses: actions/upload-artifact@v4
with:
path: ${{ runner.workspace }}/build/avogadroapp/Avogadro2*.*
name: ${{ matrix.config.artifact }}
- name: Cleanup
if: ${{ always() }} # To ensure this step runs even when earlier steps fail
shell: bash
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
avogadroapp-1.100.0/.github/workflows/clang-format-check.yml 0000664 0000000 0000000 00000004461 14743753373 0023746 0 ustar 00root root 0000000 0000000 name: clang-format Check
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/heads/master' }}
steps:
- name: 'Install clang-format'
run: sudo apt-get -qq install clang-format-13
- uses: actions/checkout@v4
- name: 'Run clang-format-diff'
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/openchemistry/avogadrolibs
git fetch origin master:master
echo `which clang-format-diff-13`
export MASTER_SHA=`cat .git/refs/heads/master`
echo MASTER_SHA=${MASTER_SHA}
git diff `cat .git/refs/heads/master` --name-only
DIFF=`git diff -U0 ${MASTER_SHA} -- '*.h' '*.cpp' | clang-format-diff-13 -p1`
if [ -z "$DIFF" ]; then
printf "clang-format-diff reports no problems"
exit 0
else
git diff -U0 ${MASTER_SHA} -- '*.h' '*.cpp' | clang-format-diff-13 -p1 >${{ runner.workspace }}/clang-format.diff
exit 1
fi
- name: Upload patch
if: failure()
uses: actions/upload-artifact@v4
with:
path: ${{ runner.workspace }}/clang-format.diff
name: clang-format.diff
- name: Comment on diff
if: failure()
run: |
export NAME=`curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | jq '.artifacts[].name'`
export DL=`curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" | jq '.artifacts[].archive_download_url'`
export URL="https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts"
echo URL=${URL}
echo NAME=${NAME}
echo DL=${DL}
curl "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts"
jq -nc "{\"body\": \"ERROR: clang-format-diff detected formatting issues. See the artifact for a patch or run clang-format on your branch.\"}" | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments"
avogadroapp-1.100.0/.github/workflows/codacy.yml 0000664 0000000 0000000 00000004714 14743753373 0021564 0 ustar 00root root 0000000 0000000 # This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '28 10 * * 6'
permissions:
contents: read
jobs:
codacy-security-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v4
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@master
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
- name: Filter out MISRA
run: |
pip install globber
python3 scripts/filter_sarif.py --input results.sarif --output filtered.sarif --split-lines -- "-**/*.*:cppcheck_misra*"
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: filtered.sarif
avogadroapp-1.100.0/.github/workflows/codeql.yml 0000664 0000000 0000000 00000006350 14743753373 0021567 0 ustar 00root root 0000000 0000000 # For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '42 6 * * 6'
env:
QT_VERSION: 5.15.2
FEATURES: -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout openchemistry
uses: actions/checkout@v4
with:
repository: openchemistry/openchemistry
submodules: recursive
- name: Checkout avogadroapp
uses: actions/checkout@v4
with:
path: avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@v4
with:
repository: openchemistry/avogadrolibs
path: avogadrolibs
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get -qq update
sudo apt-get -qq install ninja-build libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5x11extras5-dev libqt5svg5-dev
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
cache: True
version: ${{ env.QT_VERSION }}
- name: Grab cache files
uses: actions/cache@v4
with:
path: |
${{ runner.workspace }}/build/thirdparty
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-thirdparty
- name: Configure
run: |
cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${{matrix.config.cmake_flags}}
shell: bash
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: ${{ github.workspace }}/avogadroapp
queries: security-extended,security-and-quality
config-file: ${{ github.workspace }}/avogadrolibs/.github/codeql-config.yml
- name: Build
run: |
cmake --build . -j 4 --config RelWithDebInfo
shell: bash
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
checkout_path: ${{ github.workspace }}/avogadroapp
avogadroapp-1.100.0/.github/workflows/flatpak.yml 0000664 0000000 0000000 00000006037 14743753373 0021744 0 ustar 00root root 0000000 0000000 name: Build Flatpak
on: [push, pull_request]
jobs:
flatpak:
name: "Flatpak"
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt update -qq && sudo apt install -y -qq flatpak flatpak-builder
- name: Configure flatpak
run: flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
- name: Install flatpak-builder
run: flatpak --user install --or-update --noninteractive flathub org.flatpak.Builder
- name: Configure git
run: git config --global protocol.file.allow always
# Have to do this because for a while git's handling of submodules was broken
# See https://github.com/flatpak/flatpak-builder/issues/495
- name: Checkout openchemistry
uses: actions/checkout@v4
with:
repository: openchemistry/openchemistry
submodules: false
path: openchemistry
- name: Checkout avogadroapp
uses: actions/checkout@v4
with:
path: openchemistry/avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@v4
with:
repository: openchemistry/avogadrolibs
path: openchemistry/avogadrolibs
- name: Checkout i18n
uses: actions/checkout@v4
with:
repository: openchemistry/avogadro-i18n
path: openchemistry/avogadro-i18n
- name: Checkout avogadrogenerators
uses: actions/checkout@v4
with:
repository: openchemistry/avogenerators
path: openchemistry/avogadrogenerators
- name: Checkout crystals
uses: actions/checkout@v4
with:
repository: openchemistry/crystals
path: openchemistry/crystals
- name: Checkout fragments
uses: actions/checkout@v4
with:
repository: openchemistry/fragments
path: openchemistry/fragments
- name: Checkout molecules
uses: actions/checkout@v4
with:
repository: openchemistry/molecules
path: openchemistry/molecules
- name: Checkout Flathub shared-modules
uses: actions/checkout@v4
with:
repository: flathub/shared-modules
path: shared-modules
- name: Set up tmate session
if: failure()
uses: mxschmitt/action-tmate@v3
- name: Move manifest
run: mv openchemistry/avogadroapp/flatpak/org.openchemistry.Avogadro2.yaml ./
- name: Build with flatpak-builder
run: dbus-run-session flatpak run org.flatpak.Builder --force-clean --user --install-deps-from=flathub --arch=x86_64 --default-branch=test --repo=repo builddir org.openchemistry.Avogadro2.yaml
- name: Create bundle
run: flatpak build-bundle repo Avogadro2.flatpak org.openchemistry.Avogadro2 test
- name: Upload bundle
uses: actions/upload-artifact@v4
with:
path: Avogadro2.flatpak
- name: Cleanup
if: ${{ always() }} # To ensure this step runs even when earlier steps fail
shell: bash
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
avogadroapp-1.100.0/.github/workflows/misspell-fixer.yml 0000664 0000000 0000000 00000000500 14743753373 0023252 0 ustar 00root root 0000000 0000000 name: misspell-fixer
on: [workflow_dispatch]
jobs:
spelling-check:
name: Spelling Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: misspell-fixer check for code and comments
uses: sobolevn/misspell-fixer-action@master
with:
options: '-rsnuRVd avogadro/'
avogadroapp-1.100.0/.github/workflows/release-drafter.yml 0000664 0000000 0000000 00000001515 14743753373 0023363 0 ustar 00root root 0000000 0000000 name: Release Drafter
# https://github.com/release-drafter/release-drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v6
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
avogadroapp-1.100.0/.github/workflows/update-i18n-templates.yml 0000664 0000000 0000000 00000001516 14743753373 0024352 0 ustar 00root root 0000000 0000000 name: update-i18n-templates
on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
# run weekly, every Sunday at 01:23
- cron: '23 1 * * 0'
jobs:
update-i18n:
name: Update translation templates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install packages
run: |
sudo apt-get -qq update
sudo apt-get -qq install gettext
- name: Run extract-messages
run: |
sh scripts/extract-messages.sh
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
commit-message: "Automated translation updates"
signoff: true
title: "Automated translation updates"
branch: update-i18n-templates
delete-branch: true
labels: i18n
avogadroapp-1.100.0/.gitmodules 0000664 0000000 0000000 00000000171 14743753373 0016350 0 ustar 00root root 0000000 0000000 [submodule "flatpak/shared-modules"]
path = flatpak/shared-modules
url = https://github.com/flathub/shared-modules.git
avogadroapp-1.100.0/CMakeLists.txt 0000664 0000000 0000000 00000005006 14743753373 0016735 0 ustar 00root root 0000000 0000000 cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
# Use the new policy for linking to qtmain
if(POLICY CMP0020)
# cmake_policy(SET CMP0020 NEW)
endif()
# Set CMP0080 to OLD for now for BundleUtilities, this needs porting to NEW.
if(POLICY CMP0080)
cmake_policy(SET CMP0080 OLD)
endif()
project(AvogadroApp)
set(CMAKE_MODULE_PATH ${AvogadroApp_SOURCE_DIR}/cmake)
# Request C++17 standard, using new CMake variables.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
# Set symbol visibility defaults for all targets.
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN True)
include(BuildType)
include(BuildLocation)
include(CompilerFlags)
include(InstallLocation)
include(DetermineVersion)
# Set up our version.
set(AvogadroApp_VERSION_MAJOR "1")
set(AvogadroApp_VERSION_MINOR "100")
set(AvogadroApp_VERSION_PATCH "0")
set(AvogadroApp_VERSION
"${AvogadroApp_VERSION_MAJOR}.${AvogadroApp_VERSION_MINOR}.${AvogadroApp_VERSION_PATCH}")
find_package(Git)
determine_version(${AvogadroApp_SOURCE_DIR} ${GIT_EXECUTABLE} "AvogadroApp")
if(APPLE)
set(MACOSX_BUNDLE_NAME "Avogadro2")
set(prefix "${MACOSX_BUNDLE_NAME}.app/Contents")
set(INSTALL_INCLUDE_DIR "${prefix}/${INSTALL_INCLUDE_DIR}")
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
set(INSTALL_LIBRARY_DIR "${prefix}/${INSTALL_LIBRARY_DIR}")
set(INSTALL_ARCHIVE_DIR "${prefix}/${INSTALL_ARCHIVE_DIR}")
set(INSTALL_DATA_DIR "${prefix}/${INSTALL_DATA_DIR}")
set(INSTALL_DOC_DIR "${prefix}/${INSTALL_DOC_DIR}")
set(INSTALL_CMAKE_DIR "${prefix}/Resources")
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(QT_VERSION "5" CACHE STRING "What major version of Qt")
set(QT_VERSIONS_SUPPORTED 5 6)
set_property(CACHE QT_VERSION PROPERTY STRINGS 5 6)
if(NOT QT_VERSION IN_LIST QT_VERSIONS_SUPPORTED)
message(FATAL_ERROR "Qt version must be one of ${QT_VERSIONS_SUPPORTED}")
endif()
option(ENABLE_TESTING "Enable testing and building the tests." OFF)
if(ENABLE_TESTING)
include(CTest)
enable_testing()
endif()
option(Avogadro_ENABLE_RPC "Enable RPC server" ON)
add_subdirectory(avogadro)
option(BUILD_DOCUMENTATION "Build project documentation" OFF)
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()
install(
FILES
README.md
CONTRIBUTING.md
LICENSE
DESTINATION "${INSTALL_DOC_DIR}/avogadro2")
include(AvogadroCPack)
if(ENABLE_TESTING)
include(BuildPackageTest)
BuildPackageTest_Add("AvogadroApp" "${CMAKE_CURRENT_BINARY_DIR}")
add_subdirectory(tests)
endif()
avogadroapp-1.100.0/CONTRIBUTING.md 0000664 0000000 0000000 00000001563 14743753373 0016432 0 ustar 00root root 0000000 0000000 Contributing
------------
Our project uses the standard GitHub pull request process for code review
and integration. Please check our [development][Development] guide for more
details on developing and contributing to the project. The GitHub issue
tracker can be used to report bugs, make feature requests, etc.
Our [wiki][Wiki] is used to document features, flesh out designs and host other
documentation. Our API is documented using Doxygen with updated
documentation generated nightly. We have several [mailing lists][MailingLists]
to coordinate development and to provide support.
[Development]: http://wiki.openchemistry.org/Development "Development guide"
[Wiki]: http://wiki.openchemistry.org/ "Open Chemistry wiki"
[Doxygen]: http://doc.openchemistry.org/avogadrolibs/api/ "API documentation"
[MailingLists]: http://openchemistry.org/mailing-lists "Mailing Lists"
avogadroapp-1.100.0/CTestConfig.cmake 0000664 0000000 0000000 00000000374 14743753373 0017352 0 ustar 00root root 0000000 0000000 set(CTEST_PROJECT_NAME "AvogadroApp")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "cdash.openchemistry.org")
set(CTEST_DROP_LOCATION "/submit.php?project=AvogadroApp")
set(CTEST_DROP_SITE_CDASH TRUE)
avogadroapp-1.100.0/LICENSE 0000664 0000000 0000000 00000002745 14743753373 0015211 0 ustar 00root root 0000000 0000000 Copyright (c) 2011-2020, Kitware, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
avogadroapp-1.100.0/README.md 0000664 0000000 0000000 00000010772 14743753373 0015462 0 ustar 00root root 0000000 0000000 # ![Avogadro 2][Avogadro2Logo] Avogadro 2
[](https://github.com/OpenChemistry/avogadrolibs/releases) [](https://github.com/OpenChemistry/avogadrolibs/blob/master/LICENSE) [](https://github.com/OpenChemistry/avogadrolibs/actions) [](http://makeapullrequest.com) [](https://github.com/OpenChemistry/avogadrolibs/graphs/contributors) [](https://opencollective.com/open-chemistry)
## Introduction
Avogadro is an advanced molecular editor designed for cross-platform use in
computational chemistry, molecular modeling, bioinformatics, materials science,
and related areas. It offers flexible rendering and a powerful plugin
architecture.
Core features and goals of the Avogadro project include:
* Open source distributed under the liberal 3-clause BSD license
* Cross platform with builds on Linux, Mac OS X and Windows
* Intuitive interface designed to be useful to whole community
* Fast and efficient embracing the latest technologies
* Extensible, making extensive use of a plugin architecture
* Flexible supporting a range of chemical data formats and packages
The code in this repository is a rewrite of Avogadro with source
code split across a
[libraries repository](https://github.com/openchemistry/avogadrolibs)
and an [application repository](https://github.com/openchemistry/avogadroapp).
The new code architecture provides a high-performance rendering engine, modern
code development, and significantly improved speed and stability.
Avogadro 2 is being developed as part of the [Open Chemistry][OpenChemistry]
project by an open community, and was started at [Kitware][Kitware] as
an open source community project. The Avogadro 1.x series currently has more
features, and can be found [here][Avogadro1]. We are actively porting more
features to the Avogadro 2 code base, and making regular releases to get
feedback from the community.
We are actively working to finish Avogadro 2.0 in 2022.
## Installing
We provide nightly binaries built by GitHub actions for:
* [Linux AppImage](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_cmake/master/Avogadro2.AppImage.zip)
* [MacOS](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_cmake/master/macOS.dmg.zip)
* [Windows 64-bit](https://nightly.link/OpenChemistry/avogadrolibs/workflows/build_cmake/master/Win64.exe.zip)
If you would like to build from source we recommend that you
follow our [building Open Chemistry][Build] guide that will take care of
building most dependencies.
## Contributing
We welcome *all* kinds of contributions as a community project, from bug
reports, feature suggestions, language translations, Python plugins,
and C++ code development.
Our project uses the standard GitHub pull request process for code review
and integration. Please check our [contribution][Contribution] guide for more
details on developing and contributing to the project. The [GitHub issue
tracker](https://github.com/openchemistry/avogadrolibs/issues/)
can be used to report bugs, make feature requests, etc. Our API is
[documented online][API] with updated documentation generated nightly.
To introduce yourself, ask for help, or general discussion, we welcome everyone
to our [forum](https://discuss.avogadro.cc/)
Contributors Hall of Fame:
[Avogadro2Logo]: https://raw.githubusercontent.com/OpenChemistry/avogadrolibs/master/docs/avogadro2_64.png "Avogadro2"
[OpenChemistry]: http://openchemistry.org/ "Open Chemistry Project"
[OpenChemistryLogo]: https://raw.githubusercontent.com/OpenChemistry/avogadrolibs/master/docs/OpenChemistry128.png "Open Chemistry"
[Kitware]: http://kitware.com/ "Kitware, Inc."
[Avogadro1]: http://avogadro.cc/ "Avogadro 1"
[Build]: https://two.avogadro.cc/develop/build.html#develop-build "Building Avogadro"
[Contribution]: https://two.avogadro.cc/contrib/ "Contribution guide"
[API]: https://two.avogadro.cc/api/ "API documentation"
avogadroapp-1.100.0/SECURITY.md 0000664 0000000 0000000 00000001553 14743753373 0015771 0 ustar 00root root 0000000 0000000 # Security Policy
## Supported Versions
At the moment, Avogadro2 is in beta release. As such, we can most easily support
security updates on the most recent release and current nightly snapshots.
We will work with distributions (e.g., Ubuntu, FreeBSD, etc.) to provide security
patches for widely used long-term-support OS.
| Version | Supported |
| ------- | ------------------ |
| 1.100.x | :white_check_mark: |
| 1.99.x | :white_check_mark: |
| < 1.99 | :x: |
## Reporting a Vulnerability
We currently support private security vulnerability reporting through our
[GitHub](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)
pages. We will work to verify the security vulnerability within 14 days
and a patch or new release within 30 days of reporting.
avogadroapp-1.100.0/avogadro/ 0000775 0000000 0000000 00000000000 14743753373 0015776 5 ustar 00root root 0000000 0000000 avogadroapp-1.100.0/avogadro/CMakeLists.txt 0000664 0000000 0000000 00000021460 14743753373 0020541 0 ustar 00root root 0000000 0000000 include(ExternalProject)
find_package(AvogadroLibs REQUIRED NO_MODULE)
include_directories(${AvogadroLibs_INCLUDE_DIRS})
list(APPEND CMAKE_MODULE_PATH ${AvogadroLibs_CMAKE_DIR})
find_package(Eigen3 REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
option(USE_VTK "Build with VTK support" OFF)
if(USE_VTK)
find_package(VTK COMPONENTS GUISupportQt RenderingOpenGL2 REQUIRED)
add_definitions(-DAVO_USE_VTK)
endif()
if(MSVC)
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
# Find the Qt components we need.
if(QT_VERSION EQUAL 6)
find_package(Qt6
COMPONENTS
Concurrent
Widgets
Network
OpenGL
OpenGLWidgets
REQUIRED)
else()
find_package(Qt5
COMPONENTS
Concurrent
Widgets
Network
REQUIRED)
endif()
configure_file(avogadroappconfig.h.in avogadroappconfig.h)
set(avogadro_srcs
aboutdialog.cpp
application.cpp
avogadro.cpp
backgroundfileformat.cpp
mainwindow.cpp
menubuilder.cpp
renderingdialog.cpp
tooltipfilter.cpp
viewfactory.cpp
)
qt_wrap_ui(ui_srcs
aboutdialog.ui
mainwindow.ui
renderingdialog.ui
)
qt_add_resources(rcc_srcs avogadro.qrc)
# download and install QM translation files
# Look in parallel directory for the i18n repository
set(_i18n "${AvogadroApp_SOURCE_DIR}/../avogadro-i18n")
if(NOT EXISTS "${_i18n}")
# download molecules...
ExternalProject_Add(i18n
GIT_REPOSITORY https://github.com/openchemistry/avogadro-i18n
SOURCE_DIR "${AvogadroApp_SOURCE_DIR}/../avogadro-i18n"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()
install(DIRECTORY "${AvogadroApp_SOURCE_DIR}/../avogadro-i18n/avogadroapp/"
"${AvogadroApp_SOURCE_DIR}/../avogadro-i18n/avogadrolibs/"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2/i18n"
FILES_MATCHING PATTERN "*.qm"
)
if(APPLE OR WIN32 OR INSTALL_BUNDLE_FILES)
# copy the qt translation files
get_filename_component(_qttranslationdir "${Qt5_DIR}/../../../translations" ABSOLUTE)
message(STATUS "Install Qt translations ${_qttranslationdir}")
install(DIRECTORY "${_qttranslationdir}/"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2/i18n"
FILES_MATCHING PATTERN "qt_*.qm" PATTERN "qtbase*.qm"
# technically, this also copies qt_help.* but that's not a big deal
)
endif()
if(Avogadro_ENABLE_RPC)
list(APPEND avogadro_srcs rpclistener.cpp)
# MoleQueue is required for its RPC functions.
find_package(MoleQueue REQUIRED)
include_directories(${MoleQueue_INCLUDE_DIRS})
add_definitions("-DAvogadro_ENABLE_RPC")
endif()
if(ENABLE_TESTING)
if(QT_VERSION EQUAL 6)
find_package(Qt6 COMPONENTS Test REQUIRED)
elseif(QT_VERSION EQUAL 5)
find_package(Qt5 COMPONENTS Test REQUIRED)
endif()
find_package(QtTesting REQUIRED NO_MODULE)
include_directories(${QtTesting_INCLUDE_DIRS})
link_directories(${QtTesting_LIBRARY_DIR})
add_definitions(-DQTTESTING)
endif()
# Need to add current binary dir to include path for UI file headers
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# if we are building statically then we need HDF5 targets
if(NOT BUILD_SHARED_LIBS)
find_package(HDF5 REQUIRED COMPONENTS C)
endif()
# Handle Mac OS X specific icons etc.
if(APPLE)
# add some Objective-C++ code
list(APPEND avogadro_srcs mac.mm)
if (QT_VERSION EQUAL 5)
list(APPEND avogadro_srcs ../thirdparty/qcocoacontrols/qcocoamessagebox.mm)
include_directories(SYSTEM "${AvogadroApp_SOURCE_DIR}/thirdparty/qcocoacontrols")
set(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -framework Cocoa")
endif()
# for all the translations, create a .lproj directory
# Migrated from Avo 1.x - contributed by Geoff Hutchison
# We're assuming that there will never be an libavogadro translation
# without a corresponding avogadro one.
# (Fairly safe assumption)
# This regex gives us translations with just two characters
# (e.g., avogadro_fr.ts)
FILE(GLOB avogadro_QM "${INSTALL_DATA_DIR}/avogadro2/i18n/*.qm")
string(REGEX MATCHALL "-[a-z]+\\.qm" langresult "${avogadro_QM}")
string(REGEX REPLACE "-([^.]+)\\.qm" "\\1" languages "${langresult}")
# This one gives us languages for country codes (e.g., avogadro_zh_CN.ts)
string(REGEX MATCHALL "-[a-z]+_[A-Z]+\\.qm" langresult "${avogadro_QM}")
string(REGEX REPLACE "-([^_]+_[^.]+)\\.qm" "\\1" fulllangs "${langresult}")
set (LANGUAGES "${languages};${fulllangs};en;en_US")
foreach(lang ${LANGUAGES})
set( MAC_LANG_DIR "${CMAKE_INSTALL_PREFIX}/Resources/${lang}.lproj" )
install(CODE "EXECUTE_PROCESS(COMMAND
mkdir ${MAC_LANG_DIR}
ERROR_QUIET)")
endforeach()
list(APPEND avogadro_srcs icons/avogadro.icns)
list(APPEND avogadro_srcs icons/doc.icns)
list(APPEND avogadro_srcs icons/cml.icns)
list(APPEND avogadro_srcs icons/cjson.icns)
set(MACOSX_BUNDLE_ICON_FILE avogadro.icns)
set(MACOSX_BUNDLE_BUNDLE_VERSION "${AvogadroApp_VERSION}")
set(MACOSX_BUNDLE_INFO_STRING "Avogadro - version ${AvogadroApp_VERSION}")
# Change following line to point to actual icns file in bundle.
set(MACOSX_BUNDLE_GUI_IDENTIFIER "cc.avogadro")
set(MACOSX_BUNDLE_BUNDLE_NAME "Avogadro")
set_source_files_properties(icons/avogadro.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/doc.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/cjson.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(icons/cml.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
elseif(UNIX)
install(FILES "icons/org.openchemistry.Avogadro2.desktop" DESTINATION "${INSTALL_XDG_APPS_DIR}")
install(FILES "icons/org.openchemistry.Avogadro2.metainfo.xml" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/metainfo")
install(FILES "icons/avogadro.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/32x32/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/16x16@2/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_64.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/64x64/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_64.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/32x32@2/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_128.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/128x128/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2_256.png" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/256x256/apps"
RENAME "org.openchemistry.Avogadro2.png")
install(FILES "icons/avogadro2.svg" DESTINATION "${INSTALL_XDG_ICON_DIR}/hicolor/scalable/apps"
RENAME "org.openchemistry.Avogadro2.svg")
elseif(WIN32)
list(APPEND avogadro_srcs icons/avogadro.rc)
endif()
if(USE_3DCONNEXION AND (WIN32 OR APPLE))
list(APPEND avogadro_srcs icons/3dx_pivot.png)
list(APPEND avogadro_srcs tdxcontroller.cpp)
list(APPEND avogadro_srcs "${AvogadroApp_SOURCE_DIR}/thirdparty/3DConnexion/src/navlib_load.cpp")
list(APPEND avogadro_srcs "${AvogadroApp_SOURCE_DIR}/thirdparty/3DConnexion/src/navlib_stub.c")
set_source_files_properties(icons/3dx_pivot.png PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
endif()
add_executable(avogadro WIN32 MACOSX_BUNDLE
${avogadro_srcs} ${ui_srcs} ${rcc_srcs})
target_link_libraries(avogadro Qt::Widgets Qt::Network Qt::Concurrent)
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRTD")
if(QT_VERSION EQUAL 5)
target_link_libraries(avogadro Qt::WinMain)
endif()
endif()
set_target_properties(avogadro PROPERTIES AUTOMOC TRUE)
target_link_libraries(avogadro Avogadro::QtOpenGL Avogadro::QtGui Avogadro::QtPlugins)
if(Avogadro_ENABLE_RPC)
target_link_libraries(avogadro MoleQueueServerCore MoleQueueClient)
endif()
if(USE_VTK)
target_link_libraries(avogadro ${VTK_LIBRARIES} Avogadro::Vtk)
endif()
if(APPLE)
set_target_properties(avogadro PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_NAME})
else()
set_target_properties(avogadro PROPERTIES OUTPUT_NAME "avogadro2")
endif()
if(ENABLE_TESTING)
target_link_libraries(avogadro qttesting)
endif()
if(QT_VERSION EQUAL 6)
target_link_libraries(avogadro Qt6::OpenGL Qt6::OpenGLWidgets)
endif()
if(USE_3DCONNEXION AND (WIN32 OR APPLE))
target_compile_definitions(avogadro PUBLIC _3DCONNEXION)
target_include_directories(avogadro PUBLIC "${AvogadroApp_SOURCE_DIR}/thirdparty/3DConnexion/inc")
if(APPLE)
target_compile_definitions(avogadro PUBLIC __APPLE__)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdeclspec")
elseif(WIN32)
install(FILES "icons/3dx_pivot.png" DESTINATION "${CMAKE_INSTALL_BINDIR}/img")
endif()
endif()
install(TARGETS avogadro
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
BUNDLE DESTINATION .
)
# Keep "add_subdirectory(lastinstall)" last: fixup_bundle needs to be
# *after* all other install(TARGETS and install(FILES calls
add_subdirectory(lastinstall)
avogadroapp-1.100.0/avogadro/aboutdialog.cpp 0000664 0000000 0000000 00000003220 14743753373 0020771 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include "aboutdialog.h"
#include "avogadroappconfig.h"
#include "ui_aboutdialog.h"
#include
#include
namespace Avogadro {
AboutDialog::AboutDialog(QWidget* parent_)
: QDialog(parent_)
, m_ui(new Ui::AboutDialog)
{
m_ui->setupUi(this);
QString html(""
"%2"
"
");
// Add the labels
m_ui->versionLabel->setText(html.arg("20").arg(tr("Version:")));
m_ui->libsLabel->setText(html.arg("10").arg(tr("Avogadro Library Version:")));
m_ui->qtVersionLabel->setText(html.arg("10").arg(tr("Qt Version:")));
m_ui->sslVersionLabel->setText(html.arg("10").arg(tr("SSL Version:")));
// Add the version numbers
m_ui->version->setText(html.arg("20").arg(AvogadroApp_VERSION));
m_ui->libsVersion->setText(html.arg("10").arg(version()));
m_ui->qtVersion->setText(html.arg("10").arg(qVersion()));
m_ui->sslVersion->setText(
html.arg("10").arg(QSslSocket::sslLibraryVersionString()));
// Add support for a 2x replacement (mainly Mac OS X retina at this point).
if (window()->devicePixelRatio() == 2) {
QPixmap pix(":/icons/Avogadro2_About@2x.png");
pix.setDevicePixelRatio(2);
m_ui->Image->setPixmap(pix);
}
}
AboutDialog::~AboutDialog()
{
delete m_ui;
}
} /* namespace Avogadro */
avogadroapp-1.100.0/avogadro/aboutdialog.h 0000664 0000000 0000000 00000001214 14743753373 0020437 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_ABOUTDIALOG_H
#define AVOGADRO_ABOUTDIALOG_H
#include
namespace Ui {
class AboutDialog;
}
namespace Avogadro {
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog(QWidget* Parent);
~AboutDialog();
private:
Ui::AboutDialog* m_ui;
};
} // End Avogadro namespace
#endif // AVOGADRO_ABOUTDIALOG_H
avogadroapp-1.100.0/avogadro/aboutdialog.ui 0000664 0000000 0000000 00000023417 14743753373 0020636 0 ustar 00root root 0000000 0000000
AboutDialog
0
0
516
576
0
0
true
-
0
0
:/icons/Avogadro2_About.png
-
-
-
Qt::Horizontal
40
20
-
Version:
Qt::AutoText
Qt::AlignCenter
-
0.1
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
-
Qt::Horizontal
40
20
-
-
Qt::Horizontal
40
20
-
Avogadro Library Version:
-
0.1
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
-
Qt::Horizontal
40
20
-
-
Qt::Horizontal
40
20
-
Qt Version:
-
0.1
Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
-
SSL Version:
-
0.1
-
Qt::Horizontal
40
20
-
Qt::Vertical
20
5
-
-
Qt::Horizontal
40
20
-
<html><head/><body><p><span style=" font-size:10pt; font-weight:600;">License: </span><a href="https://opensource.org/licenses/BSD-3-Clause"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">BSD 3-Clause</span></a></p></body></html>
true
-
Qt::Horizontal
40
20
-
Qt::Vertical
20
5
-
-
<html><head/><body><p><a href="https://www.openchemistry.org"><span style=" text-decoration: underline; color:#0000ff;">www.openchemistry.org</span></a></p></body></html>
Qt::RichText
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
true
-
Qt::Horizontal
40
20
-
<html><head/><body><p><a href="https://www.kitware.com"><span style=" text-decoration: underline; color:#0000ff;">www.kitware.com</span></a></p></body></html>
true
-
-
Qt::Horizontal
0
20
-
OK
OK
clicked()
AboutDialog
accept()
278
253
96
254
avogadroapp-1.100.0/avogadro/application.cpp 0000664 0000000 0000000 00000003135 14743753373 0021007 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include "application.h"
#include "mainwindow.h"
#include
#include
#include
#include
#include
#include
namespace Avogadro {
Application::Application(int& argc, char** argv)
: QApplication(argc, argv)
{ }
// Handle open events (e.g., Mac OS X open files)
bool Application::event(QEvent* event)
{
switch (event->type()) {
case QEvent::FileOpen:
return loadFile(static_cast(event)->file());
default:
return QGuiApplication::event(event);
}
}
bool Application::loadFile(const QString& fileName)
{
if (fileName.isEmpty()) {
return false;
}
// check to see if we already have an open window
// (we'll let MainWindow handle the real work)
const MainWindow* window = nullptr;
foreach (const QWidget* item, topLevelWidgets()) {
window = qobject_cast(item);
if (window)
break;
}
// if not, need to make this spawn a new instance
if (!window) {
qDebug() << " don't have a window! ";
return false;
}
if (!const_cast(window)->openFile(fileName)) {
qDebug() << " failed to open through MainWindow";
return false;
}
return true;
}
} // end namespace Avogadro
avogadroapp-1.100.0/avogadro/application.h 0000664 0000000 0000000 00000001206 14743753373 0020451 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_APPLICATION_H
#define AVOGADRO_APPLICATION_H
#include
namespace Avogadro {
class Application : public QApplication
{
Q_OBJECT
public:
Application(int& argc, char** argv);
bool loadFile(const QString& fileName);
protected:
bool event(QEvent* event);
private:
};
} // end namespace Avogadro
#endif
avogadroapp-1.100.0/avogadro/avogadro.cpp 0000664 0000000 0000000 00000025461 14743753373 0020314 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// install a message handler (for Windows)
#include
#include
#include
#include
#include "application.h"
#include "avogadroappconfig.h"
#include "mainwindow.h"
#ifdef Q_OS_MAC
void removeMacSpecificMenuItems();
#endif
#ifdef Avogadro_ENABLE_RPC
#include "rpclistener.h"
#endif
#define DEBUG false
// Based on https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler
void myMessageOutput(QtMsgType type, const QMessageLogContext& context,
const QString& msg)
{
QByteArray localMsg = msg.toLocal8Bit();
QString file = context.file;
QString function = context.function;
// get current date and time
QDateTime dateTime = QDateTime::currentDateTime();
QString dateTimeString = dateTime.toString("yyyy-MM-dd hh:mm:ss");
QString message;
switch (type) {
case QtInfoMsg:
message = QString("Info: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtWarningMsg:
message = QString("Warning: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtCriticalMsg:
message = QString("Critical: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtFatalMsg:
message = QString("Fatal: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
case QtDebugMsg:
default:
message = QString("Debug: %1 (%2:%3, %4)")
.arg(localMsg.constData())
.arg(file)
.arg(context.line)
.arg(function);
break;
}
QString writableDocs =
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
QFile outFile(writableDocs + "/avogadro2.log");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << message << Qt::endl;
}
int main(int argc, char* argv[])
{
#ifdef Q_OS_MAC
// call some Objective-C++
removeMacSpecificMenuItems();
// Native Mac applications do not have icons in the menus
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
QCoreApplication::setOrganizationName("OpenChemistry");
QCoreApplication::setOrganizationDomain("openchemistry.org");
QCoreApplication::setApplicationName("Avogadro");
QGuiApplication::setDesktopFileName("org.openchemistry.Avogadro2");
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#ifdef Q_OS_WIN
// We need to ensure desktop OpenGL is loaded for our rendering.
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
// remove the previous log file
QString writableDocs =
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
QFile outFile(writableDocs + "/avogadro2.log");
outFile.remove(); // we don't care if this fails
// install the message handler (goes to Documents / avogadro2.log)
qInstallMessageHandler(myMessageOutput);
#endif
// output the version information
qDebug() << "Avogadroapp version: " << AvogadroApp_VERSION;
qDebug() << "Avogadrolibs version: " << Avogadro::version();
qDebug() << "Qt version: " << qVersion();
qDebug() << "SSL version: " << QSslSocket::sslLibraryVersionString();
Avogadro::Application app(argc, argv);
QSettings settings;
QString language = settings.value("locale", "System").toString();
// Before we do much else, load translations
// This ensures help messages and debugging info can be translated
QLocale currentLocale;
if (language != "System") {
currentLocale = QLocale(language);
}
qDebug() << "Using locale: " << currentLocale.name();
QStringList translationPaths;
// check environment variable and local paths
foreach (const QString& variable, QProcess::systemEnvironment()) {
QStringList split1 = variable.split('=');
if (split1[0] == "AVOGADRO_TRANSLATIONS") {
foreach (const QString& path, split1[1].split(':'))
translationPaths << path;
}
}
translationPaths << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
translationPaths << QCoreApplication::applicationDirPath() +
"/../share/avogadro2/i18n/";
// add the possible plugin download paths
QStringList stdPaths =
QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation);
foreach (const QString& dirStr, stdPaths) {
QString path = dirStr + "/i18n/avogadro-i18n/avogadroapp";
translationPaths << path; // we'll check if these exist below
path = dirStr + "/i18n/avogadro-i18n/avogadrolibs";
translationPaths << path;
}
// Make sure to use pointers:
//
auto* qtTranslator = new QTranslator;
auto* qtBaseTranslator = new QTranslator;
auto* avoTranslator = new QTranslator;
auto* avoLibsTranslator = new QTranslator;
bool qtLoaded = false;
bool avoLoaded = false;
bool libsLoaded = false;
QString successfulPath;
foreach (const QString& translationPath, translationPaths) {
if (!qtLoaded &&
qtTranslator->load(currentLocale, "qt", "_", translationPath)) {
if (app.installTranslator(qtTranslator)) {
qDebug() << "qt Translation successfully loaded.";
qtLoaded = true;
}
}
if (!qtLoaded &&
qtBaseTranslator->load(currentLocale, "qtbase", "_", translationPath)) {
if (app.installTranslator(qtBaseTranslator)) {
qDebug() << "qtbase Translation successfully loaded.";
qtLoaded = true;
}
}
if (!avoLoaded && avoTranslator->load(currentLocale, "avogadroapp", "-",
translationPath)) {
if (app.installTranslator(avoTranslator)) {
qDebug() << "AvogadroApp Translation " << currentLocale.name()
<< " loaded " << translationPath;
avoLoaded = true;
successfulPath = translationPath;
}
}
if (!libsLoaded && avoLibsTranslator->load(currentLocale, "avogadrolibs",
"-", translationPath)) {
if (app.installTranslator(avoLibsTranslator)) {
qDebug() << "AvogadroLibs Translation " << currentLocale.name()
<< " loaded " << translationPath;
libsLoaded = true;
}
}
} // done looking for translations
// Go through the possible translations / locale codes
// to get the localized names for the language dialog
if (successfulPath.isEmpty()) {
// the default for most systems
// (e.g., /usr/bin/avogadro2 -> /usr/share/avogadro2/i18n/)
// or /Applications/Avogadro2.app/Contents/share/avogadro2/i18n/
// .. etc.
successfulPath =
QCoreApplication::applicationDirPath() + "/../share/avogadro2/i18n/";
}
QDir dir(successfulPath);
QStringList files =
dir.entryList(QStringList() << "avogadroapp*.qm", QDir::Files);
QStringList languages, codes;
languages << "System"; // we handle this in the dialog
codes << ""; // default is the system language
bool addedUS = false;
// check what files exist
foreach (const QString& file, files) {
// remove "avogadroapp-" and the ".qm"
QString localeCode = file.left(file.indexOf('.')).remove("avogadroapp-");
if (localeCode.startsWith("en") && !addedUS) {
// add US English (default)
addedUS = true;
QLocale us("en_US");
languages << us.nativeLanguageName();
codes << "en_US";
}
QLocale locale(localeCode);
QString languageName = locale.nativeLanguageName();
if (languageName.isEmpty() && localeCode == "oc")
languageName = "Occitan";
// potentially other exceptions here
// cases like Brazilian Portuguese show up as duplicates
if (languages.contains(languageName)) {
languageName += " (" + locale.nativeCountryName() + ")";
}
languages << languageName;
codes << localeCode;
}
// Check for valid OpenGL support.
auto offscreen = new QOffscreenSurface;
offscreen->create();
auto context = new QOpenGLContext;
context->create();
context->makeCurrent(offscreen);
bool contextIsValid = context->isValid();
delete context;
delete offscreen;
if (!contextIsValid) {
QMessageBox::information(
nullptr, QCoreApplication::translate("main.cpp", "Avogadro"),
QCoreApplication::translate("main.cpp",
"This system does not support OpenGL."));
return 1;
}
// Set up the default format for our GL contexts.
#if defined(Q_OS_MAC)
QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat();
defaultFormat.setAlphaBufferSize(8);
QSurfaceFormat::setDefaultFormat(defaultFormat);
#endif
QStringList fileNames;
bool disableSettings = false;
#ifdef QTTESTING
QString testFile;
bool testExit = true;
#endif
QStringList args = QCoreApplication::arguments();
for (QStringList::const_iterator it = args.constBegin() + 1;
it != args.constEnd(); ++it) {
if (*it == "--test-file" && it + 1 != args.constEnd()) {
#ifdef QTTESTING
testFile = *(++it);
#else
qWarning("Avogadro called with --test-file but testing is disabled.");
return EXIT_FAILURE;
#endif
} else if (*it == "--test-no-exit") {
#ifdef QTTESTING
testExit = false;
#else
qWarning("Avogadro called with --test-no-exit but testing is disabled.");
return EXIT_FAILURE;
#endif
} else if (*it == "--disable-settings") {
disableSettings = true;
} else if (it->startsWith("-")) {
qWarning("Unknown command line option '%s'", qPrintable(*it));
return EXIT_FAILURE;
} else { // Assume it is a file name.
fileNames << *it;
}
}
Avogadro::MainWindow window(fileNames, disableSettings);
window.setTranslationList(languages, codes);
#ifdef QTTESTING
window.playTest(testFile, testExit);
#endif
window.show();
#ifdef Avogadro_ENABLE_RPC
// create rpc listener
Avogadro::RpcListener listener;
listener.start();
#endif
return app.exec();
}
avogadroapp-1.100.0/avogadro/avogadro.qrc 0000664 0000000 0000000 00000000355 14743753373 0020312 0 ustar 00root root 0000000 0000000
icons/avogadro.png
icons/avogadro@2x.png
icons/Avogadro2_About.png
icons/Avogadro2_About@2x.png
avogadroapp-1.100.0/avogadro/avogadroappconfig.h.in 0000664 0000000 0000000 00000000071 14743753373 0022243 0 ustar 00root root 0000000 0000000 #cmakedefine AvogadroApp_VERSION "@AvogadroApp_VERSION@"
avogadroapp-1.100.0/avogadro/backgroundfileformat.cpp 0000664 0000000 0000000 00000007230 14743753373 0022674 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#include "backgroundfileformat.h"
#include
#include
#include
#include
namespace Avogadro {
BackgroundFileFormat::BackgroundFileFormat(Io::FileFormat* format,
QObject* aparent)
: QObject(aparent)
, m_format(format)
, m_molecule(nullptr)
, m_success(false)
{
}
BackgroundFileFormat::~BackgroundFileFormat()
{
delete m_format;
}
void BackgroundFileFormat::read()
{
m_success = false;
m_error.clear();
if (!m_molecule)
m_error = tr("No molecule set in BackgroundFileFormat!");
if (!m_format)
m_error = tr("No file format set in BackgroundFileFormat!");
if (m_fileName.isEmpty())
m_error = tr("No file name set in BackgroundFileFormat!");
if (m_error.isEmpty()) {
// sometimes we hit UTF-16 files, so we need to convert them to UTF-8
// first check whether the file is UTF-16
QFile file(m_fileName);
QTextStream in(&file);
QString text;
bool isUTF16 = false;
if (file.open(QIODevice::ReadOnly)) {
QByteArray data = file.read(2);
// look for a byte-order mark
if ((data.size() == 2 && data[0] == '\xff' && data[1] == '\xfe') ||
(data.size() == 2 && data[0] == '\xfe' && data[1] == '\xff')) {
// UTF-16, read the file and let QString handle decoding
isUTF16 = true;
file.close();
file.open(QIODevice::ReadOnly | QIODevice::Text);
#if QT_VERSION < 0x060000
in.setCodec("UTF-16");
#endif
text = in.readAll();
file.close();
}
}
if (!isUTF16)
m_success =
m_format->readFile(m_fileName.toLocal8Bit().data(), *m_molecule);
else {
// write it to a temporary file and we'll read it back in
// some formats (like the generic output) need a file
// not just a string bugger
// first, we need the *name* of the file, not the full path
// because we're going to save a copy in a temp directory
QTemporaryDir tempDir;
QString tempFileName = tempDir.filePath(QFileInfo(m_fileName).fileName());
QFile tempFile(tempFileName);
if (tempFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&tempFile);
// set it to UTF-8
#if QT_VERSION > 0x060000
out.setEncoding(QStringConverter::Utf8);
#else
out.setCodec("UTF-8");
#endif
out << text;
out.flush();
tempFile.close();
m_success =
m_format->readFile(tempFileName.toLocal8Bit().data(), *m_molecule);
tempFile.remove();
} else // try just reading the string
m_success =
m_format->readString(text.toLocal8Bit().data(), *m_molecule);
}
if (!m_success)
m_error = QString::fromStdString(m_format->error());
}
emit finished();
}
void BackgroundFileFormat::write()
{
m_success = false;
m_error.clear();
if (!m_molecule)
m_error = tr("No molecule set in BackgroundFileFormat!");
if (!m_format)
m_error = tr("No file format set in BackgroundFileFormat!");
if (m_fileName.isEmpty())
m_error = tr("No file name set in BackgroundFileFormat!");
if (m_error.isEmpty()) {
m_success =
m_format->writeFile(m_fileName.toLocal8Bit().data(), *m_molecule);
if (!m_success)
m_error = QString::fromStdString(m_format->error());
}
emit finished();
}
} // namespace Avogadro
avogadroapp-1.100.0/avogadro/backgroundfileformat.h 0000664 0000000 0000000 00000004075 14743753373 0022345 0 ustar 00root root 0000000 0000000 /******************************************************************************
This source file is part of the Avogadro project.
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/
#ifndef AVOGADRO_BACKGROUNDFILEFORMAT_H
#define AVOGADRO_BACKGROUNDFILEFORMAT_H
#include
#include
namespace Avogadro {
namespace Core {
class Molecule;
}
namespace Io {
class FileFormat;
}
/**
* @brief The BackgroundFileFormat class provides a thin QObject wrapper around
* an instance of Io::FileFormat.
*/
class BackgroundFileFormat : public QObject
{
Q_OBJECT
public:
/**
* This class takes ownership of @a format and will delete it when destructed.
*/
explicit BackgroundFileFormat(Io::FileFormat* format, QObject* aparent = 0);
~BackgroundFileFormat();
/**
* The molecule instance to read/write.
* @{
*/
void setMolecule(Core::Molecule* mol) { m_molecule = mol; }
Core::Molecule* molecule() const { return m_molecule; }
/**@}*/
/**
* The name of the file to read/write.
* @{
*/
void setFileName(const QString& filename) { m_fileName = filename; }
QString fileName() const { return m_fileName; }
/**@}*/
/**
* The Io::FileFormat to use.
*/
Io::FileFormat* fileFormat() const { return m_format; }
/**
* @return True if the operation was successful.
*/
bool success() const { return m_success; }
/**
* @return An error string, set if success() is false.
*/
QString error() const { return m_error; }
signals:
/**
* Emitted when a call to read or write is called.
*/
void finished();
public slots:
/**
* Use the fileFormat() to read fileName() into molecule().
*/
void read();
/**
* Use the fileFormat() to write fileName() from molecule().
*/
void write();
private:
Io::FileFormat* m_format;
Core::Molecule* m_molecule;
QString m_fileName;
QString m_error;
bool m_success;
};
} // namespace Avogadro
#endif // AVOGADRO_BACKGROUNDFILEFORMAT_H
avogadroapp-1.100.0/avogadro/icons/ 0000775 0000000 0000000 00000000000 14743753373 0017111 5 ustar 00root root 0000000 0000000 avogadroapp-1.100.0/avogadro/icons/3dx_pivot.png 0000664 0000000 0000000 00000002525 14743753373 0021542 0 ustar 00root root 0000000 0000000 PNG
IHDR
)B tEXtSoftware Adobe ImageReadyqe<